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
) {
184 callback
.Run(nullptr);
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 PlatformNotificationService
*
223 ContentBrowserClient::GetPlatformNotificationService() {
227 void ContentBrowserClient::RequestPermission(
228 PermissionType permission
,
229 WebContents
* web_contents
,
231 const GURL
& requesting_frame
,
233 const base::Callback
<void(PermissionStatus
)>& callback
) {
234 callback
.Run(PERMISSION_STATUS_DENIED
);
237 PermissionStatus
ContentBrowserClient::GetPermissionStatus(
238 PermissionType permission
,
239 BrowserContext
* browser_context
,
240 const GURL
& requesting_origin
,
241 const GURL
& embedding_origin
) {
242 return PERMISSION_STATUS_DENIED
;
245 bool ContentBrowserClient::CanCreateWindow(
246 const GURL
& opener_url
,
247 const GURL
& opener_top_level_frame_url
,
248 const GURL
& source_origin
,
249 WindowContainerType container_type
,
250 const GURL
& target_url
,
251 const Referrer
& referrer
,
252 WindowOpenDisposition disposition
,
253 const blink::WebWindowFeatures
& features
,
255 bool opener_suppressed
,
256 ResourceContext
* context
,
257 int render_process_id
,
259 bool* no_javascript_access
) {
260 *no_javascript_access
= false;
264 SpeechRecognitionManagerDelegate
*
265 ContentBrowserClient::CreateSpeechRecognitionManagerDelegate() {
269 net::NetLog
* ContentBrowserClient::GetNetLog() {
273 AccessTokenStore
* ContentBrowserClient::CreateAccessTokenStore() {
277 bool ContentBrowserClient::IsFastShutdownPossible() {
281 base::FilePath
ContentBrowserClient::GetDefaultDownloadDirectory() {
282 return base::FilePath();
285 std::string
ContentBrowserClient::GetDefaultDownloadName() {
286 return std::string();
290 ContentBrowserClient::GetExternalBrowserPpapiHost(int plugin_process_id
) {
294 bool ContentBrowserClient::AllowPepperSocketAPI(
295 BrowserContext
* browser_context
,
298 const SocketPermissionRequest
* params
) {
302 ui::SelectFilePolicy
* ContentBrowserClient::CreateSelectFilePolicy(
303 WebContents
* web_contents
) {
307 LocationProvider
* ContentBrowserClient::OverrideSystemLocationProvider() {
311 DevToolsManagerDelegate
* ContentBrowserClient::GetDevToolsManagerDelegate() {
315 TracingDelegate
* ContentBrowserClient::GetTracingDelegate() {
319 bool ContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle(
320 BrowserContext
* browser_context
,
325 bool ContentBrowserClient::IsPluginAllowedToUseDevChannelAPIs(
326 BrowserContext
* browser_context
,
331 net::CookieStore
* ContentBrowserClient::OverrideCookieStoreForRenderProcess(
332 int render_process_id
) {
336 bool ContentBrowserClient::CheckMediaAccessPermission(
337 BrowserContext
* browser_context
,
338 const GURL
& security_origin
,
339 MediaStreamType type
) {
343 PresentationServiceDelegate
*
344 ContentBrowserClient::GetPresentationServiceDelegate(
345 WebContents
* web_contents
) {
349 void ContentBrowserClient::OpenURL(
350 content::BrowserContext
* browser_context
,
351 const content::OpenURLParams
& params
,
352 const base::Callback
<void(content::WebContents
*)>& callback
) {
353 callback
.Run(nullptr);
357 const wchar_t* ContentBrowserClient::GetResourceDllName() {
362 #if defined(VIDEO_HOLE)
363 ExternalVideoSurfaceContainer
*
364 ContentBrowserClient::OverrideCreateExternalVideoSurfaceContainer(
365 WebContents
* web_contents
) {
370 } // namespace content