electron/brightray/browser/browser_context.h

89 lines
3.1 KiB
C
Raw Normal View History

2013-03-13 19:12:05 +00:00
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE-CHROMIUM file.
#ifndef BRIGHTRAY_BROWSER_BROWSER_CONTEXT_H_
#define BRIGHTRAY_BROWSER_BROWSER_CONTEXT_H_
2013-03-13 19:12:05 +00:00
2015-05-22 06:50:41 +00:00
#include "browser/permission_manager.h"
#include "browser/url_request_context_getter.h"
#include "base/memory/ref_counted.h"
2013-03-13 19:12:05 +00:00
#include "content/public/browser/browser_context.h"
class PrefRegistrySimple;
class PrefService;
2013-03-13 19:12:05 +00:00
namespace brightray {
2015-05-22 06:50:41 +00:00
class PermissionManager;
class BrowserContext : public base::RefCounted<BrowserContext>,
public content::BrowserContext,
public brightray::URLRequestContextGetter::Delegate {
public:
2013-03-13 19:12:05 +00:00
BrowserContext();
~BrowserContext();
void Initialize(const std::string& partition, bool in_memory = false);
// content::BrowserContext:
scoped_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate(
const base::FilePath& partition_path) override;
bool IsOffTheRecord() const override;
net::URLRequestContextGetter* GetRequestContext() override;
net::URLRequestContextGetter* GetRequestContextForRenderProcess(
int renderer_child_id) override;
net::URLRequestContextGetter* GetMediaRequestContext() override;
net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess(
int renderer_child_id) override;
net::URLRequestContextGetter* GetMediaRequestContextForStoragePartition(
const base::FilePath& partition_path, bool in_memory) override;
content::ResourceContext* GetResourceContext() override;
content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
content::BrowserPluginGuestManager* GetGuestManager() override;
storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
content::PushMessagingService* GetPushMessagingService() override;
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
content::PermissionManager* GetPermissionManager() override;
net::URLRequestContextGetter* CreateRequestContext(
2015-08-11 10:29:55 +00:00
NetLog* net_log,
content::ProtocolHandlerMap* protocol_handlers,
2014-08-31 10:43:01 +00:00
content::URLRequestInterceptorScopedVector protocol_interceptors);
2013-03-13 19:12:05 +00:00
net::URLRequestContextGetter* url_request_context_getter() const {
return url_request_getter_.get();
}
PrefService* prefs() { return prefs_.get(); }
protected:
// Subclasses should override this to register custom preferences.
virtual void RegisterPrefs(PrefRegistrySimple* pref_registry) {}
// URLRequestContextGetter::Delegate:
2015-06-05 04:07:27 +00:00
net::NetworkDelegate* CreateNetworkDelegate() override;
2015-06-05 04:07:27 +00:00
base::FilePath GetPath() const override;
private:
friend class base::RefCounted<BrowserContext>;
2013-03-13 19:12:05 +00:00
class ResourceContext;
void RegisterInternalPrefs(PrefRegistrySimple* pref_registry);
base::FilePath path_;
bool in_memory_;
2013-03-13 19:12:05 +00:00
scoped_ptr<ResourceContext> resource_context_;
scoped_refptr<URLRequestContextGetter> url_request_getter_;
scoped_ptr<PrefService> prefs_;
2015-05-22 06:50:41 +00:00
scoped_ptr<PermissionManager> permission_manager_;
2013-03-13 19:12:05 +00:00
DISALLOW_COPY_AND_ASSIGN(BrowserContext);
};
} // namespace brightray
2013-03-13 19:12:05 +00:00
#endif