electron/brightray/browser/browser_context.h

80 lines
2.7 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
#include "browser/url_request_context_getter.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 {
class DownloadManagerDelegate;
2013-03-13 19:12:05 +00:00
class BrowserContext : public content::BrowserContext,
public brightray::URLRequestContextGetter::Delegate {
public:
2013-03-13 19:12:05 +00:00
BrowserContext();
~BrowserContext();
virtual void Initialize();
net::URLRequestContextGetter* CreateRequestContext(
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:
virtual net::NetworkDelegate* CreateNetworkDelegate() OVERRIDE;
virtual base::FilePath GetPath() const OVERRIDE;
private:
2013-03-13 19:12:05 +00:00
class ResourceContext;
void RegisterInternalPrefs(PrefRegistrySimple* pref_registry);
2013-03-13 19:12:05 +00:00
virtual bool IsOffTheRecord() const OVERRIDE;
virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE;
virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess(
int renderer_child_id);
2013-03-13 19:12:05 +00:00
virtual net::URLRequestContextGetter* GetMediaRequestContext() OVERRIDE;
virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess(
int renderer_child_id) OVERRIDE;
virtual net::URLRequestContextGetter*
GetMediaRequestContextForStoragePartition(
const base::FilePath& partition_path, bool in_memory);
2013-03-13 19:12:05 +00:00
virtual content::ResourceContext* GetResourceContext() OVERRIDE;
2014-08-31 10:43:01 +00:00
virtual content::DownloadManagerDelegate* GetDownloadManagerDelegate() OVERRIDE;
virtual content::BrowserPluginGuestManager* GetGuestManager() OVERRIDE;
virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE;
virtual content::PushMessagingService* GetPushMessagingService() OVERRIDE;
2014-10-11 08:38:27 +00:00
virtual content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
2013-03-13 19:12:05 +00:00
base::FilePath path_;
2013-03-13 19:12:05 +00:00
scoped_ptr<ResourceContext> resource_context_;
scoped_refptr<URLRequestContextGetter> url_request_getter_;
scoped_ptr<PrefService> prefs_;
scoped_ptr<DownloadManagerDelegate> download_manager_delegate_;
2013-03-13 19:12:05 +00:00
DISALLOW_COPY_AND_ASSIGN(BrowserContext);
};
} // namespace brightray
2013-03-13 19:12:05 +00:00
#endif