Roll WebRTC 9745:9761, Libjingle 9742:9761
[chromium-blink-merge.git] / android_webview / browser / aw_content_browser_client.h
blob45e9f86335c9197674870d938fbfb53ad7be5506
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 bool IsHandledURL(const GURL& url) override;
52 std::string GetCanonicalEncodingNameByAliasName(
53 const std::string& alias_name) override;
54 void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
55 int child_process_id) override;
56 std::string GetApplicationLocale() override;
57 std::string GetAcceptLangs(content::BrowserContext* context) override;
58 const gfx::ImageSkia* GetDefaultFavicon() override;
59 bool AllowAppCache(const GURL& manifest_url,
60 const GURL& first_party,
61 content::ResourceContext* context) override;
62 bool AllowGetCookie(const GURL& url,
63 const GURL& first_party,
64 const net::CookieList& cookie_list,
65 content::ResourceContext* context,
66 int render_process_id,
67 int render_frame_id) override;
68 bool AllowSetCookie(const GURL& url,
69 const GURL& first_party,
70 const std::string& cookie_line,
71 content::ResourceContext* context,
72 int render_process_id,
73 int render_frame_id,
74 net::CookieOptions* options) override;
75 bool AllowWorkerDatabase(
76 const GURL& url,
77 const base::string16& name,
78 const base::string16& display_name,
79 unsigned long estimated_size,
80 content::ResourceContext* context,
81 const std::vector<std::pair<int, int>>& render_frames) override;
82 void AllowWorkerFileSystem(
83 const GURL& url,
84 content::ResourceContext* context,
85 const std::vector<std::pair<int, int>>& render_frames,
86 base::Callback<void(bool)> callback) override;
87 bool AllowWorkerIndexedDB(
88 const GURL& url,
89 const base::string16& name,
90 content::ResourceContext* context,
91 const std::vector<std::pair<int, int>>& render_frames) override;
92 content::QuotaPermissionContext* CreateQuotaPermissionContext() override;
93 void AllowCertificateError(
94 int render_process_id,
95 int render_frame_id,
96 int cert_error,
97 const net::SSLInfo& ssl_info,
98 const GURL& request_url,
99 content::ResourceType resource_type,
100 bool overridable,
101 bool strict_enforcement,
102 bool expired_previous_decision,
103 const base::Callback<void(bool)>& callback,
104 content::CertificateRequestResultType* result) override;
105 void SelectClientCertificate(
106 content::WebContents* web_contents,
107 net::SSLCertRequestInfo* cert_request_info,
108 scoped_ptr<content::ClientCertificateDelegate> delegate) override;
109 bool CanCreateWindow(const GURL& opener_url,
110 const GURL& opener_top_level_frame_url,
111 const GURL& source_origin,
112 WindowContainerType container_type,
113 const GURL& target_url,
114 const content::Referrer& referrer,
115 WindowOpenDisposition disposition,
116 const blink::WebWindowFeatures& features,
117 bool user_gesture,
118 bool opener_suppressed,
119 content::ResourceContext* context,
120 int render_process_id,
121 int opener_render_view_id,
122 int opener_render_frame_id,
123 bool* no_javascript_access) override;
124 void ResourceDispatcherHostCreated() override;
125 net::NetLog* GetNetLog() override;
126 content::AccessTokenStore* CreateAccessTokenStore() override;
127 bool IsFastShutdownPossible() override;
128 void ClearCache(content::RenderFrameHost* rfh) override;
129 void ClearCookies(content::RenderFrameHost* rfh) override;
130 base::FilePath GetDefaultDownloadDirectory() override;
131 std::string GetDefaultDownloadName() override;
132 void DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) override;
133 bool AllowPepperSocketAPI(
134 content::BrowserContext* browser_context,
135 const GURL& url,
136 bool private_api,
137 const content::SocketPermissionRequest* params) override;
138 void OverrideWebkitPrefs(content::RenderViewHost* rvh,
139 content::WebPreferences* web_prefs) override;
140 #if defined(VIDEO_HOLE)
141 content::ExternalVideoSurfaceContainer*
142 OverrideCreateExternalVideoSurfaceContainer(
143 content::WebContents* web_contents) override;
144 #endif
146 private:
147 // Android WebView currently has a single global (non-off-the-record) browser
148 // context.
149 scoped_ptr<AwBrowserContext> browser_context_;
150 scoped_ptr<AwWebPreferencesPopulater> preferences_populater_;
152 JniDependencyFactory* native_factory_;
154 DISALLOW_COPY_AND_ASSIGN(AwContentBrowserClient);
157 } // namespace android_webview
159 #endif // ANDROID_WEBVIEW_LIB_AW_CONTENT_BROWSER_CLIENT_H_