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 WebContentsViewDelegate
* ContentBrowserClient::GetWebContentsViewDelegate(
20 WebContents
* web_contents
) {
24 GURL
ContentBrowserClient::GetEffectiveURL(BrowserContext
* browser_context
,
29 bool ContentBrowserClient::ShouldUseProcessPerSite(
30 BrowserContext
* browser_context
, const GURL
& effective_url
) {
34 net::URLRequestContextGetter
* ContentBrowserClient::CreateRequestContext(
35 BrowserContext
* browser_context
,
36 ProtocolHandlerMap
* protocol_handlers
,
37 URLRequestInterceptorScopedVector request_interceptors
) {
41 net::URLRequestContextGetter
*
42 ContentBrowserClient::CreateRequestContextForStoragePartition(
43 BrowserContext
* browser_context
,
44 const base::FilePath
& partition_path
,
46 ProtocolHandlerMap
* protocol_handlers
,
47 URLRequestInterceptorScopedVector request_interceptors
) {
51 bool ContentBrowserClient::IsHandledURL(const GURL
& url
) {
55 bool ContentBrowserClient::CanCommitURL(RenderProcessHost
* process_host
,
56 const GURL
& site_url
) {
60 bool ContentBrowserClient::ShouldAllowOpenURL(SiteInstance
* site_instance
,
65 bool ContentBrowserClient::IsSuitableHost(RenderProcessHost
* process_host
,
66 const GURL
& site_url
) {
70 bool ContentBrowserClient::MayReuseHost(RenderProcessHost
* process_host
) {
74 bool ContentBrowserClient::ShouldTryToUseExistingProcessHost(
75 BrowserContext
* browser_context
, const GURL
& url
) {
79 bool ContentBrowserClient::ShouldSwapBrowsingInstancesForNavigation(
80 SiteInstance
* site_instance
,
81 const GURL
& current_url
,
82 const GURL
& new_url
) {
86 bool ContentBrowserClient::ShouldSwapProcessesForRedirect(
87 ResourceContext
* resource_context
, const GURL
& current_url
,
88 const GURL
& new_url
) {
92 bool ContentBrowserClient::ShouldAssignSiteForURL(const GURL
& url
) {
96 std::string
ContentBrowserClient::GetCanonicalEncodingNameByAliasName(
97 const std::string
& alias_name
) {
101 std::string
ContentBrowserClient::GetApplicationLocale() {
105 std::string
ContentBrowserClient::GetAcceptLangs(BrowserContext
* context
) {
106 return std::string();
109 const gfx::ImageSkia
* ContentBrowserClient::GetDefaultFavicon() {
110 static gfx::ImageSkia
* empty
= new gfx::ImageSkia();
114 bool ContentBrowserClient::AllowAppCache(const GURL
& manifest_url
,
115 const GURL
& first_party
,
116 ResourceContext
* context
) {
120 bool ContentBrowserClient::AllowServiceWorker(
122 const GURL
& document_url
,
123 content::ResourceContext
* context
) {
127 bool ContentBrowserClient::AllowGetCookie(const GURL
& url
,
128 const GURL
& first_party
,
129 const net::CookieList
& cookie_list
,
130 ResourceContext
* context
,
131 int render_process_id
,
132 int render_frame_id
) {
136 bool ContentBrowserClient::AllowSetCookie(const GURL
& url
,
137 const GURL
& first_party
,
138 const std::string
& cookie_line
,
139 ResourceContext
* context
,
140 int render_process_id
,
142 net::CookieOptions
* options
) {
146 bool ContentBrowserClient::AllowSaveLocalState(ResourceContext
* context
) {
150 bool ContentBrowserClient::AllowWorkerDatabase(
152 const base::string16
& name
,
153 const base::string16
& display_name
,
154 unsigned long estimated_size
,
155 ResourceContext
* context
,
156 const std::vector
<std::pair
<int, int> >& render_frames
) {
160 void ContentBrowserClient::AllowWorkerFileSystem(
162 ResourceContext
* context
,
163 const std::vector
<std::pair
<int, int> >& render_frames
,
164 base::Callback
<void(bool)> callback
) {
168 bool ContentBrowserClient::AllowWorkerIndexedDB(
170 const base::string16
& name
,
171 ResourceContext
* context
,
172 const std::vector
<std::pair
<int, int> >& render_frames
) {
176 QuotaPermissionContext
* ContentBrowserClient::CreateQuotaPermissionContext() {
180 void ContentBrowserClient::SelectClientCertificate(
181 WebContents
* web_contents
,
182 net::SSLCertRequestInfo
* cert_request_info
,
183 scoped_ptr
<ClientCertificateDelegate
> delegate
) {
186 net::URLRequestContext
* ContentBrowserClient::OverrideRequestContextForURL(
187 const GURL
& url
, ResourceContext
* context
) {
191 std::string
ContentBrowserClient::GetStoragePartitionIdForSite(
192 BrowserContext
* browser_context
,
194 return std::string();
197 bool ContentBrowserClient::IsValidStoragePartitionId(
198 BrowserContext
* browser_context
,
199 const std::string
& partition_id
) {
200 // Since the GetStoragePartitionIdForChildProcess() only generates empty
201 // strings, we should only ever see empty strings coming back.
202 return partition_id
.empty();
205 void ContentBrowserClient::GetStoragePartitionConfigForSite(
206 BrowserContext
* browser_context
,
209 std::string
* partition_domain
,
210 std::string
* partition_name
,
212 partition_domain
->clear();
213 partition_name
->clear();
217 MediaObserver
* ContentBrowserClient::GetMediaObserver() {
221 PlatformNotificationService
*
222 ContentBrowserClient::GetPlatformNotificationService() {
226 bool ContentBrowserClient::CanCreateWindow(
227 const GURL
& opener_url
,
228 const GURL
& opener_top_level_frame_url
,
229 const GURL
& source_origin
,
230 WindowContainerType container_type
,
231 const GURL
& target_url
,
232 const Referrer
& referrer
,
233 WindowOpenDisposition disposition
,
234 const blink::WebWindowFeatures
& features
,
236 bool opener_suppressed
,
237 ResourceContext
* context
,
238 int render_process_id
,
240 bool* no_javascript_access
) {
241 *no_javascript_access
= false;
245 SpeechRecognitionManagerDelegate
*
246 ContentBrowserClient::CreateSpeechRecognitionManagerDelegate() {
250 net::NetLog
* ContentBrowserClient::GetNetLog() {
254 AccessTokenStore
* ContentBrowserClient::CreateAccessTokenStore() {
258 bool ContentBrowserClient::IsFastShutdownPossible() {
262 base::FilePath
ContentBrowserClient::GetDefaultDownloadDirectory() {
263 return base::FilePath();
266 std::string
ContentBrowserClient::GetDefaultDownloadName() {
267 return std::string();
271 ContentBrowserClient::GetExternalBrowserPpapiHost(int plugin_process_id
) {
275 bool ContentBrowserClient::AllowPepperSocketAPI(
276 BrowserContext
* browser_context
,
279 const SocketPermissionRequest
* params
) {
283 ui::SelectFilePolicy
* ContentBrowserClient::CreateSelectFilePolicy(
284 WebContents
* web_contents
) {
288 LocationProvider
* ContentBrowserClient::OverrideSystemLocationProvider() {
292 DevToolsManagerDelegate
* ContentBrowserClient::GetDevToolsManagerDelegate() {
296 TracingDelegate
* ContentBrowserClient::GetTracingDelegate() {
300 bool ContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle(
301 BrowserContext
* browser_context
,
306 bool ContentBrowserClient::IsPluginAllowedToUseDevChannelAPIs(
307 BrowserContext
* browser_context
,
312 bool ContentBrowserClient::CheckMediaAccessPermission(
313 BrowserContext
* browser_context
,
314 const GURL
& security_origin
,
315 MediaStreamType type
) {
319 PresentationServiceDelegate
*
320 ContentBrowserClient::GetPresentationServiceDelegate(
321 WebContents
* web_contents
) {
325 void ContentBrowserClient::OpenURL(
326 content::BrowserContext
* browser_context
,
327 const content::OpenURLParams
& params
,
328 const base::Callback
<void(content::WebContents
*)>& callback
) {
329 callback
.Run(nullptr);
333 const wchar_t* ContentBrowserClient::GetResourceDllName() {
338 #if defined(VIDEO_HOLE)
339 ExternalVideoSurfaceContainer
*
340 ContentBrowserClient::OverrideCreateExternalVideoSurfaceContainer(
341 WebContents
* web_contents
) {
346 } // namespace content