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.
|
|
|
|
|
2013-03-13 19:42:16 +00:00
|
|
|
#ifndef BRIGHTRAY_BROWSER_BROWSER_CONTEXT_H_
|
|
|
|
#define BRIGHTRAY_BROWSER_BROWSER_CONTEXT_H_
|
2013-03-13 19:12:05 +00:00
|
|
|
|
2014-08-13 08:09:32 +00:00
|
|
|
#include "browser/url_request_context_getter.h"
|
|
|
|
|
2013-03-13 19:12:05 +00:00
|
|
|
#include "content/public/browser/browser_context.h"
|
|
|
|
|
2013-03-29 21:28:49 +00:00
|
|
|
class PrefRegistrySimple;
|
|
|
|
class PrefService;
|
|
|
|
|
2013-03-13 19:12:05 +00:00
|
|
|
namespace brightray {
|
|
|
|
|
2013-07-24 11:56:55 +00:00
|
|
|
class DownloadManagerDelegate;
|
2013-03-13 19:12:05 +00:00
|
|
|
|
2014-08-20 06:39:09 +00:00
|
|
|
class BrowserContext : public content::BrowserContext,
|
|
|
|
public brightray::URLRequestContextGetter::Delegate {
|
2013-11-17 23:15:10 +00:00
|
|
|
public:
|
2013-03-13 19:12:05 +00:00
|
|
|
BrowserContext();
|
|
|
|
~BrowserContext();
|
|
|
|
|
2013-11-27 21:55:06 +00:00
|
|
|
virtual void Initialize();
|
2013-08-15 20:07:14 +00:00
|
|
|
|
2013-11-17 23:15:10 +00:00
|
|
|
net::URLRequestContextGetter* CreateRequestContext(
|
2014-06-26 20:27:22 +00:00
|
|
|
content::ProtocolHandlerMap* protocol_handlers,
|
|
|
|
content::ProtocolHandlerScopedVector protocol_interceptors);
|
2013-03-13 19:12:05 +00:00
|
|
|
|
2014-08-13 08:09:32 +00:00
|
|
|
net::URLRequestContextGetter* url_request_context_getter() const {
|
|
|
|
return url_request_getter_.get();
|
|
|
|
}
|
|
|
|
|
2013-03-29 21:28:49 +00:00
|
|
|
PrefService* prefs() { return prefs_.get(); }
|
|
|
|
|
2013-11-17 23:15:10 +00:00
|
|
|
protected:
|
2013-03-29 21:28:49 +00:00
|
|
|
// Subclasses should override this to register custom preferences.
|
2013-11-17 23:15:10 +00:00
|
|
|
virtual void RegisterPrefs(PrefRegistrySimple* pref_registry) {}
|
2013-03-29 21:28:49 +00:00
|
|
|
|
2014-08-20 06:39:09 +00:00
|
|
|
// URLRequestContextGetter::Delegate:
|
|
|
|
virtual net::NetworkDelegate* CreateNetworkDelegate() OVERRIDE;
|
|
|
|
virtual net::URLRequestJobFactory* CreateURLRequestJobFactory(
|
2014-08-13 09:31:33 +00:00
|
|
|
content::ProtocolHandlerMap* protocol_handlers,
|
2014-08-20 06:39:09 +00:00
|
|
|
content::ProtocolHandlerScopedVector* protocol_interceptors) OVERRIDE;
|
2014-08-13 07:48:16 +00:00
|
|
|
|
2013-10-07 19:21:43 +00:00
|
|
|
virtual base::FilePath GetPath() const OVERRIDE;
|
2013-06-06 22:50:37 +00:00
|
|
|
|
2013-11-17 23:15:10 +00:00
|
|
|
private:
|
2013-03-13 19:12:05 +00:00
|
|
|
class ResourceContext;
|
|
|
|
|
2013-11-17 23:15:10 +00:00
|
|
|
void RegisterInternalPrefs(PrefRegistrySimple* pref_registry);
|
2013-04-08 17:53:53 +00:00
|
|
|
|
2013-03-13 19:12:05 +00:00
|
|
|
virtual bool IsOffTheRecord() const OVERRIDE;
|
|
|
|
virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE;
|
2013-11-17 23:15:10 +00:00
|
|
|
virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess(
|
|
|
|
int renderer_child_id);
|
2013-03-13 19:12:05 +00:00
|
|
|
virtual net::URLRequestContextGetter* GetMediaRequestContext() OVERRIDE;
|
2013-11-17 23:15:10 +00:00
|
|
|
virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess(
|
|
|
|
int renderer_child_id) OVERRIDE;
|
|
|
|
virtual net::URLRequestContextGetter*
|
|
|
|
GetMediaRequestContextForStoragePartition(
|
|
|
|
const base::FilePath& partition_path, bool in_memory);
|
2014-06-26 20:27:58 +00:00
|
|
|
virtual void RequestMidiSysExPermission(
|
2013-11-17 23:15:10 +00:00
|
|
|
int render_process_id,
|
|
|
|
int render_view_id,
|
2014-06-26 20:27:58 +00:00
|
|
|
int bridge_id,
|
2013-11-17 23:15:10 +00:00
|
|
|
const GURL& requesting_frame,
|
2014-06-26 20:27:58 +00:00
|
|
|
bool user_gesture,
|
|
|
|
const MidiSysExPermissionCallback& callback) OVERRIDE;
|
|
|
|
virtual void CancelMidiSysExPermissionRequest(
|
|
|
|
int render_process_id,
|
|
|
|
int render_view_id,
|
|
|
|
int bridge_id,
|
|
|
|
const GURL& requesting_frame) OVERRIDE;
|
|
|
|
virtual void RequestProtectedMediaIdentifierPermission(
|
|
|
|
int render_process_id,
|
|
|
|
int render_view_id,
|
|
|
|
int bridge_id,
|
|
|
|
int group_id,
|
|
|
|
const GURL& requesting_frame,
|
|
|
|
const ProtectedMediaIdentifierPermissionCallback& callback) OVERRIDE;
|
|
|
|
virtual void CancelProtectedMediaIdentifierPermissionRequests(int group_id) OVERRIDE;
|
2013-03-13 19:12:05 +00:00
|
|
|
virtual content::ResourceContext* GetResourceContext() OVERRIDE;
|
2013-11-17 23:15:10 +00:00
|
|
|
virtual content::DownloadManagerDelegate*
|
|
|
|
GetDownloadManagerDelegate() OVERRIDE;
|
|
|
|
virtual content::GeolocationPermissionContext*
|
|
|
|
GetGeolocationPermissionContext() OVERRIDE;
|
2014-07-27 10:44:39 +00:00
|
|
|
virtual content::BrowserPluginGuestManagerDelegate*
|
|
|
|
GetGuestManagerDelegate() OVERRIDE;
|
2013-11-17 23:15:10 +00:00
|
|
|
virtual quota::SpecialStoragePolicy*
|
|
|
|
GetSpecialStoragePolicy() OVERRIDE;
|
2013-03-13 19:12:05 +00:00
|
|
|
|
2013-06-04 18:17:16 +00:00
|
|
|
base::FilePath path_;
|
2013-03-13 19:12:05 +00:00
|
|
|
scoped_ptr<ResourceContext> resource_context_;
|
2013-03-27 12:53:53 +00:00
|
|
|
scoped_refptr<URLRequestContextGetter> url_request_getter_;
|
2013-03-29 21:28:49 +00:00
|
|
|
scoped_ptr<PrefService> prefs_;
|
2013-07-24 11:56:55 +00:00
|
|
|
scoped_ptr<DownloadManagerDelegate> download_manager_delegate_;
|
2013-03-13 19:12:05 +00:00
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(BrowserContext);
|
|
|
|
};
|
|
|
|
|
2013-11-17 23:15:10 +00:00
|
|
|
} // namespace brightray
|
2013-03-13 19:12:05 +00:00
|
|
|
|
2013-03-13 19:42:16 +00:00
|
|
|
#endif
|