Add conversions for EmbedObject, Figcaption and Figure
[chromium-blink-merge.git] / android_webview / browser / aw_browser_context.h
blobb099e211c07ab7e5d6fe47f0892f2f5e5fc2029e
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef ANDROID_WEBVIEW_BROWSER_AW_BROWSER_CONTEXT_H_
6 #define ANDROID_WEBVIEW_BROWSER_AW_BROWSER_CONTEXT_H_
8 #include <vector>
10 #include "android_webview/browser/aw_download_manager_delegate.h"
11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h"
13 #include "base/files/file_path.h"
14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "components/visitedlink/browser/visitedlink_delegate.h"
17 #include "content/public/browser/browser_context.h"
18 #include "content/public/browser/content_browser_client.h"
19 #include "net/url_request/url_request_job_factory.h"
21 class GURL;
22 class PrefService;
24 namespace content {
25 class ResourceContext;
26 class SSLHostStateDelegate;
27 class WebContents;
30 namespace data_reduction_proxy {
31 class DataReductionProxyConfigurator;
32 class DataReductionProxySettings;
35 namespace net {
36 class CookieStore;
39 namespace visitedlink {
40 class VisitedLinkMaster;
43 namespace android_webview {
45 class AwFormDatabaseService;
46 class AwQuotaManagerBridge;
47 class AwURLRequestContextGetter;
48 class JniDependencyFactory;
50 class AwBrowserContext : public content::BrowserContext,
51 public visitedlink::VisitedLinkDelegate {
52 public:
54 AwBrowserContext(const base::FilePath path,
55 JniDependencyFactory* native_factory);
56 virtual ~AwBrowserContext();
58 // Currently only one instance per process is supported.
59 static AwBrowserContext* GetDefault();
61 // Convenience method to returns the AwBrowserContext corresponding to the
62 // given WebContents.
63 static AwBrowserContext* FromWebContents(
64 content::WebContents* web_contents);
66 static void SetDataReductionProxyEnabled(bool enabled);
68 // Maps to BrowserMainParts::PreMainMessageLoopRun.
69 void PreMainMessageLoopRun();
71 // These methods map to Add methods in visitedlink::VisitedLinkMaster.
72 void AddVisitedURLs(const std::vector<GURL>& urls);
74 net::URLRequestContextGetter* CreateRequestContext(
75 content::ProtocolHandlerMap* protocol_handlers,
76 content::URLRequestInterceptorScopedVector request_interceptors);
77 net::URLRequestContextGetter* CreateRequestContextForStoragePartition(
78 const base::FilePath& partition_path,
79 bool in_memory,
80 content::ProtocolHandlerMap* protocol_handlers,
81 content::URLRequestInterceptorScopedVector request_interceptors);
83 AwQuotaManagerBridge* GetQuotaManagerBridge();
85 AwFormDatabaseService* GetFormDatabaseService();
87 data_reduction_proxy::DataReductionProxySettings*
88 GetDataReductionProxySettings();
90 AwURLRequestContextGetter* GetAwURLRequestContext();
92 void CreateUserPrefServiceIfNecessary();
94 // content::BrowserContext implementation.
95 virtual base::FilePath GetPath() const OVERRIDE;
96 virtual bool IsOffTheRecord() const OVERRIDE;
97 virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE;
98 virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess(
99 int renderer_child_id) OVERRIDE;
100 virtual net::URLRequestContextGetter* GetMediaRequestContext() OVERRIDE;
101 virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess(
102 int renderer_child_id) OVERRIDE;
103 virtual net::URLRequestContextGetter*
104 GetMediaRequestContextForStoragePartition(
105 const base::FilePath& partition_path, bool in_memory) OVERRIDE;
106 virtual content::ResourceContext* GetResourceContext() OVERRIDE;
107 virtual content::DownloadManagerDelegate*
108 GetDownloadManagerDelegate() OVERRIDE;
109 virtual content::BrowserPluginGuestManager* GetGuestManager() OVERRIDE;
110 virtual storage::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE;
111 virtual content::PushMessagingService* GetPushMessagingService() OVERRIDE;
112 virtual content::SSLHostStateDelegate* GetSSLHostStateDelegate() OVERRIDE;
114 // visitedlink::VisitedLinkDelegate implementation.
115 virtual void RebuildTable(
116 const scoped_refptr<URLEnumerator>& enumerator) OVERRIDE;
118 private:
119 static bool data_reduction_proxy_enabled_;
121 // The file path where data for this context is persisted.
122 base::FilePath context_storage_path_;
124 JniDependencyFactory* native_factory_;
125 scoped_refptr<net::CookieStore> cookie_store_;
126 scoped_refptr<AwURLRequestContextGetter> url_request_context_getter_;
127 scoped_refptr<AwQuotaManagerBridge> quota_manager_bridge_;
128 scoped_ptr<AwFormDatabaseService> form_database_service_;
130 AwDownloadManagerDelegate download_manager_delegate_;
132 scoped_ptr<visitedlink::VisitedLinkMaster> visitedlink_master_;
133 scoped_ptr<content::ResourceContext> resource_context_;
135 scoped_ptr<PrefService> user_pref_service_;
137 scoped_ptr<data_reduction_proxy::DataReductionProxyConfigurator>
138 data_reduction_proxy_configurator_;
139 scoped_ptr<data_reduction_proxy::DataReductionProxySettings>
140 data_reduction_proxy_settings_;
142 DISALLOW_COPY_AND_ASSIGN(AwBrowserContext);
145 } // namespace android_webview
147 #endif // ANDROID_WEBVIEW_BROWSER_AW_BROWSER_CONTEXT_H_