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 #include "content/public/browser/content_browser_client.h"
7 #include "base/files/file_path.h"
8 #include "ui/gfx/image/image_skia.h"
13 BrowserMainParts* ContentBrowserClient::CreateBrowserMainParts(
14 const MainFunctionParams& parameters) {
18 WebContentsViewDelegate* ContentBrowserClient::GetWebContentsViewDelegate(
19 WebContents* web_contents) {
23 GURL ContentBrowserClient::GetEffectiveURL(BrowserContext* browser_context,
28 bool ContentBrowserClient::ShouldUseProcessPerSite(
29 BrowserContext* browser_context, const GURL& effective_url) {
33 net::URLRequestContextGetter* ContentBrowserClient::CreateRequestContext(
34 BrowserContext* browser_context,
35 ProtocolHandlerMap* protocol_handlers,
36 URLRequestInterceptorScopedVector request_interceptors) {
40 net::URLRequestContextGetter*
41 ContentBrowserClient::CreateRequestContextForStoragePartition(
42 BrowserContext* browser_context,
43 const base::FilePath& partition_path,
45 ProtocolHandlerMap* protocol_handlers,
46 URLRequestInterceptorScopedVector request_interceptors) {
50 bool ContentBrowserClient::IsHandledURL(const GURL& url) {
54 bool ContentBrowserClient::CanCommitURL(RenderProcessHost* process_host,
55 const GURL& site_url) {
59 bool ContentBrowserClient::ShouldAllowOpenURL(SiteInstance* site_instance,
64 bool ContentBrowserClient::IsSuitableHost(RenderProcessHost* process_host,
65 const GURL& site_url) {
69 bool ContentBrowserClient::MayReuseHost(RenderProcessHost* process_host) {
73 bool ContentBrowserClient::ShouldTryToUseExistingProcessHost(
74 BrowserContext* browser_context, const GURL& url) {
78 bool ContentBrowserClient::ShouldSwapBrowsingInstancesForNavigation(
79 SiteInstance* site_instance,
80 const GURL& current_url,
81 const GURL& new_url) {
85 bool ContentBrowserClient::ShouldSwapProcessesForRedirect(
86 ResourceContext* resource_context, const GURL& current_url,
87 const GURL& new_url) {
91 bool ContentBrowserClient::ShouldAssignSiteForURL(const GURL& url) {
95 std::string ContentBrowserClient::GetCanonicalEncodingNameByAliasName(
96 const std::string& alias_name) {
100 std::string ContentBrowserClient::GetApplicationLocale() {
104 std::string ContentBrowserClient::GetAcceptLangs(BrowserContext* context) {
105 return std::string();
108 const gfx::ImageSkia* ContentBrowserClient::GetDefaultFavicon() {
109 static gfx::ImageSkia* empty = new gfx::ImageSkia();
113 bool ContentBrowserClient::AllowAppCache(const GURL& manifest_url,
114 const GURL& first_party,
115 ResourceContext* context) {
119 bool ContentBrowserClient::AllowServiceWorker(
121 const GURL& document_url,
122 content::ResourceContext* context) {
126 bool ContentBrowserClient::AllowGetCookie(const GURL& url,
127 const GURL& first_party,
128 const net::CookieList& cookie_list,
129 ResourceContext* context,
130 int render_process_id,
131 int render_frame_id) {
135 bool ContentBrowserClient::AllowSetCookie(const GURL& url,
136 const GURL& first_party,
137 const std::string& cookie_line,
138 ResourceContext* context,
139 int render_process_id,
141 net::CookieOptions* options) {
145 bool ContentBrowserClient::AllowSaveLocalState(ResourceContext* context) {
149 bool ContentBrowserClient::AllowWorkerDatabase(
151 const base::string16& name,
152 const base::string16& display_name,
153 unsigned long estimated_size,
154 ResourceContext* context,
155 const std::vector<std::pair<int, int> >& render_frames) {
159 void ContentBrowserClient::AllowWorkerFileSystem(
161 ResourceContext* context,
162 const std::vector<std::pair<int, int> >& render_frames,
163 base::Callback<void(bool)> callback) {
167 bool ContentBrowserClient::AllowWorkerIndexedDB(
169 const base::string16& name,
170 ResourceContext* context,
171 const std::vector<std::pair<int, int> >& render_frames) {
175 QuotaPermissionContext* ContentBrowserClient::CreateQuotaPermissionContext() {
179 void ContentBrowserClient::SelectClientCertificate(
180 int render_process_id,
182 net::SSLCertRequestInfo* cert_request_info,
183 const base::Callback<void(net::X509Certificate*)>& callback) {
187 net::URLRequestContext* ContentBrowserClient::OverrideRequestContextForURL(
188 const GURL& url, ResourceContext* context) {
192 std::string ContentBrowserClient::GetStoragePartitionIdForSite(
193 BrowserContext* browser_context,
195 return std::string();
198 bool ContentBrowserClient::IsValidStoragePartitionId(
199 BrowserContext* browser_context,
200 const std::string& partition_id) {
201 // Since the GetStoragePartitionIdForChildProcess() only generates empty
202 // strings, we should only ever see empty strings coming back.
203 return partition_id.empty();
206 void ContentBrowserClient::GetStoragePartitionConfigForSite(
207 BrowserContext* browser_context,
210 std::string* partition_domain,
211 std::string* partition_name,
213 partition_domain->clear();
214 partition_name->clear();
218 MediaObserver* ContentBrowserClient::GetMediaObserver() {
222 blink::WebNotificationPermission
223 ContentBrowserClient::CheckDesktopNotificationPermission(
224 const GURL& source_origin,
225 ResourceContext* context,
226 int render_process_id) {
227 return blink::WebNotificationPermissionAllowed;
230 void ContentBrowserClient::RequestPermission(
231 PermissionType permission,
232 WebContents* web_contents,
234 const GURL& requesting_frame,
236 const base::Callback<void(bool)>& result_callback) {
237 result_callback.Run(true);
240 bool ContentBrowserClient::CanCreateWindow(
241 const GURL& opener_url,
242 const GURL& opener_top_level_frame_url,
243 const GURL& source_origin,
244 WindowContainerType container_type,
245 const GURL& target_url,
246 const Referrer& referrer,
247 WindowOpenDisposition disposition,
248 const blink::WebWindowFeatures& features,
250 bool opener_suppressed,
251 ResourceContext* context,
252 int render_process_id,
254 bool* no_javascript_access) {
255 *no_javascript_access = false;
259 SpeechRecognitionManagerDelegate*
260 ContentBrowserClient::GetSpeechRecognitionManagerDelegate() {
264 net::NetLog* ContentBrowserClient::GetNetLog() {
268 AccessTokenStore* ContentBrowserClient::CreateAccessTokenStore() {
272 bool ContentBrowserClient::IsFastShutdownPossible() {
276 base::FilePath ContentBrowserClient::GetDefaultDownloadDirectory() {
277 return base::FilePath();
280 std::string ContentBrowserClient::GetDefaultDownloadName() {
281 return std::string();
285 ContentBrowserClient::GetExternalBrowserPpapiHost(int plugin_process_id) {
289 bool ContentBrowserClient::AllowPepperSocketAPI(
290 BrowserContext* browser_context,
293 const SocketPermissionRequest* params) {
297 ui::SelectFilePolicy* ContentBrowserClient::CreateSelectFilePolicy(
298 WebContents* web_contents) {
302 LocationProvider* ContentBrowserClient::OverrideSystemLocationProvider() {
306 VibrationProvider* ContentBrowserClient::OverrideVibrationProvider() {
310 DevToolsManagerDelegate* ContentBrowserClient::GetDevToolsManagerDelegate() {
314 bool ContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle(
315 BrowserContext* browser_context,
320 bool ContentBrowserClient::IsPluginAllowedToUseDevChannelAPIs(
321 BrowserContext* browser_context,
326 net::CookieStore* ContentBrowserClient::OverrideCookieStoreForRenderProcess(
327 int render_process_id) {
332 const wchar_t* ContentBrowserClient::GetResourceDllName() {
337 #if defined(VIDEO_HOLE)
338 ExternalVideoSurfaceContainer*
339 ContentBrowserClient::OverrideCreateExternalVideoSurfaceContainer(
340 WebContents* web_contents) {
345 bool ContentBrowserClient::CheckMediaAccessPermission(
346 BrowserContext* browser_context,
347 const GURL& security_origin,
348 MediaStreamType type) {
352 } // namespace content