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 "content/public/browser/client_certificate_delegate.h"
9 #include "ui/gfx/image/image_skia.h"
14 BrowserMainParts
* ContentBrowserClient::CreateBrowserMainParts(
15 const MainFunctionParams
& parameters
) {
19 void ContentBrowserClient::PostAfterStartupTask(
20 const tracked_objects::Location
& from_here
,
21 const scoped_refptr
<base::TaskRunner
>& task_runner
,
22 const base::Closure
& task
) {
23 task_runner
->PostTask(from_here
, task
);
26 WebContentsViewDelegate
* ContentBrowserClient::GetWebContentsViewDelegate(
27 WebContents
* web_contents
) {
31 GURL
ContentBrowserClient::GetEffectiveURL(BrowserContext
* browser_context
,
36 bool ContentBrowserClient::ShouldUseProcessPerSite(
37 BrowserContext
* browser_context
, const GURL
& effective_url
) {
41 net::URLRequestContextGetter
* ContentBrowserClient::CreateRequestContext(
42 BrowserContext
* browser_context
,
43 ProtocolHandlerMap
* protocol_handlers
,
44 URLRequestInterceptorScopedVector request_interceptors
) {
48 net::URLRequestContextGetter
*
49 ContentBrowserClient::CreateRequestContextForStoragePartition(
50 BrowserContext
* browser_context
,
51 const base::FilePath
& partition_path
,
53 ProtocolHandlerMap
* protocol_handlers
,
54 URLRequestInterceptorScopedVector request_interceptors
) {
58 bool ContentBrowserClient::IsHandledURL(const GURL
& url
) {
62 bool ContentBrowserClient::CanCommitURL(RenderProcessHost
* process_host
,
63 const GURL
& site_url
) {
67 bool ContentBrowserClient::ShouldAllowOpenURL(SiteInstance
* site_instance
,
72 bool ContentBrowserClient::IsSuitableHost(RenderProcessHost
* process_host
,
73 const GURL
& site_url
) {
77 bool ContentBrowserClient::MayReuseHost(RenderProcessHost
* process_host
) {
81 bool ContentBrowserClient::ShouldTryToUseExistingProcessHost(
82 BrowserContext
* browser_context
, const GURL
& url
) {
86 bool ContentBrowserClient::ShouldSwapBrowsingInstancesForNavigation(
87 SiteInstance
* site_instance
,
88 const GURL
& current_url
,
89 const GURL
& new_url
) {
93 bool ContentBrowserClient::ShouldSwapProcessesForRedirect(
94 ResourceContext
* resource_context
, const GURL
& current_url
,
95 const GURL
& new_url
) {
99 bool ContentBrowserClient::ShouldAssignSiteForURL(const GURL
& url
) {
103 std::string
ContentBrowserClient::GetCanonicalEncodingNameByAliasName(
104 const std::string
& alias_name
) {
105 return std::string();
108 std::string
ContentBrowserClient::GetApplicationLocale() {
112 std::string
ContentBrowserClient::GetAcceptLangs(BrowserContext
* context
) {
113 return std::string();
116 const gfx::ImageSkia
* ContentBrowserClient::GetDefaultFavicon() {
117 static gfx::ImageSkia
* empty
= new gfx::ImageSkia();
121 bool ContentBrowserClient::AllowAppCache(const GURL
& manifest_url
,
122 const GURL
& first_party
,
123 ResourceContext
* context
) {
127 bool ContentBrowserClient::AllowServiceWorker(
129 const GURL
& document_url
,
130 content::ResourceContext
* context
) {
134 bool ContentBrowserClient::AllowGetCookie(const GURL
& url
,
135 const GURL
& first_party
,
136 const net::CookieList
& cookie_list
,
137 ResourceContext
* context
,
138 int render_process_id
,
139 int render_frame_id
) {
143 bool ContentBrowserClient::AllowSetCookie(const GURL
& url
,
144 const GURL
& first_party
,
145 const std::string
& cookie_line
,
146 ResourceContext
* context
,
147 int render_process_id
,
149 net::CookieOptions
* options
) {
153 bool ContentBrowserClient::AllowSaveLocalState(ResourceContext
* context
) {
157 bool ContentBrowserClient::AllowWorkerDatabase(
159 const base::string16
& name
,
160 const base::string16
& display_name
,
161 unsigned long estimated_size
,
162 ResourceContext
* context
,
163 const std::vector
<std::pair
<int, int> >& render_frames
) {
167 void ContentBrowserClient::AllowWorkerFileSystem(
169 ResourceContext
* context
,
170 const std::vector
<std::pair
<int, int> >& render_frames
,
171 base::Callback
<void(bool)> callback
) {
175 bool ContentBrowserClient::AllowWorkerIndexedDB(
177 const base::string16
& name
,
178 ResourceContext
* context
,
179 const std::vector
<std::pair
<int, int> >& render_frames
) {
183 QuotaPermissionContext
* ContentBrowserClient::CreateQuotaPermissionContext() {
187 void ContentBrowserClient::SelectClientCertificate(
188 WebContents
* web_contents
,
189 net::SSLCertRequestInfo
* cert_request_info
,
190 scoped_ptr
<ClientCertificateDelegate
> delegate
) {
193 net::URLRequestContext
* ContentBrowserClient::OverrideRequestContextForURL(
194 const GURL
& url
, ResourceContext
* context
) {
198 std::string
ContentBrowserClient::GetStoragePartitionIdForSite(
199 BrowserContext
* browser_context
,
201 return std::string();
204 bool ContentBrowserClient::IsValidStoragePartitionId(
205 BrowserContext
* browser_context
,
206 const std::string
& partition_id
) {
207 // Since the GetStoragePartitionIdForChildProcess() only generates empty
208 // strings, we should only ever see empty strings coming back.
209 return partition_id
.empty();
212 void ContentBrowserClient::GetStoragePartitionConfigForSite(
213 BrowserContext
* browser_context
,
216 std::string
* partition_domain
,
217 std::string
* partition_name
,
219 partition_domain
->clear();
220 partition_name
->clear();
224 MediaObserver
* ContentBrowserClient::GetMediaObserver() {
228 PlatformNotificationService
*
229 ContentBrowserClient::GetPlatformNotificationService() {
233 bool ContentBrowserClient::CanCreateWindow(
234 const GURL
& opener_url
,
235 const GURL
& opener_top_level_frame_url
,
236 const GURL
& source_origin
,
237 WindowContainerType container_type
,
238 const GURL
& target_url
,
239 const Referrer
& referrer
,
240 WindowOpenDisposition disposition
,
241 const blink::WebWindowFeatures
& features
,
243 bool opener_suppressed
,
244 ResourceContext
* context
,
245 int render_process_id
,
247 bool* no_javascript_access
) {
248 *no_javascript_access
= false;
252 SpeechRecognitionManagerDelegate
*
253 ContentBrowserClient::CreateSpeechRecognitionManagerDelegate() {
257 net::NetLog
* ContentBrowserClient::GetNetLog() {
261 AccessTokenStore
* ContentBrowserClient::CreateAccessTokenStore() {
265 bool ContentBrowserClient::IsFastShutdownPossible() {
269 base::FilePath
ContentBrowserClient::GetDefaultDownloadDirectory() {
270 return base::FilePath();
273 std::string
ContentBrowserClient::GetDefaultDownloadName() {
274 return std::string();
278 ContentBrowserClient::GetExternalBrowserPpapiHost(int plugin_process_id
) {
282 bool ContentBrowserClient::AllowPepperSocketAPI(
283 BrowserContext
* browser_context
,
286 const SocketPermissionRequest
* params
) {
290 ui::SelectFilePolicy
* ContentBrowserClient::CreateSelectFilePolicy(
291 WebContents
* web_contents
) {
295 LocationProvider
* ContentBrowserClient::OverrideSystemLocationProvider() {
299 DevToolsManagerDelegate
* ContentBrowserClient::GetDevToolsManagerDelegate() {
303 TracingDelegate
* ContentBrowserClient::GetTracingDelegate() {
307 bool ContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle(
308 BrowserContext
* browser_context
,
313 bool ContentBrowserClient::IsPluginAllowedToUseDevChannelAPIs(
314 BrowserContext
* browser_context
,
319 bool ContentBrowserClient::CheckMediaAccessPermission(
320 BrowserContext
* browser_context
,
321 const GURL
& security_origin
,
322 MediaStreamType type
) {
326 PresentationServiceDelegate
*
327 ContentBrowserClient::GetPresentationServiceDelegate(
328 WebContents
* web_contents
) {
332 void ContentBrowserClient::OpenURL(
333 content::BrowserContext
* browser_context
,
334 const content::OpenURLParams
& params
,
335 const base::Callback
<void(content::WebContents
*)>& callback
) {
336 callback
.Run(nullptr);
340 const wchar_t* ContentBrowserClient::GetResourceDllName() {
345 #if defined(VIDEO_HOLE)
346 ExternalVideoSurfaceContainer
*
347 ContentBrowserClient::OverrideCreateExternalVideoSurfaceContainer(
348 WebContents
* web_contents
) {
353 } // namespace content