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
|
|
|
|
|
|
|
#include "content/public/browser/browser_context.h"
|
|
|
|
#include "content/public/browser/content_browser_client.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-07-17 14:21:33 +00:00
|
|
|
class NetworkDelegate;
|
2013-03-13 19:12:05 +00:00
|
|
|
class URLRequestContextGetter;
|
|
|
|
|
|
|
|
class BrowserContext : public content::BrowserContext {
|
|
|
|
public:
|
|
|
|
BrowserContext();
|
|
|
|
~BrowserContext();
|
|
|
|
|
2013-08-15 20:07:14 +00:00
|
|
|
void Initialize();
|
|
|
|
|
2013-03-13 19:12:05 +00:00
|
|
|
net::URLRequestContextGetter* CreateRequestContext(content::ProtocolHandlerMap*);
|
|
|
|
|
2013-03-29 21:28:49 +00:00
|
|
|
PrefService* prefs() { return prefs_.get(); }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// Subclasses should override this to register custom preferences.
|
|
|
|
virtual void RegisterPrefs(PrefRegistrySimple*) {}
|
|
|
|
|
2013-07-17 14:21:33 +00:00
|
|
|
// Subclasses should override this to provide a custom NetworkDelegate implementation.
|
|
|
|
virtual scoped_ptr<NetworkDelegate> CreateNetworkDelegate();
|
|
|
|
|
2013-06-06 22:50:37 +00:00
|
|
|
virtual base::FilePath GetPath() OVERRIDE;
|
|
|
|
|
2013-03-13 19:12:05 +00:00
|
|
|
private:
|
|
|
|
class ResourceContext;
|
|
|
|
|
2013-04-08 17:53:53 +00:00
|
|
|
void RegisterInternalPrefs(PrefRegistrySimple*);
|
|
|
|
|
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);
|
|
|
|
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);
|
|
|
|
virtual content::ResourceContext* GetResourceContext() OVERRIDE;
|
|
|
|
virtual content::DownloadManagerDelegate* GetDownloadManagerDelegate() OVERRIDE;
|
|
|
|
virtual content::GeolocationPermissionContext* GetGeolocationPermissionContext() OVERRIDE;
|
|
|
|
virtual content::SpeechRecognitionPreferences* GetSpeechRecognitionPreferences() OVERRIDE;
|
|
|
|
virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE;
|
|
|
|
|
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-03-13 19:42:16 +00:00
|
|
|
#endif
|