2013-03-13 15:12:05 -04: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.
|
|
|
|
|
2013-03-13 15:42:16 -04:00
|
|
|
#ifndef BRIGHTRAY_BROWSER_BROWSER_CONTEXT_H_
|
|
|
|
#define BRIGHTRAY_BROWSER_BROWSER_CONTEXT_H_
|
2013-03-13 15:12:05 -04:00
|
|
|
|
2014-08-13 16:09:32 +08:00
|
|
|
#include "browser/url_request_context_getter.h"
|
|
|
|
|
2013-03-13 15:12:05 -04:00
|
|
|
#include "content/public/browser/browser_context.h"
|
|
|
|
|
2013-03-29 17:28:49 -04:00
|
|
|
class PrefRegistrySimple;
|
|
|
|
class PrefService;
|
|
|
|
|
2013-03-13 15:12:05 -04:00
|
|
|
namespace brightray {
|
|
|
|
|
2014-08-20 14:39:09 +08:00
|
|
|
class BrowserContext : public content::BrowserContext,
|
|
|
|
public brightray::URLRequestContextGetter::Delegate {
|
2013-11-17 18:15:10 -05:00
|
|
|
public:
|
2013-03-13 15:12:05 -04:00
|
|
|
BrowserContext();
|
|
|
|
~BrowserContext();
|
|
|
|
|
2013-11-27 15:55:06 -06:00
|
|
|
virtual void Initialize();
|
2013-08-15 16:07:14 -04:00
|
|
|
|
2013-11-17 18:15:10 -05:00
|
|
|
net::URLRequestContextGetter* CreateRequestContext(
|
2014-06-26 16:27:22 -04:00
|
|
|
content::ProtocolHandlerMap* protocol_handlers,
|
2014-08-31 18:43:01 +08:00
|
|
|
content::URLRequestInterceptorScopedVector protocol_interceptors);
|
2013-03-13 15:12:05 -04:00
|
|
|
|
2014-08-13 16:09:32 +08:00
|
|
|
net::URLRequestContextGetter* url_request_context_getter() const {
|
|
|
|
return url_request_getter_.get();
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:28:49 -04:00
|
|
|
PrefService* prefs() { return prefs_.get(); }
|
|
|
|
|
2013-11-17 18:15:10 -05:00
|
|
|
protected:
|
2013-03-29 17:28:49 -04:00
|
|
|
// Subclasses should override this to register custom preferences.
|
2013-11-17 18:15:10 -05:00
|
|
|
virtual void RegisterPrefs(PrefRegistrySimple* pref_registry) {}
|
2013-03-29 17:28:49 -04:00
|
|
|
|
2014-08-20 14:39:09 +08:00
|
|
|
// URLRequestContextGetter::Delegate:
|
2014-10-23 11:10:39 +08:00
|
|
|
virtual net::NetworkDelegate* CreateNetworkDelegate() override;
|
2014-08-13 15:48:16 +08:00
|
|
|
|
2014-10-23 11:10:39 +08:00
|
|
|
virtual base::FilePath GetPath() const override;
|
2013-06-06 18:50:37 -04:00
|
|
|
|
2013-11-17 18:15:10 -05:00
|
|
|
private:
|
2013-03-13 15:12:05 -04:00
|
|
|
class ResourceContext;
|
|
|
|
|
2013-11-17 18:15:10 -05:00
|
|
|
void RegisterInternalPrefs(PrefRegistrySimple* pref_registry);
|
2013-04-08 13:53:53 -04:00
|
|
|
|
2015-03-08 19:56:45 -07:00
|
|
|
scoped_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate(
|
|
|
|
const base::FilePath& partition_path) override;
|
2014-12-05 14:31:02 -08:00
|
|
|
bool IsOffTheRecord() const override;
|
|
|
|
net::URLRequestContextGetter* GetRequestContext() override;
|
|
|
|
net::URLRequestContextGetter* GetRequestContextForRenderProcess(
|
2013-11-17 18:15:10 -05:00
|
|
|
int renderer_child_id);
|
2014-12-05 14:31:02 -08:00
|
|
|
net::URLRequestContextGetter* GetMediaRequestContext() override;
|
|
|
|
net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess(
|
2014-10-23 11:10:39 +08:00
|
|
|
int renderer_child_id) override;
|
2014-12-05 14:31:02 -08:00
|
|
|
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;
|
2013-03-13 15:12:05 -04:00
|
|
|
|
2013-06-04 14:17:16 -04:00
|
|
|
base::FilePath path_;
|
2013-03-13 15:12:05 -04:00
|
|
|
scoped_ptr<ResourceContext> resource_context_;
|
2013-03-27 08:53:53 -04:00
|
|
|
scoped_refptr<URLRequestContextGetter> url_request_getter_;
|
2013-03-29 17:28:49 -04:00
|
|
|
scoped_ptr<PrefService> prefs_;
|
2013-03-13 15:12:05 -04:00
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(BrowserContext);
|
|
|
|
};
|
|
|
|
|
2013-11-17 18:15:10 -05:00
|
|
|
} // namespace brightray
|
2013-03-13 15:12:05 -04:00
|
|
|
|
2013-03-13 15:42:16 -04:00
|
|
|
#endif
|