ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / content / public / browser / content_browser_client.h
blobc5c3942d749cc211489a01c8b1d6f7f22e961cd5
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_
8 #include <map>
9 #include <string>
10 #include <utility>
11 #include <vector>
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/browser/permission_type.h"
20 #include "content/public/common/content_client.h"
21 #include "content/public/common/media_stream_request.h"
22 #include "content/public/common/permission_status.mojom.h"
23 #include "content/public/common/resource_type.h"
24 #include "content/public/common/socket_permission_request.h"
25 #include "content/public/common/window_container_type.h"
26 #include "net/base/mime_util.h"
27 #include "net/cookies/canonical_cookie.h"
28 #include "net/url_request/url_request_interceptor.h"
29 #include "net/url_request/url_request_job_factory.h"
30 #include "storage/browser/fileapi/file_system_context.h"
31 #include "third_party/WebKit/public/platform/WebPageVisibilityState.h"
32 #include "ui/base/window_open_disposition.h"
34 #if defined(OS_POSIX) && !defined(OS_MACOSX)
35 #include "base/posix/global_descriptors.h"
36 #endif
38 #if defined(OS_POSIX)
39 #include "content/public/browser/file_descriptor_info.h"
40 #endif
42 class GURL;
44 namespace base {
45 class CommandLine;
46 class DictionaryValue;
47 class FilePath;
50 namespace blink {
51 struct WebWindowFeatures;
54 namespace gfx {
55 class ImageSkia;
58 namespace net {
59 class CookieOptions;
60 class CookieStore;
61 class NetLog;
62 class SSLCertRequestInfo;
63 class SSLInfo;
64 class URLRequest;
65 class URLRequestContext;
66 class URLRequestContextGetter;
67 class X509Certificate;
70 namespace sandbox {
71 class TargetPolicy;
74 namespace ui {
75 class SelectFilePolicy;
78 namespace storage {
79 class ExternalMountPoints;
80 class FileSystemBackend;
83 namespace content {
85 class AccessTokenStore;
86 class BrowserChildProcessHost;
87 class BrowserContext;
88 class BrowserMainParts;
89 class BrowserPluginGuestDelegate;
90 class BrowserPpapiHost;
91 class BrowserURLHandler;
92 class DevToolsManagerDelegate;
93 class ExternalVideoSurfaceContainer;
94 class LocationProvider;
95 class MediaObserver;
96 class NavigatorConnectContext;
97 class NavigatorConnectServiceFactory;
98 class PlatformNotificationService;
99 class PresentationServiceDelegate;
100 class QuotaPermissionContext;
101 class RenderFrameHost;
102 class RenderProcessHost;
103 class RenderViewHost;
104 class ResourceContext;
105 class ServiceRegistry;
106 class SiteInstance;
107 class SpeechRecognitionManagerDelegate;
108 class TracingDelegate;
109 class WebContents;
110 class WebContentsViewDelegate;
111 struct MainFunctionParams;
112 struct OpenURLParams;
113 struct Referrer;
114 struct WebPreferences;
116 // A mapping from the scheme name to the protocol handler that services its
117 // content.
118 typedef std::map<
119 std::string, linked_ptr<net::URLRequestJobFactory::ProtocolHandler> >
120 ProtocolHandlerMap;
122 // A scoped vector of protocol interceptors.
123 typedef ScopedVector<net::URLRequestInterceptor>
124 URLRequestInterceptorScopedVector;
126 // Embedder API (or SPI) for participating in browser logic, to be implemented
127 // by the client of the content browser. See ChromeContentBrowserClient for the
128 // principal implementation. The methods are assumed to be called on the UI
129 // thread unless otherwise specified. Use this "escape hatch" sparingly, to
130 // avoid the embedder interface ballooning and becoming very specific to Chrome.
131 // (Often, the call out to the client can happen in a different part of the code
132 // that either already has a hook out to the embedder, or calls out to one of
133 // the observer interfaces.)
134 class CONTENT_EXPORT ContentBrowserClient {
135 public:
136 virtual ~ContentBrowserClient() {}
138 // Allows the embedder to set any number of custom BrowserMainParts
139 // implementations for the browser startup code. See comments in
140 // browser_main_parts.h.
141 virtual BrowserMainParts* CreateBrowserMainParts(
142 const MainFunctionParams& parameters);
144 // If content creates the WebContentsView implementation, it will ask the
145 // embedder to return an (optional) delegate to customize it. The view will
146 // own the delegate.
147 virtual WebContentsViewDelegate* GetWebContentsViewDelegate(
148 WebContents* web_contents);
150 // Notifies that a render process will be created. This is called before
151 // the content layer adds its own BrowserMessageFilters, so that the
152 // embedder's IPC filters have priority.
153 virtual void RenderProcessWillLaunch(RenderProcessHost* host) {}
155 // Notifies that a BrowserChildProcessHost has been created.
156 virtual void BrowserChildProcessHostCreated(BrowserChildProcessHost* host) {}
158 // Get the effective URL for the given actual URL, to allow an embedder to
159 // group different url schemes in the same SiteInstance.
160 virtual GURL GetEffectiveURL(BrowserContext* browser_context,
161 const GURL& url);
163 // Returns whether all instances of the specified effective URL should be
164 // rendered by the same process, rather than using process-per-site-instance.
165 virtual bool ShouldUseProcessPerSite(BrowserContext* browser_context,
166 const GURL& effective_url);
168 // Returns a list additional WebUI schemes, if any. These additional schemes
169 // act as aliases to the chrome: scheme. The additional schemes may or may
170 // not serve specific WebUI pages depending on the particular URLDataSource
171 // and its override of URLDataSource::ShouldServiceRequest. For all schemes
172 // returned here, view-source is allowed.
173 virtual void GetAdditionalWebUISchemes(
174 std::vector<std::string>* additional_schemes) {}
176 // Returns a list of webUI hosts to ignore the storage partition check in
177 // URLRequestChromeJob::CheckStoragePartitionMatches.
178 virtual void GetAdditionalWebUIHostsToIgnoreParititionCheck(
179 std::vector<std::string>* hosts) {}
181 // Creates the main net::URLRequestContextGetter. Should only be called once
182 // per ContentBrowserClient object.
183 // TODO(ajwong): Remove once http://crbug.com/159193 is resolved.
184 virtual net::URLRequestContextGetter* CreateRequestContext(
185 BrowserContext* browser_context,
186 ProtocolHandlerMap* protocol_handlers,
187 URLRequestInterceptorScopedVector request_interceptors);
189 // Creates the net::URLRequestContextGetter for a StoragePartition. Should
190 // only be called once per partition_path per ContentBrowserClient object.
191 // TODO(ajwong): Remove once http://crbug.com/159193 is resolved.
192 virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition(
193 BrowserContext* browser_context,
194 const base::FilePath& partition_path,
195 bool in_memory,
196 ProtocolHandlerMap* protocol_handlers,
197 URLRequestInterceptorScopedVector request_interceptors);
199 // Returns whether a specified URL is handled by the embedder's internal
200 // protocol handlers.
201 virtual bool IsHandledURL(const GURL& url);
203 // Returns whether the given process is allowed to commit |url|. This is a
204 // more conservative check than IsSuitableHost, since it is used after a
205 // navigation has committed to ensure that the process did not exceed its
206 // authority.
207 virtual bool CanCommitURL(RenderProcessHost* process_host, const GURL& url);
209 // Returns whether a URL should be allowed to open from a specific context.
210 // This also applies in cases where the new URL will open in another process.
211 virtual bool ShouldAllowOpenURL(SiteInstance* site_instance, const GURL& url);
213 // Returns whether a new view for a given |site_url| can be launched in a
214 // given |process_host|.
215 virtual bool IsSuitableHost(RenderProcessHost* process_host,
216 const GURL& site_url);
218 // Returns whether a new view for a new site instance can be added to a
219 // given |process_host|.
220 virtual bool MayReuseHost(RenderProcessHost* process_host);
222 // Returns whether a new process should be created or an existing one should
223 // be reused based on the URL we want to load. This should return false,
224 // unless there is a good reason otherwise.
225 virtual bool ShouldTryToUseExistingProcessHost(
226 BrowserContext* browser_context, const GURL& url);
228 // Called when a site instance is first associated with a process.
229 virtual void SiteInstanceGotProcess(SiteInstance* site_instance) {}
231 // Called from a site instance's destructor.
232 virtual void SiteInstanceDeleting(SiteInstance* site_instance) {}
234 // Returns true if for the navigation from |current_url| to |new_url|
235 // in |site_instance|, a new SiteInstance and BrowsingInstance should be
236 // created (even if we are in a process model that doesn't usually swap.)
237 // This forces a process swap and severs script connections with existing
238 // tabs.
239 virtual bool ShouldSwapBrowsingInstancesForNavigation(
240 SiteInstance* site_instance,
241 const GURL& current_url,
242 const GURL& new_url);
244 // Returns true if the given navigation redirect should cause a renderer
245 // process swap.
246 // This is called on the IO thread.
247 virtual bool ShouldSwapProcessesForRedirect(ResourceContext* resource_context,
248 const GURL& current_url,
249 const GURL& new_url);
251 // Returns true if the passed in URL should be assigned as the site of the
252 // current SiteInstance, if it does not yet have a site.
253 virtual bool ShouldAssignSiteForURL(const GURL& url);
255 // See CharacterEncoding's comment.
256 virtual std::string GetCanonicalEncodingNameByAliasName(
257 const std::string& alias_name);
259 // Allows the embedder to pass extra command line flags.
260 // switches::kProcessType will already be set at this point.
261 virtual void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
262 int child_process_id) {}
264 // Returns the locale used by the application.
265 // This is called on the UI and IO threads.
266 virtual std::string GetApplicationLocale();
268 // Returns the languages used in the Accept-Languages HTTP header.
269 // (Not called GetAcceptLanguages so it doesn't clash with win32).
270 virtual std::string GetAcceptLangs(BrowserContext* context);
272 // Returns the default favicon. The callee doesn't own the given bitmap.
273 virtual const gfx::ImageSkia* GetDefaultFavicon();
275 // Allow the embedder to control if an AppCache can be used for the given url.
276 // This is called on the IO thread.
277 virtual bool AllowAppCache(const GURL& manifest_url,
278 const GURL& first_party,
279 ResourceContext* context);
281 // Allow the embedder to control if a Service Worker can be associated
282 // with the given scope.
283 // This is called on the IO thread.
284 virtual bool AllowServiceWorker(const GURL& scope,
285 const GURL& first_party,
286 content::ResourceContext* context);
288 // Allow the embedder to control if the given cookie can be read.
289 // This is called on the IO thread.
290 virtual bool AllowGetCookie(const GURL& url,
291 const GURL& first_party,
292 const net::CookieList& cookie_list,
293 ResourceContext* context,
294 int render_process_id,
295 int render_frame_id);
297 // Allow the embedder to control if the given cookie can be set.
298 // This is called on the IO thread.
299 virtual bool AllowSetCookie(const GURL& url,
300 const GURL& first_party,
301 const std::string& cookie_line,
302 ResourceContext* context,
303 int render_process_id,
304 int render_frame_id,
305 net::CookieOptions* options);
307 // This is called on the IO thread.
308 virtual bool AllowSaveLocalState(ResourceContext* context);
310 // Allow the embedder to control if access to web database by a shared worker
311 // is allowed. |render_frame| is a vector of pairs of
312 // RenderProcessID/RenderFrameID of RenderFrame that are using this worker.
313 // This is called on the IO thread.
314 virtual bool AllowWorkerDatabase(
315 const GURL& url,
316 const base::string16& name,
317 const base::string16& display_name,
318 unsigned long estimated_size,
319 ResourceContext* context,
320 const std::vector<std::pair<int, int> >& render_frames);
322 // Allow the embedder to control if access to file system by a shared worker
323 // is allowed.
324 // This is called on the IO thread.
325 virtual void AllowWorkerFileSystem(
326 const GURL& url,
327 ResourceContext* context,
328 const std::vector<std::pair<int, int> >& render_frames,
329 base::Callback<void(bool)> callback);
331 // Allow the embedder to control if access to IndexedDB by a shared worker
332 // is allowed.
333 // This is called on the IO thread.
334 virtual bool AllowWorkerIndexedDB(
335 const GURL& url,
336 const base::string16& name,
337 ResourceContext* context,
338 const std::vector<std::pair<int, int> >& render_frames);
340 // Allow the embedder to override the request context based on the URL for
341 // certain operations, like cookie access. Returns nullptr to indicate the
342 // regular request context should be used.
343 // This is called on the IO thread.
344 virtual net::URLRequestContext* OverrideRequestContextForURL(
345 const GURL& url, ResourceContext* context);
347 // Allow the embedder to specify a string version of the storage partition
348 // config with a site.
349 virtual std::string GetStoragePartitionIdForSite(
350 BrowserContext* browser_context,
351 const GURL& site);
353 // Allows the embedder to provide a validation check for |partition_id|s.
354 // This domain of valid entries should match the range of outputs for
355 // GetStoragePartitionIdForChildProcess().
356 virtual bool IsValidStoragePartitionId(BrowserContext* browser_context,
357 const std::string& partition_id);
359 // Allows the embedder to provide a storage parititon configuration for a
360 // site. A storage partition configuration includes a domain of the embedder's
361 // choice, an optional name within that domain, and whether the partition is
362 // in-memory only.
364 // If |can_be_default| is false, the caller is telling the embedder that the
365 // |site| is known to not be in the default partition. This is useful in
366 // some shutdown situations where the bookkeeping logic that maps sites to
367 // their partition configuration are no longer valid.
369 // The |partition_domain| is [a-z]* UTF-8 string, specifying the domain in
370 // which partitions live (similar to namespace). Within a domain, partitions
371 // can be uniquely identified by the combination of |partition_name| and
372 // |in_memory| values. When a partition is not to be persisted, the
373 // |in_memory| value must be set to true.
374 virtual void GetStoragePartitionConfigForSite(
375 BrowserContext* browser_context,
376 const GURL& site,
377 bool can_be_default,
378 std::string* partition_domain,
379 std::string* partition_name,
380 bool* in_memory);
382 // Create and return a new quota permission context.
383 virtual QuotaPermissionContext* CreateQuotaPermissionContext();
385 // Informs the embedder that a certificate error has occured. If
386 // |overridable| is true and if |strict_enforcement| is false, the user
387 // can ignore the error and continue. The embedder can call the callback
388 // asynchronously. If |result| is not set to
389 // CERTIFICATE_REQUEST_RESULT_TYPE_CONTINUE, the request will be cancelled
390 // or denied immediately, and the callback won't be run.
391 virtual void AllowCertificateError(int render_process_id,
392 int render_frame_id,
393 int cert_error,
394 const net::SSLInfo& ssl_info,
395 const GURL& request_url,
396 ResourceType resource_type,
397 bool overridable,
398 bool strict_enforcement,
399 bool expired_previous_decision,
400 const base::Callback<void(bool)>& callback,
401 CertificateRequestResultType* result) {}
403 // Selects a SSL client certificate and returns it to the |callback|. If no
404 // certificate was selected nullptr is returned to the |callback|. Note:
405 // |callback| may be called synchronously or asynchronously.
406 virtual void SelectClientCertificate(
407 int render_process_id,
408 int render_frame_id,
409 net::SSLCertRequestInfo* cert_request_info,
410 const base::Callback<void(net::X509Certificate*)>& callback);
412 // Adds a new installable certificate or private key.
413 // Typically used to install an X.509 user certificate.
414 // Note that it's up to the embedder to verify that the data is
415 // well-formed. |cert_data| will be nullptr if |cert_size| is 0.
416 virtual void AddCertificate(net::CertificateMimeType cert_type,
417 const void* cert_data,
418 size_t cert_size,
419 int render_process_id,
420 int render_frame_id) {}
422 // Returns a class to get notifications about media event. The embedder can
423 // return nullptr if they're not interested.
424 virtual MediaObserver* GetMediaObserver();
426 // Returns the platform notification service, capable of displaying Web
427 // Notifications to the user. The embedder can return a nullptr if they don't
428 // support this functionality. May be called from any thread.
429 virtual PlatformNotificationService* GetPlatformNotificationService();
431 virtual void RequestPermission(
432 PermissionType permission,
433 WebContents* web_contents,
434 int bridge_id,
435 const GURL& requesting_frame,
436 bool user_gesture,
437 const base::Callback<void(PermissionStatus)>& callback);
439 virtual void CancelPermissionRequest(PermissionType permission,
440 WebContents* web_contents,
441 int bridge_id,
442 const GURL& requesting_frame) {}
444 virtual void RegisterPermissionUsage(PermissionType permission,
445 WebContents* web_contents,
446 const GURL& frame_url,
447 const GURL& main_frame_url) {}
449 virtual PermissionStatus GetPermissionStatus(
450 PermissionType permission,
451 BrowserContext* browser_context,
452 const GURL& requesting_origin,
453 const GURL& embedding_origin);
455 virtual void ResetPermission(PermissionType permission,
456 BrowserContext* browser_context,
457 const GURL& requesting_origin,
458 const GURL& embedding_origin) {}
460 // Returns true if the given page is allowed to open a window of the given
461 // type. If true is returned, |no_javascript_access| will indicate whether
462 // the window that is created should be scriptable/in the same process.
463 // This is called on the IO thread.
464 virtual bool CanCreateWindow(const GURL& opener_url,
465 const GURL& opener_top_level_frame_url,
466 const GURL& source_origin,
467 WindowContainerType container_type,
468 const GURL& target_url,
469 const Referrer& referrer,
470 WindowOpenDisposition disposition,
471 const blink::WebWindowFeatures& features,
472 bool user_gesture,
473 bool opener_suppressed,
474 ResourceContext* context,
475 int render_process_id,
476 int opener_id,
477 bool* no_javascript_access);
479 // Notifies the embedder that the ResourceDispatcherHost has been created.
480 // This is when it can optionally add a delegate.
481 virtual void ResourceDispatcherHostCreated() {}
483 // Allows the embedder to return a delegate for the SpeechRecognitionManager.
484 // The delegate will be owned by the manager. It's valid to return nullptr.
485 virtual SpeechRecognitionManagerDelegate*
486 CreateSpeechRecognitionManagerDelegate();
488 // Getters for common objects.
489 virtual net::NetLog* GetNetLog();
491 // Creates a new AccessTokenStore for gelocation.
492 virtual AccessTokenStore* CreateAccessTokenStore();
494 // Returns true if fast shutdown is possible.
495 virtual bool IsFastShutdownPossible();
497 // Called by WebContents to override the WebKit preferences that are used by
498 // the renderer. The content layer will add its own settings, and then it's up
499 // to the embedder to update it if it wants.
500 virtual void OverrideWebkitPrefs(RenderViewHost* render_view_host,
501 WebPreferences* prefs) {}
503 // Notifies that BrowserURLHandler has been created, so that the embedder can
504 // optionally add their own handlers.
505 virtual void BrowserURLHandlerCreated(BrowserURLHandler* handler) {}
507 // Clears browser cache.
508 virtual void ClearCache(RenderViewHost* rvh) {}
510 // Clears browser cookies.
511 virtual void ClearCookies(RenderViewHost* rvh) {}
513 // Returns the default download directory.
514 // This can be called on any thread.
515 virtual base::FilePath GetDefaultDownloadDirectory();
517 // Returns the default filename used in downloads when we have no idea what
518 // else we should do with the file.
519 virtual std::string GetDefaultDownloadName();
521 // Notification that a pepper plugin has just been spawned. This allows the
522 // embedder to add filters onto the host to implement interfaces.
523 // This is called on the IO thread.
524 virtual void DidCreatePpapiPlugin(BrowserPpapiHost* browser_host) {}
526 // Gets the host for an external out-of-process plugin.
527 virtual BrowserPpapiHost* GetExternalBrowserPpapiHost(
528 int plugin_child_id);
530 // Returns true if the socket operation specified by |params| is allowed from
531 // the given |browser_context| and |url|. If |params| is nullptr, this method
532 // checks the basic "socket" permission, which is for those operations that
533 // don't require a specific socket permission rule.
534 // |private_api| indicates whether this permission check is for the private
535 // Pepper socket API or the public one.
536 virtual bool AllowPepperSocketAPI(BrowserContext* browser_context,
537 const GURL& url,
538 bool private_api,
539 const SocketPermissionRequest* params);
541 // Returns an implementation of a file selecition policy. Can return nullptr.
542 virtual ui::SelectFilePolicy* CreateSelectFilePolicy(
543 WebContents* web_contents);
545 // Returns additional allowed scheme set which can access files in
546 // FileSystem API.
547 virtual void GetAdditionalAllowedSchemesForFileSystem(
548 std::vector<std::string>* additional_schemes) {}
550 // Returns auto mount handlers for URL requests for FileSystem APIs.
551 virtual void GetURLRequestAutoMountHandlers(
552 std::vector<storage::URLRequestAutoMountHandler>* handlers) {}
554 // Returns additional file system backends for FileSystem API.
555 // |browser_context| is needed in the additional FileSystemBackends.
556 // It has mount points to create objects returned by additional
557 // FileSystemBackends, and SpecialStoragePolicy for permission granting.
558 virtual void GetAdditionalFileSystemBackends(
559 BrowserContext* browser_context,
560 const base::FilePath& storage_partition_path,
561 ScopedVector<storage::FileSystemBackend>* additional_backends) {}
563 // Allows an embedder to return its own LocationProvider implementation.
564 // Return nullptr to use the default one for the platform to be created.
565 // FYI: Used by an external project; please don't remove.
566 // Contact Viatcheslav Ostapenko at sl.ostapenko@samsung.com for more
567 // information.
568 virtual LocationProvider* OverrideSystemLocationProvider();
570 // Creates a new DevToolsManagerDelegate. The caller owns the returned value.
571 // It's valid to return nullptr.
572 virtual DevToolsManagerDelegate* GetDevToolsManagerDelegate();
574 // Creates a new TracingDelegate. The caller owns the returned value.
575 // It's valid to return nullptr.
576 virtual TracingDelegate* GetTracingDelegate();
578 // Returns true if plugin referred to by the url can use
579 // pp::FileIO::RequestOSFileHandle.
580 virtual bool IsPluginAllowedToCallRequestOSFileHandle(
581 BrowserContext* browser_context,
582 const GURL& url);
584 // Returns true if dev channel APIs are available for plugins.
585 virtual bool IsPluginAllowedToUseDevChannelAPIs(
586 BrowserContext* browser_context,
587 const GURL& url);
589 // Returns a special cookie store to use for a given render process, or
590 // nullptr if the default cookie store should be used.
591 // This is called on the IO thread.
592 virtual net::CookieStore* OverrideCookieStoreForRenderProcess(
593 int render_process_id);
595 // Checks if |security_origin| has permission to access the microphone or
596 // camera. Note that this does not query the user. |type| must be
597 // MEDIA_DEVICE_AUDIO_CAPTURE or MEDIA_DEVICE_VIDEO_CAPTURE.
598 virtual bool CheckMediaAccessPermission(BrowserContext* browser_context,
599 const GURL& security_origin,
600 MediaStreamType type);
602 // Allows to override browser Mojo services exposed through the
603 // RenderProcessHost.
604 virtual void OverrideRenderProcessMojoServices(ServiceRegistry* registry) {}
606 // Registers additional navigator.connect service factories available in a
607 // particular NavigatorConnectContext.
608 virtual void GetAdditionalNavigatorConnectServices(
609 const scoped_refptr<NavigatorConnectContext>& context) {}
611 // Allows to override the visibility state of a RenderFrameHost.
612 // |visibility_state| should not be null. It will only be set if needed.
613 virtual void OverridePageVisibilityState(
614 RenderFrameHost* render_frame_host,
615 blink::WebPageVisibilityState* visibility_state) {}
617 // Allows an embedder to provide its own PresentationServiceDelegate
618 // implementation. Returns nullptr if unavailable.
619 virtual PresentationServiceDelegate* GetPresentationServiceDelegate(
620 WebContents* web_contents);
622 // Allows programmatic opening of a new tab/window without going through
623 // another WebContents. For example, from a Worker. |callback| will be
624 // invoked with the appropriate WebContents* when available.
625 virtual void OpenURL(BrowserContext* browser_context,
626 const OpenURLParams& params,
627 const base::Callback<void(WebContents*)>& callback);
629 // Allows the embedder to record |metric| for a specific |url|.
630 virtual void RecordURLMetric(const std::string& metric, const GURL& url) {}
632 #if defined(OS_POSIX) && !defined(OS_MACOSX)
633 // Populates |mappings| with all files that need to be mapped before launching
634 // a child process.
635 virtual void GetAdditionalMappedFilesForChildProcess(
636 const base::CommandLine& command_line,
637 int child_process_id,
638 FileDescriptorInfo* mappings) {}
639 #endif
641 #if defined(OS_WIN)
642 // Returns the name of the dll that contains cursors and other resources.
643 virtual const wchar_t* GetResourceDllName();
645 // This is called on the PROCESS_LAUNCHER thread before the renderer process
646 // is launched. It gives the embedder a chance to add loosen the sandbox
647 // policy.
648 virtual void PreSpawnRenderer(sandbox::TargetPolicy* policy,
649 bool* success) {}
650 #endif
652 #if defined(VIDEO_HOLE)
653 // Allows an embedder to provide its own ExternalVideoSurfaceContainer
654 // implementation. Return nullptr to disable external surface video.
655 virtual ExternalVideoSurfaceContainer*
656 OverrideCreateExternalVideoSurfaceContainer(WebContents* web_contents);
657 #endif
660 } // namespace content
662 #endif // CONTENT_PUBLIC_BROWSER_CONTENT_BROWSER_CLIENT_H_