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 CONTENT_PUBLIC_BROWSER_CONTENT_BROWSER_CLIENT_H_
6 #define CONTENT_PUBLIC_BROWSER_CONTENT_BROWSER_CLIENT_H_
13 #include "base/callback_forward.h"
14 #include "base/memory/linked_ptr.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/scoped_vector.h"
17 #include "base/values.h"
18 #include "content/public/browser/certificate_request_result_type.h"
19 #include "content/public/common/content_client.h"
20 #include "content/public/common/media_stream_request.h"
21 #include "content/public/common/resource_type.h"
22 #include "content/public/common/socket_permission_request.h"
23 #include "content/public/common/window_container_type.h"
24 #include "net/base/mime_util.h"
25 #include "net/cookies/canonical_cookie.h"
26 #include "net/url_request/url_request_interceptor.h"
27 #include "net/url_request/url_request_job_factory.h"
28 #include "storage/browser/fileapi/file_system_context.h"
29 #include "third_party/WebKit/public/platform/WebPageVisibilityState.h"
30 #include "ui/base/window_open_disposition.h"
32 #if defined(OS_POSIX) && !defined(OS_MACOSX)
33 #include "base/posix/global_descriptors.h"
37 #include "content/public/browser/file_descriptor_info.h"
44 class DictionaryValue
;
49 struct WebWindowFeatures
;
57 class ApplicationDelegate
;
63 class SSLCertRequestInfo
;
66 class URLRequestContext
;
67 class URLRequestContextGetter
;
68 class X509Certificate
;
76 class SelectFilePolicy
;
80 class ExternalMountPoints
;
81 class FileSystemBackend
;
86 enum class PermissionType
;
87 class AccessTokenStore
;
88 class BrowserChildProcessHost
;
90 class BrowserMainParts
;
91 class BrowserPluginGuestDelegate
;
92 class BrowserPpapiHost
;
93 class BrowserURLHandler
;
94 class ClientCertificateDelegate
;
95 class DevToolsManagerDelegate
;
96 class ExternalVideoSurfaceContainer
;
97 class LocationProvider
;
99 class NavigatorConnectContext
;
100 class NavigatorConnectServiceFactory
;
101 class PlatformNotificationService
;
102 class PresentationServiceDelegate
;
103 class QuotaPermissionContext
;
104 class RenderFrameHost
;
105 class RenderProcessHost
;
106 class RenderViewHost
;
107 class ResourceContext
;
108 class ServiceRegistry
;
110 class SpeechRecognitionManagerDelegate
;
111 class TracingDelegate
;
113 class WebContentsViewDelegate
;
114 struct MainFunctionParams
;
115 struct OpenURLParams
;
117 struct WebPreferences
;
119 // A mapping from the scheme name to the protocol handler that services its
122 std::string
, linked_ptr
<net::URLRequestJobFactory::ProtocolHandler
> >
125 // A scoped vector of protocol interceptors.
126 typedef ScopedVector
<net::URLRequestInterceptor
>
127 URLRequestInterceptorScopedVector
;
129 // Embedder API (or SPI) for participating in browser logic, to be implemented
130 // by the client of the content browser. See ChromeContentBrowserClient for the
131 // principal implementation. The methods are assumed to be called on the UI
132 // thread unless otherwise specified. Use this "escape hatch" sparingly, to
133 // avoid the embedder interface ballooning and becoming very specific to Chrome.
134 // (Often, the call out to the client can happen in a different part of the code
135 // that either already has a hook out to the embedder, or calls out to one of
136 // the observer interfaces.)
137 class CONTENT_EXPORT ContentBrowserClient
{
139 virtual ~ContentBrowserClient() {}
141 // Allows the embedder to set any number of custom BrowserMainParts
142 // implementations for the browser startup code. See comments in
143 // browser_main_parts.h.
144 virtual BrowserMainParts
* CreateBrowserMainParts(
145 const MainFunctionParams
& parameters
);
147 // Allows the embedder to change the default behavior of
148 // BrowserThread::PostAfterStartupTask to better match whatever
149 // definition of "startup" the embedder has in mind. This may be
150 // called on any thread.
151 // Note: see related BrowserThread::PostAfterStartupTask.
152 virtual void PostAfterStartupTask(
153 const tracked_objects::Location
& from_here
,
154 const scoped_refptr
<base::TaskRunner
>& task_runner
,
155 const base::Closure
& task
);
157 // If content creates the WebContentsView implementation, it will ask the
158 // embedder to return an (optional) delegate to customize it. The view will
160 virtual WebContentsViewDelegate
* GetWebContentsViewDelegate(
161 WebContents
* web_contents
);
163 // Notifies that a render process will be created. This is called before
164 // the content layer adds its own BrowserMessageFilters, so that the
165 // embedder's IPC filters have priority.
166 virtual void RenderProcessWillLaunch(RenderProcessHost
* host
) {}
168 // Notifies that a BrowserChildProcessHost has been created.
169 virtual void BrowserChildProcessHostCreated(BrowserChildProcessHost
* host
) {}
171 // Get the effective URL for the given actual URL, to allow an embedder to
172 // group different url schemes in the same SiteInstance.
173 virtual GURL
GetEffectiveURL(BrowserContext
* browser_context
,
176 // Returns whether all instances of the specified effective URL should be
177 // rendered by the same process, rather than using process-per-site-instance.
178 virtual bool ShouldUseProcessPerSite(BrowserContext
* browser_context
,
179 const GURL
& effective_url
);
181 // Returns true unless the effective URL is part of a site that cannot live in
182 // a process dedicated to that site. This is only called if
183 // SiteIsolationPolicy::DoesSiteRequireDedicatedProcess returns true.
184 // TODO(nick): Remove this function once https://crbug.com/160576 is fixed,
185 // and origin lock can be applied to all URLs.
186 virtual bool ShouldLockToOrigin(BrowserContext
* browser_context
,
187 const GURL
& effective_url
);
189 // Returns a list additional WebUI schemes, if any. These additional schemes
190 // act as aliases to the chrome: scheme. The additional schemes may or may
191 // not serve specific WebUI pages depending on the particular URLDataSource
192 // and its override of URLDataSource::ShouldServiceRequest. For all schemes
193 // returned here, view-source is allowed.
194 virtual void GetAdditionalWebUISchemes(
195 std::vector
<std::string
>* additional_schemes
) {}
197 // Returns a list of webUI hosts to ignore the storage partition check in
198 // URLRequestChromeJob::CheckStoragePartitionMatches.
199 virtual void GetAdditionalWebUIHostsToIgnoreParititionCheck(
200 std::vector
<std::string
>* hosts
) {}
202 // Creates the main net::URLRequestContextGetter. Should only be called once
203 // per ContentBrowserClient object.
204 // TODO(ajwong): Remove once http://crbug.com/159193 is resolved.
205 virtual net::URLRequestContextGetter
* CreateRequestContext(
206 BrowserContext
* browser_context
,
207 ProtocolHandlerMap
* protocol_handlers
,
208 URLRequestInterceptorScopedVector request_interceptors
);
210 // Creates the net::URLRequestContextGetter for a StoragePartition. Should
211 // only be called once per partition_path per ContentBrowserClient object.
212 // TODO(ajwong): Remove once http://crbug.com/159193 is resolved.
213 virtual net::URLRequestContextGetter
* CreateRequestContextForStoragePartition(
214 BrowserContext
* browser_context
,
215 const base::FilePath
& partition_path
,
217 ProtocolHandlerMap
* protocol_handlers
,
218 URLRequestInterceptorScopedVector request_interceptors
);
220 // Returns whether a specified URL is handled by the embedder's internal
221 // protocol handlers.
222 virtual bool IsHandledURL(const GURL
& url
);
224 // Returns whether the given process is allowed to commit |url|. This is a
225 // more conservative check than IsSuitableHost, since it is used after a
226 // navigation has committed to ensure that the process did not exceed its
228 // This is called on the UI thread.
229 virtual bool CanCommitURL(RenderProcessHost
* process_host
, const GURL
& url
);
231 // Returns true if no URL within |origin| is allowed to commit in the given
232 // process. Must return false if there exists at least one URL in |origin|
233 // that is allowed to commit.
234 // This is called on the IO thread.
235 virtual bool IsIllegalOrigin(ResourceContext
* resource_context
,
236 int child_process_id
,
239 // Returns whether a URL should be allowed to open from a specific context.
240 // This also applies in cases where the new URL will open in another process.
241 virtual bool ShouldAllowOpenURL(SiteInstance
* site_instance
, const GURL
& url
);
243 // Returns whether a new view for a given |site_url| can be launched in a
244 // given |process_host|.
245 virtual bool IsSuitableHost(RenderProcessHost
* process_host
,
246 const GURL
& site_url
);
248 // Returns whether a new view for a new site instance can be added to a
249 // given |process_host|.
250 virtual bool MayReuseHost(RenderProcessHost
* process_host
);
252 // Returns whether a new process should be created or an existing one should
253 // be reused based on the URL we want to load. This should return false,
254 // unless there is a good reason otherwise.
255 virtual bool ShouldTryToUseExistingProcessHost(
256 BrowserContext
* browser_context
, const GURL
& url
);
258 // Called when a site instance is first associated with a process.
259 virtual void SiteInstanceGotProcess(SiteInstance
* site_instance
) {}
261 // Called from a site instance's destructor.
262 virtual void SiteInstanceDeleting(SiteInstance
* site_instance
) {}
264 // Returns true if for the navigation from |current_url| to |new_url|
265 // in |site_instance|, a new SiteInstance and BrowsingInstance should be
266 // created (even if we are in a process model that doesn't usually swap.)
267 // This forces a process swap and severs script connections with existing
269 virtual bool ShouldSwapBrowsingInstancesForNavigation(
270 SiteInstance
* site_instance
,
271 const GURL
& current_url
,
272 const GURL
& new_url
);
274 // Returns true if the given navigation redirect should cause a renderer
276 // This is called on the IO thread.
277 virtual bool ShouldSwapProcessesForRedirect(ResourceContext
* resource_context
,
278 const GURL
& current_url
,
279 const GURL
& new_url
);
281 // Returns true if the passed in URL should be assigned as the site of the
282 // current SiteInstance, if it does not yet have a site.
283 virtual bool ShouldAssignSiteForURL(const GURL
& url
);
285 // See CharacterEncoding's comment.
286 virtual std::string
GetCanonicalEncodingNameByAliasName(
287 const std::string
& alias_name
);
289 // Allows the embedder to pass extra command line flags.
290 // switches::kProcessType will already be set at this point.
291 virtual void AppendExtraCommandLineSwitches(base::CommandLine
* command_line
,
292 int child_process_id
) {}
294 // Returns the locale used by the application.
295 // This is called on the UI and IO threads.
296 virtual std::string
GetApplicationLocale();
298 // Returns the languages used in the Accept-Languages HTTP header.
299 // (Not called GetAcceptLanguages so it doesn't clash with win32).
300 virtual std::string
GetAcceptLangs(BrowserContext
* context
);
302 // Returns the default favicon. The callee doesn't own the given bitmap.
303 virtual const gfx::ImageSkia
* GetDefaultFavicon();
305 // Allow the embedder to control if an AppCache can be used for the given url.
306 // This is called on the IO thread.
307 virtual bool AllowAppCache(const GURL
& manifest_url
,
308 const GURL
& first_party
,
309 ResourceContext
* context
);
311 // Allow the embedder to control if a Service Worker can be associated
312 // with the given scope.
313 // This is called on the IO thread.
314 virtual bool AllowServiceWorker(const GURL
& scope
,
315 const GURL
& first_party
,
316 content::ResourceContext
* context
,
317 int render_process_id
,
318 int render_frame_id
);
320 // Allow the embedder to control if the given cookie can be read.
321 // This is called on the IO thread.
322 virtual bool AllowGetCookie(const GURL
& url
,
323 const GURL
& first_party
,
324 const net::CookieList
& cookie_list
,
325 ResourceContext
* context
,
326 int render_process_id
,
327 int render_frame_id
);
329 // Allow the embedder to control if the given cookie can be set.
330 // This is called on the IO thread.
331 virtual bool AllowSetCookie(const GURL
& url
,
332 const GURL
& first_party
,
333 const std::string
& cookie_line
,
334 ResourceContext
* context
,
335 int render_process_id
,
337 net::CookieOptions
* options
);
339 // This is called on the IO thread.
340 virtual bool AllowSaveLocalState(ResourceContext
* context
);
342 // Allow the embedder to control if access to web database by a shared worker
343 // is allowed. |render_frame| is a vector of pairs of
344 // RenderProcessID/RenderFrameID of RenderFrame that are using this worker.
345 // This is called on the IO thread.
346 virtual bool AllowWorkerDatabase(
348 const base::string16
& name
,
349 const base::string16
& display_name
,
350 unsigned long estimated_size
,
351 ResourceContext
* context
,
352 const std::vector
<std::pair
<int, int> >& render_frames
);
354 // Allow the embedder to control if access to file system by a shared worker
356 // This is called on the IO thread.
357 virtual void AllowWorkerFileSystem(
359 ResourceContext
* context
,
360 const std::vector
<std::pair
<int, int> >& render_frames
,
361 base::Callback
<void(bool)> callback
);
363 // Allow the embedder to control if access to IndexedDB by a shared worker
365 // This is called on the IO thread.
366 virtual bool AllowWorkerIndexedDB(
368 const base::string16
& name
,
369 ResourceContext
* context
,
370 const std::vector
<std::pair
<int, int> >& render_frames
);
372 #if defined(ENABLE_WEBRTC)
373 // Allow the embedder to control if WebRTC identities are allowed to be cached
374 // and potentially reused for future requests (within the same origin).
375 // This is called on the IO thread.
376 virtual bool AllowWebRTCIdentityCache(const GURL
& url
,
377 const GURL
& first_party_url
,
378 ResourceContext
* context
);
379 #endif // defined(ENABLE_WEBRTC)
381 // Allow the embedder to override the request context based on the URL for
382 // certain operations, like cookie access. Returns nullptr to indicate the
383 // regular request context should be used.
384 // This is called on the IO thread.
385 virtual net::URLRequestContext
* OverrideRequestContextForURL(
386 const GURL
& url
, ResourceContext
* context
);
388 // Allow the embedder to specify a string version of the storage partition
389 // config with a site.
390 virtual std::string
GetStoragePartitionIdForSite(
391 BrowserContext
* browser_context
,
394 // Allows the embedder to provide a validation check for |partition_id|s.
395 // This domain of valid entries should match the range of outputs for
396 // GetStoragePartitionIdForChildProcess().
397 virtual bool IsValidStoragePartitionId(BrowserContext
* browser_context
,
398 const std::string
& partition_id
);
400 // Allows the embedder to provide a storage parititon configuration for a
401 // site. A storage partition configuration includes a domain of the embedder's
402 // choice, an optional name within that domain, and whether the partition is
405 // If |can_be_default| is false, the caller is telling the embedder that the
406 // |site| is known to not be in the default partition. This is useful in
407 // some shutdown situations where the bookkeeping logic that maps sites to
408 // their partition configuration are no longer valid.
410 // The |partition_domain| is [a-z]* UTF-8 string, specifying the domain in
411 // which partitions live (similar to namespace). Within a domain, partitions
412 // can be uniquely identified by the combination of |partition_name| and
413 // |in_memory| values. When a partition is not to be persisted, the
414 // |in_memory| value must be set to true.
415 virtual void GetStoragePartitionConfigForSite(
416 BrowserContext
* browser_context
,
419 std::string
* partition_domain
,
420 std::string
* partition_name
,
423 // Create and return a new quota permission context.
424 virtual QuotaPermissionContext
* CreateQuotaPermissionContext();
426 // Informs the embedder that a certificate error has occured. If
427 // |overridable| is true and if |strict_enforcement| is false, the user
428 // can ignore the error and continue. The embedder can call the callback
429 // asynchronously. If |result| is not set to
430 // CERTIFICATE_REQUEST_RESULT_TYPE_CONTINUE, the request will be cancelled
431 // or denied immediately, and the callback won't be run.
432 virtual void AllowCertificateError(int render_process_id
,
435 const net::SSLInfo
& ssl_info
,
436 const GURL
& request_url
,
437 ResourceType resource_type
,
439 bool strict_enforcement
,
440 bool expired_previous_decision
,
441 const base::Callback
<void(bool)>& callback
,
442 CertificateRequestResultType
* result
) {}
444 // Selects a SSL client certificate and returns it to the |delegate|. Note:
445 // |delegate| may be called synchronously or asynchronously.
447 // TODO(davidben): Move this hook to WebContentsDelegate.
448 virtual void SelectClientCertificate(
449 WebContents
* web_contents
,
450 net::SSLCertRequestInfo
* cert_request_info
,
451 scoped_ptr
<ClientCertificateDelegate
> delegate
);
453 // Adds a new installable certificate or private key.
454 // Typically used to install an X.509 user certificate.
455 // Note that it's up to the embedder to verify that the data is
456 // well-formed. |cert_data| will be nullptr if |cert_size| is 0.
457 virtual void AddCertificate(net::CertificateMimeType cert_type
,
458 const void* cert_data
,
460 int render_process_id
,
461 int render_frame_id
) {}
463 // Returns a class to get notifications about media event. The embedder can
464 // return nullptr if they're not interested.
465 virtual MediaObserver
* GetMediaObserver();
467 // Returns the platform notification service, capable of displaying Web
468 // Notifications to the user. The embedder can return a nullptr if they don't
469 // support this functionality. May be called from any thread.
470 virtual PlatformNotificationService
* GetPlatformNotificationService();
472 // Returns true if the given page is allowed to open a window of the given
473 // type. If true is returned, |no_javascript_access| will indicate whether
474 // the window that is created should be scriptable/in the same process.
475 // This is called on the IO thread.
476 virtual bool CanCreateWindow(const GURL
& opener_url
,
477 const GURL
& opener_top_level_frame_url
,
478 const GURL
& source_origin
,
479 WindowContainerType container_type
,
480 const GURL
& target_url
,
481 const Referrer
& referrer
,
482 WindowOpenDisposition disposition
,
483 const blink::WebWindowFeatures
& features
,
485 bool opener_suppressed
,
486 ResourceContext
* context
,
487 int render_process_id
,
488 int opener_render_view_id
,
489 int opener_render_frame_id
,
490 bool* no_javascript_access
);
492 // Notifies the embedder that the ResourceDispatcherHost has been created.
493 // This is when it can optionally add a delegate.
494 virtual void ResourceDispatcherHostCreated() {}
496 // Allows the embedder to return a delegate for the SpeechRecognitionManager.
497 // The delegate will be owned by the manager. It's valid to return nullptr.
498 virtual SpeechRecognitionManagerDelegate
*
499 CreateSpeechRecognitionManagerDelegate();
501 // Getters for common objects.
502 virtual net::NetLog
* GetNetLog();
504 // Creates a new AccessTokenStore for gelocation.
505 virtual AccessTokenStore
* CreateAccessTokenStore();
507 // Returns true if fast shutdown is possible.
508 virtual bool IsFastShutdownPossible();
510 // Called by WebContents to override the WebKit preferences that are used by
511 // the renderer. The content layer will add its own settings, and then it's up
512 // to the embedder to update it if it wants.
513 virtual void OverrideWebkitPrefs(RenderViewHost
* render_view_host
,
514 WebPreferences
* prefs
) {}
516 // Notifies that BrowserURLHandler has been created, so that the embedder can
517 // optionally add their own handlers.
518 virtual void BrowserURLHandlerCreated(BrowserURLHandler
* handler
) {}
520 // Clears browser cache.
521 virtual void ClearCache(RenderFrameHost
* rfh
) {}
523 // Clears browser cookies.
524 virtual void ClearCookies(RenderFrameHost
* rfh
) {}
526 // Returns the default download directory.
527 // This can be called on any thread.
528 virtual base::FilePath
GetDefaultDownloadDirectory();
530 // Returns the default filename used in downloads when we have no idea what
531 // else we should do with the file.
532 virtual std::string
GetDefaultDownloadName();
534 // Returns the path to the browser shader disk cache root.
535 virtual base::FilePath
GetShaderDiskCacheDirectory();
537 // Notification that a pepper plugin has just been spawned. This allows the
538 // embedder to add filters onto the host to implement interfaces.
539 // This is called on the IO thread.
540 virtual void DidCreatePpapiPlugin(BrowserPpapiHost
* browser_host
) {}
542 // Gets the host for an external out-of-process plugin.
543 virtual BrowserPpapiHost
* GetExternalBrowserPpapiHost(
544 int plugin_child_id
);
546 // Returns true if the socket operation specified by |params| is allowed from
547 // the given |browser_context| and |url|. If |params| is nullptr, this method
548 // checks the basic "socket" permission, which is for those operations that
549 // don't require a specific socket permission rule.
550 // |private_api| indicates whether this permission check is for the private
551 // Pepper socket API or the public one.
552 virtual bool AllowPepperSocketAPI(BrowserContext
* browser_context
,
555 const SocketPermissionRequest
* params
);
557 // Returns an implementation of a file selecition policy. Can return nullptr.
558 virtual ui::SelectFilePolicy
* CreateSelectFilePolicy(
559 WebContents
* web_contents
);
561 // Returns additional allowed scheme set which can access files in
563 virtual void GetAdditionalAllowedSchemesForFileSystem(
564 std::vector
<std::string
>* additional_schemes
) {}
566 // Returns auto mount handlers for URL requests for FileSystem APIs.
567 virtual void GetURLRequestAutoMountHandlers(
568 std::vector
<storage::URLRequestAutoMountHandler
>* handlers
) {}
570 // Returns additional file system backends for FileSystem API.
571 // |browser_context| is needed in the additional FileSystemBackends.
572 // It has mount points to create objects returned by additional
573 // FileSystemBackends, and SpecialStoragePolicy for permission granting.
574 virtual void GetAdditionalFileSystemBackends(
575 BrowserContext
* browser_context
,
576 const base::FilePath
& storage_partition_path
,
577 ScopedVector
<storage::FileSystemBackend
>* additional_backends
) {}
579 // Allows an embedder to return its own LocationProvider implementation.
580 // Return nullptr to use the default one for the platform to be created.
581 // FYI: Used by an external project; please don't remove.
582 // Contact Viatcheslav Ostapenko at sl.ostapenko@samsung.com for more
584 virtual LocationProvider
* OverrideSystemLocationProvider();
586 // Creates a new DevToolsManagerDelegate. The caller owns the returned value.
587 // It's valid to return nullptr.
588 virtual DevToolsManagerDelegate
* GetDevToolsManagerDelegate();
590 // Creates a new TracingDelegate. The caller owns the returned value.
591 // It's valid to return nullptr.
592 virtual TracingDelegate
* GetTracingDelegate();
594 // Returns true if NPAPI plugins are enabled.
595 virtual bool IsNPAPIEnabled();
597 // Returns true if plugin referred to by the url can use
598 // pp::FileIO::RequestOSFileHandle.
599 virtual bool IsPluginAllowedToCallRequestOSFileHandle(
600 BrowserContext
* browser_context
,
603 // Returns true if dev channel APIs are available for plugins.
604 virtual bool IsPluginAllowedToUseDevChannelAPIs(
605 BrowserContext
* browser_context
,
608 // Allows to register browser Mojo services exposed through the
609 // RenderProcessHost.
610 virtual void RegisterRenderProcessMojoServices(ServiceRegistry
* registry
) {}
612 // Allows to register browser Mojo services exposed through the
614 virtual void RegisterFrameMojoShellServices(
615 ServiceRegistry
* registry
,
616 RenderFrameHost
* render_frame_host
) {}
618 using StaticMojoApplicationMap
=
619 std::map
<GURL
, base::Callback
<scoped_ptr
<mojo::ApplicationDelegate
>()>>;
621 // Registers Mojo applications to be loaded in the browser process by the
622 // browser's global Mojo shell.
623 virtual void RegisterInProcessMojoApplications(
624 StaticMojoApplicationMap
* apps
) {}
626 using OutOfProcessMojoApplicationMap
= std::map
<GURL
, base::string16
>;
628 // Registers Mojo applications to be loaded out of the browser process, in a
629 // sandboxed utility process. The value of each map entry should be the
630 // process name to use for the application's host process when launched.
631 virtual void RegisterOutOfProcessMojoApplications(
632 OutOfProcessMojoApplicationMap
* apps
) {}
634 // Registers Mojo applications to be loaded out of the browser process (in
635 // a utility process) without the sandbox.
637 // WARNING: This path is NOT recommended! If a Mojo application needs a
638 // service that is only available out of the sandbox, it could ask the browser
639 // process to provide it (e.g. through OverrideFrameMojoShellServices()). Only
640 // use this method when that approach does not work.
641 virtual void RegisterUnsandboxedOutOfProcessMojoApplications(
642 OutOfProcessMojoApplicationMap
* apps
) {}
644 // Registers additional navigator.connect service factories available in a
645 // particular NavigatorConnectContext.
646 virtual void GetAdditionalNavigatorConnectServices(
647 const scoped_refptr
<NavigatorConnectContext
>& context
) {}
649 // Allows to override the visibility state of a RenderFrameHost.
650 // |visibility_state| should not be null. It will only be set if needed.
651 virtual void OverridePageVisibilityState(
652 RenderFrameHost
* render_frame_host
,
653 blink::WebPageVisibilityState
* visibility_state
) {}
655 // Allows an embedder to provide its own PresentationServiceDelegate
656 // implementation. Returns nullptr if unavailable.
657 virtual PresentationServiceDelegate
* GetPresentationServiceDelegate(
658 WebContents
* web_contents
);
660 // Allows programmatic opening of a new tab/window without going through
661 // another WebContents. For example, from a Worker. |callback| will be
662 // invoked with the appropriate WebContents* when available.
663 virtual void OpenURL(BrowserContext
* browser_context
,
664 const OpenURLParams
& params
,
665 const base::Callback
<void(WebContents
*)>& callback
);
667 // Allows the embedder to record |metric| for a specific |url|.
668 virtual void RecordURLMetric(const std::string
& metric
, const GURL
& url
) {}
670 // Populates |mappings| with all files that need to be mapped before launching
672 #if defined(OS_ANDROID)
673 virtual void GetAdditionalMappedFilesForChildProcess(
674 const base::CommandLine
& command_line
,
675 int child_process_id
,
676 content::FileDescriptorInfo
* mappings
,
677 std::map
<int, base::MemoryMappedFile::Region
>* regions
) {}
678 #elif defined(OS_POSIX) && !defined(OS_MACOSX)
679 virtual void GetAdditionalMappedFilesForChildProcess(
680 const base::CommandLine
& command_line
,
681 int child_process_id
,
682 content::FileDescriptorInfo
* mappings
) {}
683 #endif // defined(OS_ANDROID)
686 // Returns the name of the dll that contains cursors and other resources.
687 virtual const wchar_t* GetResourceDllName();
689 // This is called on the PROCESS_LAUNCHER thread before the renderer process
690 // is launched. It gives the embedder a chance to add loosen the sandbox
692 virtual void PreSpawnRenderer(sandbox::TargetPolicy
* policy
,
695 // Returns the AppContainer SID for the specified sandboxed process type, or
696 // empty string if this sandboxed process type does not support living inside
698 virtual base::string16
GetAppContainerSidForSandboxType(
699 int sandbox_type
) const;
702 #if defined(VIDEO_HOLE)
703 // Allows an embedder to provide its own ExternalVideoSurfaceContainer
704 // implementation. Return nullptr to disable external surface video.
705 virtual ExternalVideoSurfaceContainer
*
706 OverrideCreateExternalVideoSurfaceContainer(WebContents
* web_contents
);
710 } // namespace content
712 #endif // CONTENT_PUBLIC_BROWSER_CONTENT_BROWSER_CLIENT_H_