forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
aw_content_browser_client.h
196 lines (183 loc) · 8.74 KB
/
aw_content_browser_client.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
// 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 file.
#ifndef ANDROID_WEBVIEW_LIB_AW_CONTENT_BROWSER_CLIENT_H_
#define ANDROID_WEBVIEW_LIB_AW_CONTENT_BROWSER_CLIENT_H_
#include "android_webview/browser/aw_web_preferences_populater.h"
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "content/public/browser/content_browser_client.h"
namespace android_webview {
class AwBrowserContext;
class JniDependencyFactory;
class AwContentBrowserClient : public content::ContentBrowserClient {
public:
// This is what AwContentBrowserClient::GetAcceptLangs uses.
static std::string GetAcceptLangsImpl();
// Deprecated: use AwBrowserContext::GetDefault() instead.
static AwBrowserContext* GetAwBrowserContext();
AwContentBrowserClient(JniDependencyFactory* native_factory);
virtual ~AwContentBrowserClient();
// Overriden methods from ContentBrowserClient.
virtual void AddCertificate(net::CertificateMimeType cert_type,
const void* cert_data,
size_t cert_size,
int render_process_id,
int render_frame_id) override;
virtual content::BrowserMainParts* CreateBrowserMainParts(
const content::MainFunctionParams& parameters) override;
virtual content::WebContentsViewDelegate* GetWebContentsViewDelegate(
content::WebContents* web_contents) override;
virtual void RenderProcessWillLaunch(
content::RenderProcessHost* host) override;
virtual net::URLRequestContextGetter* CreateRequestContext(
content::BrowserContext* browser_context,
content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors) override;
virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition(
content::BrowserContext* browser_context,
const base::FilePath& partition_path,
bool in_memory,
content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors) override;
virtual std::string GetCanonicalEncodingNameByAliasName(
const std::string& alias_name) override;
virtual void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
int child_process_id) override;
virtual std::string GetApplicationLocale() override;
virtual std::string GetAcceptLangs(content::BrowserContext* context) override;
virtual const gfx::ImageSkia* GetDefaultFavicon() override;
virtual bool AllowAppCache(const GURL& manifest_url,
const GURL& first_party,
content::ResourceContext* context) override;
virtual bool AllowGetCookie(const GURL& url,
const GURL& first_party,
const net::CookieList& cookie_list,
content::ResourceContext* context,
int render_process_id,
int render_frame_id) override;
virtual bool AllowSetCookie(const GURL& url,
const GURL& first_party,
const std::string& cookie_line,
content::ResourceContext* context,
int render_process_id,
int render_frame_id,
net::CookieOptions* options) override;
virtual bool AllowWorkerDatabase(
const GURL& url,
const base::string16& name,
const base::string16& display_name,
unsigned long estimated_size,
content::ResourceContext* context,
const std::vector<std::pair<int, int> >& render_frames) override;
virtual void AllowWorkerFileSystem(
const GURL& url,
content::ResourceContext* context,
const std::vector<std::pair<int, int> >& render_frames,
base::Callback<void(bool)> callback) override;
virtual bool AllowWorkerIndexedDB(
const GURL& url,
const base::string16& name,
content::ResourceContext* context,
const std::vector<std::pair<int, int> >& render_frames) override;
virtual content::QuotaPermissionContext*
CreateQuotaPermissionContext() override;
virtual void AllowCertificateError(
int render_process_id,
int render_frame_id,
int cert_error,
const net::SSLInfo& ssl_info,
const GURL& request_url,
content::ResourceType resource_type,
bool overridable,
bool strict_enforcement,
bool expired_previous_decision,
const base::Callback<void(bool)>& callback,
content::CertificateRequestResultType* result) override;
virtual void SelectClientCertificate(
int render_process_id,
int render_frame_id,
net::SSLCertRequestInfo* cert_request_info,
const base::Callback<void(net::X509Certificate*)>& callback) override;
virtual blink::WebNotificationPermission
CheckDesktopNotificationPermission(
const GURL& source_url,
content::ResourceContext* context,
int render_process_id) override;
virtual void ShowDesktopNotification(
const content::ShowDesktopNotificationHostMsgParams& params,
content::RenderFrameHost* render_frame_host,
scoped_ptr<content::DesktopNotificationDelegate> delegate,
base::Closure* cancel_callback) override;
virtual void RequestGeolocationPermission(
content::WebContents* web_contents,
int bridge_id,
const GURL& requesting_frame,
bool user_gesture,
const base::Callback<void(bool)>& result_callback) override;
virtual void CancelGeolocationPermissionRequest(
content::WebContents* web_contents,
int bridge_id,
const GURL& requesting_frame) override;
virtual void RequestMidiSysExPermission(
content::WebContents* web_contents,
int bridge_id,
const GURL& requesting_frame,
bool user_gesture,
base::Callback<void(bool)> result_callback,
base::Closure* cancel_callback) override;
virtual void RequestProtectedMediaIdentifierPermission(
content::WebContents* web_contents,
const GURL& origin,
base::Callback<void(bool)> result_callback,
base::Closure* cancel_callback) override;
virtual bool CanCreateWindow(const GURL& opener_url,
const GURL& opener_top_level_frame_url,
const GURL& source_origin,
WindowContainerType container_type,
const GURL& target_url,
const content::Referrer& referrer,
WindowOpenDisposition disposition,
const blink::WebWindowFeatures& features,
bool user_gesture,
bool opener_suppressed,
content::ResourceContext* context,
int render_process_id,
int opener_id,
bool* no_javascript_access) override;
virtual void ResourceDispatcherHostCreated() override;
virtual net::NetLog* GetNetLog() override;
virtual content::AccessTokenStore* CreateAccessTokenStore() override;
virtual bool IsFastShutdownPossible() override;
virtual void ClearCache(content::RenderViewHost* rvh) override;
virtual void ClearCookies(content::RenderViewHost* rvh) override;
virtual base::FilePath GetDefaultDownloadDirectory() override;
virtual std::string GetDefaultDownloadName() override;
virtual void DidCreatePpapiPlugin(
content::BrowserPpapiHost* browser_host) override;
virtual bool AllowPepperSocketAPI(
content::BrowserContext* browser_context,
const GURL& url,
bool private_api,
const content::SocketPermissionRequest* params) override;
virtual void OverrideWebkitPrefs(content::RenderViewHost* rvh,
const GURL& url,
content::WebPreferences* web_prefs) override;
#if defined(VIDEO_HOLE)
virtual content::ExternalVideoSurfaceContainer*
OverrideCreateExternalVideoSurfaceContainer(
content::WebContents* web_contents) override;
#endif
virtual content::DevToolsManagerDelegate*
GetDevToolsManagerDelegate() override;
private:
// Android WebView currently has a single global (non-off-the-record) browser
// context.
scoped_ptr<AwBrowserContext> browser_context_;
scoped_ptr<AwWebPreferencesPopulater> preferences_populater_;
JniDependencyFactory* native_factory_;
DISALLOW_COPY_AND_ASSIGN(AwContentBrowserClient);
};
} // namespace android_webview
#endif // ANDROID_WEBVIEW_LIB_AW_CONTENT_BROWSER_CLIENT_H_