OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ANDROID_WEBVIEW_LIB_AW_CONTENT_BROWSER_CLIENT_H_ | 5 #ifndef ANDROID_WEBVIEW_LIB_AW_CONTENT_BROWSER_CLIENT_H_ |
6 #define ANDROID_WEBVIEW_LIB_AW_CONTENT_BROWSER_CLIENT_H_ | 6 #define ANDROID_WEBVIEW_LIB_AW_CONTENT_BROWSER_CLIENT_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "content/public/browser/content_browser_client.h" | 11 #include "content/public/browser/content_browser_client.h" |
12 #include "net/url_request/url_request_job_factory.h" | 12 #include "net/url_request/url_request_job_factory.h" |
13 | 13 |
14 namespace android_webview { | 14 namespace android_webview { |
15 | 15 |
16 class AwBrowserContext; | 16 class AwBrowserContext; |
17 class JniDependencyFactory; | 17 class JniDependencyFactory; |
18 | 18 |
19 class AwContentBrowserClient : public content::ContentBrowserClient { | 19 class AwContentBrowserClient : public content::ContentBrowserClient { |
20 public: | 20 public: |
21 static AwContentBrowserClient* FromContentBrowserClient( | 21 // This is what AwContentBrowserClient::GetAcceptLangs uses. |
22 content::ContentBrowserClient* client); | 22 static std::string GetAcceptLangsImpl(); |
| 23 |
| 24 // Returns the one AwBrowserContext for this process. |
| 25 static AwBrowserContext* GetAwBrowserContext(); |
23 | 26 |
24 AwContentBrowserClient(JniDependencyFactory* native_factory); | 27 AwContentBrowserClient(JniDependencyFactory* native_factory); |
25 virtual ~AwContentBrowserClient(); | 28 virtual ~AwContentBrowserClient(); |
26 | 29 |
27 AwBrowserContext* GetAwBrowserContext(); | |
28 | |
29 // Overriden methods from ContentBrowserClient. | 30 // Overriden methods from ContentBrowserClient. |
30 virtual void AddCertificate(net::URLRequest* request, | 31 virtual void AddCertificate(net::URLRequest* request, |
31 net::CertificateMimeType cert_type, | 32 net::CertificateMimeType cert_type, |
32 const void* cert_data, | 33 const void* cert_data, |
33 size_t cert_size, | 34 size_t cert_size, |
34 int render_process_id, | 35 int render_process_id, |
35 int render_view_id) OVERRIDE; | 36 int render_view_id) OVERRIDE; |
36 virtual content::BrowserMainParts* CreateBrowserMainParts( | 37 virtual content::BrowserMainParts* CreateBrowserMainParts( |
37 const content::MainFunctionParams& parameters) OVERRIDE; | 38 const content::MainFunctionParams& parameters) OVERRIDE; |
38 virtual content::WebContentsViewDelegate* GetWebContentsViewDelegate( | 39 virtual content::WebContentsViewDelegate* GetWebContentsViewDelegate( |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 virtual std::string GetWorkerProcessTitle( | 124 virtual std::string GetWorkerProcessTitle( |
124 const GURL& url, | 125 const GURL& url, |
125 content::ResourceContext* context) OVERRIDE; | 126 content::ResourceContext* context) OVERRIDE; |
126 virtual void ResourceDispatcherHostCreated() OVERRIDE; | 127 virtual void ResourceDispatcherHostCreated() OVERRIDE; |
127 virtual net::NetLog* GetNetLog() OVERRIDE; | 128 virtual net::NetLog* GetNetLog() OVERRIDE; |
128 virtual content::AccessTokenStore* CreateAccessTokenStore() OVERRIDE; | 129 virtual content::AccessTokenStore* CreateAccessTokenStore() OVERRIDE; |
129 virtual bool IsFastShutdownPossible() OVERRIDE; | 130 virtual bool IsFastShutdownPossible() OVERRIDE; |
130 virtual void UpdateInspectorSetting(content::RenderViewHost* rvh, | 131 virtual void UpdateInspectorSetting(content::RenderViewHost* rvh, |
131 const std::string& key, | 132 const std::string& key, |
132 const std::string& value) OVERRIDE; | 133 const std::string& value) OVERRIDE; |
133 virtual void ClearInspectorSettings(content::RenderViewHost* rvh) OVERRIDE; | |
134 virtual void ClearCache(content::RenderViewHost* rvh) OVERRIDE; | 134 virtual void ClearCache(content::RenderViewHost* rvh) OVERRIDE; |
135 virtual void ClearCookies(content::RenderViewHost* rvh) OVERRIDE; | 135 virtual void ClearCookies(content::RenderViewHost* rvh) OVERRIDE; |
136 virtual base::FilePath GetDefaultDownloadDirectory() OVERRIDE; | 136 virtual base::FilePath GetDefaultDownloadDirectory() OVERRIDE; |
137 virtual std::string GetDefaultDownloadName() OVERRIDE; | 137 virtual std::string GetDefaultDownloadName() OVERRIDE; |
138 virtual void DidCreatePpapiPlugin( | 138 virtual void DidCreatePpapiPlugin( |
139 content::BrowserPpapiHost* browser_host) OVERRIDE; | 139 content::BrowserPpapiHost* browser_host) OVERRIDE; |
140 virtual bool AllowPepperSocketAPI( | 140 virtual bool AllowPepperSocketAPI( |
141 content::BrowserContext* browser_context, | 141 content::BrowserContext* browser_context, |
142 const GURL& url, | 142 const GURL& url, |
143 const content::SocketPermissionRequest& params) OVERRIDE; | 143 const content::SocketPermissionRequest& params) OVERRIDE; |
144 | 144 |
145 private: | 145 private: |
146 // Android WebView currently has a single global (non-off-the-record) browser | 146 // Android WebView currently has a single global (non-off-the-record) browser |
147 // context. | 147 // context. |
148 scoped_ptr<AwBrowserContext> browser_context_; | 148 scoped_ptr<AwBrowserContext> browser_context_; |
149 | 149 |
150 JniDependencyFactory* native_factory_; | 150 JniDependencyFactory* native_factory_; |
151 | 151 |
152 DISALLOW_COPY_AND_ASSIGN(AwContentBrowserClient); | 152 DISALLOW_COPY_AND_ASSIGN(AwContentBrowserClient); |
153 }; | 153 }; |
154 | 154 |
155 } // namespace android_webview | 155 } // namespace android_webview |
156 | 156 |
157 #endif // ANDROID_WEBVIEW_LIB_AW_CONTENT_BROWSER_CLIENT_H_ | 157 #endif // ANDROID_WEBVIEW_LIB_AW_CONTENT_BROWSER_CLIENT_H_ |
OLD | NEW |