2013-04-15 20:25:08 +04:00
|
|
|
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#ifndef ATOM_BROWSER_ATOM_BROWSER_CONTEXT_H_
|
|
|
|
#define ATOM_BROWSER_ATOM_BROWSER_CONTEXT_H_
|
|
|
|
|
2013-04-20 17:52:46 +04:00
|
|
|
#include "base/memory/scoped_ptr.h"
|
2013-04-15 20:25:08 +04:00
|
|
|
#include "brightray/browser/browser_context.h"
|
|
|
|
|
|
|
|
namespace atom {
|
|
|
|
|
2013-09-20 12:47:47 +04:00
|
|
|
class AtomResourceContext;
|
|
|
|
class AtomURLRequestContextGetter;
|
|
|
|
|
2013-04-15 20:25:08 +04:00
|
|
|
class AtomBrowserContext : public brightray::BrowserContext {
|
|
|
|
public:
|
|
|
|
AtomBrowserContext();
|
|
|
|
virtual ~AtomBrowserContext();
|
|
|
|
|
2013-09-20 12:47:47 +04:00
|
|
|
// Returns the browser context singleton.
|
2013-04-15 20:25:08 +04:00
|
|
|
static AtomBrowserContext* Get();
|
|
|
|
|
2013-09-20 12:47:47 +04:00
|
|
|
// Creates or returns the request context.
|
|
|
|
AtomURLRequestContextGetter* CreateRequestContext(
|
|
|
|
content::ProtocolHandlerMap*);
|
|
|
|
|
|
|
|
AtomURLRequestContextGetter* url_request_context_getter() const {
|
|
|
|
DCHECK(url_request_getter_);
|
|
|
|
return url_request_getter_.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// content::BrowserContext implementations:
|
|
|
|
virtual content::ResourceContext* GetResourceContext() OVERRIDE;
|
|
|
|
|
2013-04-15 20:25:08 +04:00
|
|
|
private:
|
2013-09-20 12:47:47 +04:00
|
|
|
scoped_ptr<AtomResourceContext> resource_context_;
|
|
|
|
scoped_refptr<AtomURLRequestContextGetter> url_request_getter_;
|
|
|
|
|
2013-04-15 20:25:08 +04:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(AtomBrowserContext);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace atom
|
|
|
|
|
|
|
|
#endif // ATOM_BROWSER_ATOM_BROWSER_CONTEXT_H_
|