Add default implementations for AppWindowRegistry::Observer notifications.
[chromium-blink-merge.git] / android_webview / browser / aw_content_browser_client.h
blob9e4f5f308654d88a56c3c44196a02d10e75f8738
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"
13 #include "net/url_request/url_request_job_factory.h"
15 struct WebPreferences;
17 namespace android_webview {
19 class AwBrowserContext;
20 class JniDependencyFactory;
22 class AwContentBrowserClient : public content::ContentBrowserClient {
23 public:
24 // This is what AwContentBrowserClient::GetAcceptLangs uses.
25 static std::string GetAcceptLangsImpl();
27 // Deprecated: use AwBrowserContext::GetDefault() instead.
28 static AwBrowserContext* GetAwBrowserContext();
30 AwContentBrowserClient(JniDependencyFactory* native_factory);
31 virtual ~AwContentBrowserClient();
33 // Overriden methods from ContentBrowserClient.
34 virtual void AddCertificate(net::URLRequest* request,
35 net::CertificateMimeType cert_type,
36 const void* cert_data,
37 size_t cert_size,
38 int render_process_id,
39 int render_view_id) OVERRIDE;
40 virtual content::BrowserMainParts* CreateBrowserMainParts(
41 const content::MainFunctionParams& parameters) OVERRIDE;
42 virtual content::WebContentsViewDelegate* GetWebContentsViewDelegate(
43 content::WebContents* web_contents) OVERRIDE;
44 virtual void RenderProcessWillLaunch(
45 content::RenderProcessHost* host) OVERRIDE;
46 virtual net::URLRequestContextGetter* CreateRequestContext(
47 content::BrowserContext* browser_context,
48 content::ProtocolHandlerMap* protocol_handlers,
49 content::ProtocolHandlerScopedVector protocol_interceptors) OVERRIDE;
50 virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition(
51 content::BrowserContext* browser_context,
52 const base::FilePath& partition_path,
53 bool in_memory,
54 content::ProtocolHandlerMap* protocol_handlers,
55 content::ProtocolHandlerScopedVector protocol_interceptors) OVERRIDE;
56 virtual std::string GetCanonicalEncodingNameByAliasName(
57 const std::string& alias_name) OVERRIDE;
58 virtual void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
59 int child_process_id) OVERRIDE;
60 virtual std::string GetApplicationLocale() OVERRIDE;
61 virtual std::string GetAcceptLangs(content::BrowserContext* context) OVERRIDE;
62 virtual gfx::ImageSkia* GetDefaultFavicon() OVERRIDE;
63 virtual bool AllowAppCache(const GURL& manifest_url,
64 const GURL& first_party,
65 content::ResourceContext* context) OVERRIDE;
66 virtual bool AllowGetCookie(const GURL& url,
67 const GURL& first_party,
68 const net::CookieList& cookie_list,
69 content::ResourceContext* context,
70 int render_process_id,
71 int render_frame_id) OVERRIDE;
72 virtual bool AllowSetCookie(const GURL& url,
73 const GURL& first_party,
74 const std::string& cookie_line,
75 content::ResourceContext* context,
76 int render_process_id,
77 int render_frame_id,
78 net::CookieOptions* options) OVERRIDE;
79 virtual bool AllowWorkerDatabase(
80 const GURL& url,
81 const base::string16& name,
82 const base::string16& display_name,
83 unsigned long estimated_size,
84 content::ResourceContext* context,
85 const std::vector<std::pair<int, int> >& render_frames) OVERRIDE;
86 virtual bool AllowWorkerFileSystem(
87 const GURL& url,
88 content::ResourceContext* context,
89 const std::vector<std::pair<int, int> >& render_frames) OVERRIDE;
90 virtual bool AllowWorkerIndexedDB(
91 const GURL& url,
92 const base::string16& name,
93 content::ResourceContext* context,
94 const std::vector<std::pair<int, int> >& render_frames) OVERRIDE;
95 virtual content::QuotaPermissionContext*
96 CreateQuotaPermissionContext() OVERRIDE;
97 virtual void AllowCertificateError(
98 int render_process_id,
99 int render_frame_id,
100 int cert_error,
101 const net::SSLInfo& ssl_info,
102 const GURL& request_url,
103 ResourceType::Type resource_type,
104 bool overridable,
105 bool strict_enforcement,
106 const base::Callback<void(bool)>& callback,
107 content::CertificateRequestResultType* result) OVERRIDE;
108 virtual void SelectClientCertificate(
109 int render_process_id,
110 int render_frame_id,
111 const net::HttpNetworkSession* network_session,
112 net::SSLCertRequestInfo* cert_request_info,
113 const base::Callback<void(net::X509Certificate*)>& callback) OVERRIDE;
114 virtual blink::WebNotificationPresenter::Permission
115 CheckDesktopNotificationPermission(
116 const GURL& source_url,
117 content::ResourceContext* context,
118 int render_process_id) OVERRIDE;
119 virtual void ShowDesktopNotification(
120 const content::ShowDesktopNotificationHostMsgParams& params,
121 content::RenderFrameHost* render_frame_host,
122 content::DesktopNotificationDelegate* delegate,
123 base::Closure* cancel_callback) OVERRIDE;
124 virtual bool CanCreateWindow(const GURL& opener_url,
125 const GURL& opener_top_level_frame_url,
126 const GURL& source_origin,
127 WindowContainerType container_type,
128 const GURL& target_url,
129 const content::Referrer& referrer,
130 WindowOpenDisposition disposition,
131 const blink::WebWindowFeatures& features,
132 bool user_gesture,
133 bool opener_suppressed,
134 content::ResourceContext* context,
135 int render_process_id,
136 bool is_guest,
137 int opener_id,
138 bool* no_javascript_access) OVERRIDE;
139 virtual std::string GetWorkerProcessTitle(
140 const GURL& url,
141 content::ResourceContext* context) OVERRIDE;
142 virtual void ResourceDispatcherHostCreated() OVERRIDE;
143 virtual net::NetLog* GetNetLog() OVERRIDE;
144 virtual content::AccessTokenStore* CreateAccessTokenStore() OVERRIDE;
145 virtual bool IsFastShutdownPossible() OVERRIDE;
146 virtual void UpdateInspectorSetting(content::RenderViewHost* rvh,
147 const std::string& key,
148 const std::string& value) OVERRIDE;
149 virtual void ClearCache(content::RenderViewHost* rvh) OVERRIDE;
150 virtual void ClearCookies(content::RenderViewHost* rvh) OVERRIDE;
151 virtual base::FilePath GetDefaultDownloadDirectory() OVERRIDE;
152 virtual std::string GetDefaultDownloadName() OVERRIDE;
153 virtual void DidCreatePpapiPlugin(
154 content::BrowserPpapiHost* browser_host) OVERRIDE;
155 virtual bool AllowPepperSocketAPI(
156 content::BrowserContext* browser_context,
157 const GURL& url,
158 bool private_api,
159 const content::SocketPermissionRequest* params) OVERRIDE;
160 virtual void OverrideWebkitPrefs(content::RenderViewHost* rvh,
161 const GURL& url,
162 WebPreferences* web_prefs) OVERRIDE;
163 #if defined(VIDEO_HOLE)
164 virtual content::ExternalVideoSurfaceContainer*
165 OverrideCreateExternalVideoSurfaceContainer(
166 content::WebContents* web_contents) OVERRIDE;
167 #endif
169 private:
170 // Android WebView currently has a single global (non-off-the-record) browser
171 // context.
172 scoped_ptr<AwBrowserContext> browser_context_;
173 scoped_ptr<AwWebPreferencesPopulater> preferences_populater_;
175 JniDependencyFactory* native_factory_;
177 DISALLOW_COPY_AND_ASSIGN(AwContentBrowserClient);
180 } // namespace android_webview
182 #endif // ANDROID_WEBVIEW_LIB_AW_CONTENT_BROWSER_CLIENT_H_