Call ComputeWebKitPrefs on the correct RVH, and remove dead code.
[chromium-blink-merge.git] / android_webview / browser / aw_content_browser_client.h
blobe5d874974761643746cc9ad1c50805938f8f42d1
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_LIB_AW_CONTENT_BROWSER_CLIENT_H_
6 #define ANDROID_WEBVIEW_LIB_AW_CONTENT_BROWSER_CLIENT_H_
8 #include "android_webview/browser/aw_web_preferences_populater.h"
9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "content/public/browser/content_browser_client.h"
14 namespace android_webview {
16 class AwBrowserContext;
17 class JniDependencyFactory;
19 class AwContentBrowserClient : public content::ContentBrowserClient {
20 public:
21 // This is what AwContentBrowserClient::GetAcceptLangs uses.
22 static std::string GetAcceptLangsImpl();
24 // Deprecated: use AwBrowserContext::GetDefault() instead.
25 static AwBrowserContext* GetAwBrowserContext();
27 AwContentBrowserClient(JniDependencyFactory* native_factory);
28 ~AwContentBrowserClient() override;
30 // Overriden methods from ContentBrowserClient.
31 void AddCertificate(net::CertificateMimeType cert_type,
32 const void* cert_data,
33 size_t cert_size,
34 int render_process_id,
35 int render_frame_id) override;
36 content::BrowserMainParts* CreateBrowserMainParts(
37 const content::MainFunctionParams& parameters) override;
38 content::WebContentsViewDelegate* GetWebContentsViewDelegate(
39 content::WebContents* web_contents) override;
40 void RenderProcessWillLaunch(content::RenderProcessHost* host) override;
41 net::URLRequestContextGetter* CreateRequestContext(
42 content::BrowserContext* browser_context,
43 content::ProtocolHandlerMap* protocol_handlers,
44 content::URLRequestInterceptorScopedVector request_interceptors) override;
45 net::URLRequestContextGetter* CreateRequestContextForStoragePartition(
46 content::BrowserContext* browser_context,
47 const base::FilePath& partition_path,
48 bool in_memory,
49 content::ProtocolHandlerMap* protocol_handlers,
50 content::URLRequestInterceptorScopedVector request_interceptors) override;
51 std::string GetCanonicalEncodingNameByAliasName(
52 const std::string& alias_name) override;
53 void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
54 int child_process_id) override;
55 std::string GetApplicationLocale() override;
56 std::string GetAcceptLangs(content::BrowserContext* context) override;
57 const gfx::ImageSkia* GetDefaultFavicon() override;
58 bool AllowAppCache(const GURL& manifest_url,
59 const GURL& first_party,
60 content::ResourceContext* context) override;
61 bool AllowGetCookie(const GURL& url,
62 const GURL& first_party,
63 const net::CookieList& cookie_list,
64 content::ResourceContext* context,
65 int render_process_id,
66 int render_frame_id) override;
67 bool AllowSetCookie(const GURL& url,
68 const GURL& first_party,
69 const std::string& cookie_line,
70 content::ResourceContext* context,
71 int render_process_id,
72 int render_frame_id,
73 net::CookieOptions* options) override;
74 bool AllowWorkerDatabase(
75 const GURL& url,
76 const base::string16& name,
77 const base::string16& display_name,
78 unsigned long estimated_size,
79 content::ResourceContext* context,
80 const std::vector<std::pair<int, int>>& render_frames) override;
81 void AllowWorkerFileSystem(
82 const GURL& url,
83 content::ResourceContext* context,
84 const std::vector<std::pair<int, int>>& render_frames,
85 base::Callback<void(bool)> callback) override;
86 bool AllowWorkerIndexedDB(
87 const GURL& url,
88 const base::string16& name,
89 content::ResourceContext* context,
90 const std::vector<std::pair<int, int>>& render_frames) override;
91 content::QuotaPermissionContext* CreateQuotaPermissionContext() override;
92 void AllowCertificateError(
93 int render_process_id,
94 int render_frame_id,
95 int cert_error,
96 const net::SSLInfo& ssl_info,
97 const GURL& request_url,
98 content::ResourceType resource_type,
99 bool overridable,
100 bool strict_enforcement,
101 bool expired_previous_decision,
102 const base::Callback<void(bool)>& callback,
103 content::CertificateRequestResultType* result) override;
104 void SelectClientCertificate(
105 int render_process_id,
106 int render_frame_id,
107 net::SSLCertRequestInfo* cert_request_info,
108 const base::Callback<void(net::X509Certificate*)>& callback) override;
109 void RequestPermission(
110 content::PermissionType permission,
111 content::WebContents* web_contents,
112 int bridge_id,
113 const GURL& requesting_frame,
114 bool user_gesture,
115 const base::Callback<void(bool)>& result_callback) override;
116 void CancelPermissionRequest(content::PermissionType permission,
117 content::WebContents* web_contents,
118 int bridge_id,
119 const GURL& origin) override;
120 bool CanCreateWindow(const GURL& opener_url,
121 const GURL& opener_top_level_frame_url,
122 const GURL& source_origin,
123 WindowContainerType container_type,
124 const GURL& target_url,
125 const content::Referrer& referrer,
126 WindowOpenDisposition disposition,
127 const blink::WebWindowFeatures& features,
128 bool user_gesture,
129 bool opener_suppressed,
130 content::ResourceContext* context,
131 int render_process_id,
132 int opener_id,
133 bool* no_javascript_access) override;
134 void ResourceDispatcherHostCreated() override;
135 net::NetLog* GetNetLog() override;
136 content::AccessTokenStore* CreateAccessTokenStore() override;
137 bool IsFastShutdownPossible() override;
138 void ClearCache(content::RenderViewHost* rvh) override;
139 void ClearCookies(content::RenderViewHost* rvh) override;
140 base::FilePath GetDefaultDownloadDirectory() override;
141 std::string GetDefaultDownloadName() override;
142 void DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) override;
143 bool AllowPepperSocketAPI(
144 content::BrowserContext* browser_context,
145 const GURL& url,
146 bool private_api,
147 const content::SocketPermissionRequest* params) override;
148 void OverrideWebkitPrefs(content::RenderViewHost* rvh,
149 content::WebPreferences* web_prefs) override;
150 #if defined(VIDEO_HOLE)
151 content::ExternalVideoSurfaceContainer*
152 OverrideCreateExternalVideoSurfaceContainer(
153 content::WebContents* web_contents) override;
154 #endif
155 content::DevToolsManagerDelegate* GetDevToolsManagerDelegate() override;
157 private:
158 // Android WebView currently has a single global (non-off-the-record) browser
159 // context.
160 scoped_ptr<AwBrowserContext> browser_context_;
161 scoped_ptr<AwWebPreferencesPopulater> preferences_populater_;
163 JniDependencyFactory* native_factory_;
165 DISALLOW_COPY_AND_ASSIGN(AwContentBrowserClient);
168 } // namespace android_webview
170 #endif // ANDROID_WEBVIEW_LIB_AW_CONTENT_BROWSER_CLIENT_H_