[Android WebView] Fix webview perf bot switchover to use org.chromium.webview_shell...
[chromium-blink-merge.git] / content / public / browser / content_browser_client.h
blob0a97ef27fbaac3e36a95c58c36a55be0f3f7733b
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/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"
34 #endif
36 #if defined(OS_POSIX)
37 #include "content/public/browser/file_descriptor_info.h"
38 #endif
40 class GURL;
42 namespace base {
43 class CommandLine;
44 class DictionaryValue;
45 class FilePath;
48 namespace blink {
49 struct WebWindowFeatures;
52 namespace gfx {
53 class ImageSkia;
56 namespace mojo {
57 class ApplicationDelegate;
60 namespace net {
61 class CookieOptions;
62 class NetLog;
63 class SSLCertRequestInfo;
64 class SSLInfo;
65 class URLRequest;
66 class URLRequestContext;
67 class URLRequestContextGetter;
68 class X509Certificate;
71 namespace sandbox {
72 class TargetPolicy;
75 namespace ui {
76 class SelectFilePolicy;
79 namespace storage {
80 class ExternalMountPoints;
81 class FileSystemBackend;
84 namespace content {
86 enum class PermissionType;
87 class AccessTokenStore;
88 class BrowserChildProcessHost;
89 class BrowserContext;
90 class BrowserMainParts;
91 class BrowserPluginGuestDelegate;
92 class BrowserPpapiHost;
93 class BrowserURLHandler;
94 class ClientCertificateDelegate;
95 class DevToolsManagerDelegate;
96 class ExternalVideoSurfaceContainer;
97 class LocationProvider;
98 class MediaObserver;
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;
109 class SiteInstance;
110 class SpeechRecognitionManagerDelegate;
111 class TracingDelegate;
112 class WebContents;
113 class WebContentsViewDelegate;
114 struct MainFunctionParams;
115 struct OpenURLParams;
116 struct Referrer;
117 struct WebPreferences;
119 // A mapping from the scheme name to the protocol handler that services its
120 // content.
121 typedef std::map<
122 std::string, linked_ptr<net::URLRequestJobFactory::ProtocolHandler> >
123 ProtocolHandlerMap;
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 {
138 public:
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
159 // own the delegate.
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,
174 const GURL& url);
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 a list additional WebUI schemes, if any. These additional schemes
182 // act as aliases to the chrome: scheme. The additional schemes may or may
183 // not serve specific WebUI pages depending on the particular URLDataSource
184 // and its override of URLDataSource::ShouldServiceRequest. For all schemes
185 // returned here, view-source is allowed.
186 virtual void GetAdditionalWebUISchemes(
187 std::vector<std::string>* additional_schemes) {}
189 // Returns a list of webUI hosts to ignore the storage partition check in
190 // URLRequestChromeJob::CheckStoragePartitionMatches.
191 virtual void GetAdditionalWebUIHostsToIgnoreParititionCheck(
192 std::vector<std::string>* hosts) {}
194 // Creates the main net::URLRequestContextGetter. Should only be called once
195 // per ContentBrowserClient object.
196 // TODO(ajwong): Remove once http://crbug.com/159193 is resolved.
197 virtual net::URLRequestContextGetter* CreateRequestContext(
198 BrowserContext* browser_context,
199 ProtocolHandlerMap* protocol_handlers,
200 URLRequestInterceptorScopedVector request_interceptors);
202 // Creates the net::URLRequestContextGetter for a StoragePartition. Should
203 // only be called once per partition_path per ContentBrowserClient object.
204 // TODO(ajwong): Remove once http://crbug.com/159193 is resolved.
205 virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition(
206 BrowserContext* browser_context,
207 const base::FilePath& partition_path,
208 bool in_memory,
209 ProtocolHandlerMap* protocol_handlers,
210 URLRequestInterceptorScopedVector request_interceptors);
212 // Returns whether a specified URL is handled by the embedder's internal
213 // protocol handlers.
214 virtual bool IsHandledURL(const GURL& url);
216 // Returns whether the given process is allowed to commit |url|. This is a
217 // more conservative check than IsSuitableHost, since it is used after a
218 // navigation has committed to ensure that the process did not exceed its
219 // authority.
220 virtual bool CanCommitURL(RenderProcessHost* process_host, const GURL& url);
222 // Returns whether a URL should be allowed to open from a specific context.
223 // This also applies in cases where the new URL will open in another process.
224 virtual bool ShouldAllowOpenURL(SiteInstance* site_instance, const GURL& url);
226 // Returns whether a new view for a given |site_url| can be launched in a
227 // given |process_host|.
228 virtual bool IsSuitableHost(RenderProcessHost* process_host,
229 const GURL& site_url);
231 // Returns whether a new view for a new site instance can be added to a
232 // given |process_host|.
233 virtual bool MayReuseHost(RenderProcessHost* process_host);
235 // Returns whether a new process should be created or an existing one should
236 // be reused based on the URL we want to load. This should return false,
237 // unless there is a good reason otherwise.
238 virtual bool ShouldTryToUseExistingProcessHost(
239 BrowserContext* browser_context, const GURL& url);
241 // Called when a site instance is first associated with a process.
242 virtual void SiteInstanceGotProcess(SiteInstance* site_instance) {}
244 // Called from a site instance's destructor.
245 virtual void SiteInstanceDeleting(SiteInstance* site_instance) {}
247 // Returns true if for the navigation from |current_url| to |new_url|
248 // in |site_instance|, a new SiteInstance and BrowsingInstance should be
249 // created (even if we are in a process model that doesn't usually swap.)
250 // This forces a process swap and severs script connections with existing
251 // tabs.
252 virtual bool ShouldSwapBrowsingInstancesForNavigation(
253 SiteInstance* site_instance,
254 const GURL& current_url,
255 const GURL& new_url);
257 // Returns true if the given navigation redirect should cause a renderer
258 // process swap.
259 // This is called on the IO thread.
260 virtual bool ShouldSwapProcessesForRedirect(ResourceContext* resource_context,
261 const GURL& current_url,
262 const GURL& new_url);
264 // Returns true if the passed in URL should be assigned as the site of the
265 // current SiteInstance, if it does not yet have a site.
266 virtual bool ShouldAssignSiteForURL(const GURL& url);
268 // See CharacterEncoding's comment.
269 virtual std::string GetCanonicalEncodingNameByAliasName(
270 const std::string& alias_name);
272 // Allows the embedder to pass extra command line flags.
273 // switches::kProcessType will already be set at this point.
274 virtual void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
275 int child_process_id) {}
277 // This is called on the process launching thread, when files that should be
278 // passed to the client have been opened. It allows command line switches to
279 // be added to tell the client where to find its files.
280 virtual void AppendMappedFileCommandLineSwitches(
281 base::CommandLine* command_line) {}
283 // Returns the locale used by the application.
284 // This is called on the UI and IO threads.
285 virtual std::string GetApplicationLocale();
287 // Returns the languages used in the Accept-Languages HTTP header.
288 // (Not called GetAcceptLanguages so it doesn't clash with win32).
289 virtual std::string GetAcceptLangs(BrowserContext* context);
291 // Returns the default favicon. The callee doesn't own the given bitmap.
292 virtual const gfx::ImageSkia* GetDefaultFavicon();
294 // Allow the embedder to control if an AppCache can be used for the given url.
295 // This is called on the IO thread.
296 virtual bool AllowAppCache(const GURL& manifest_url,
297 const GURL& first_party,
298 ResourceContext* context);
300 // Allow the embedder to control if a Service Worker can be associated
301 // with the given scope.
302 // This is called on the IO thread.
303 virtual bool AllowServiceWorker(const GURL& scope,
304 const GURL& first_party,
305 content::ResourceContext* context,
306 int render_process_id,
307 int render_frame_id);
309 // Allow the embedder to control if the given cookie can be read.
310 // This is called on the IO thread.
311 virtual bool AllowGetCookie(const GURL& url,
312 const GURL& first_party,
313 const net::CookieList& cookie_list,
314 ResourceContext* context,
315 int render_process_id,
316 int render_frame_id);
318 // Allow the embedder to control if the given cookie can be set.
319 // This is called on the IO thread.
320 virtual bool AllowSetCookie(const GURL& url,
321 const GURL& first_party,
322 const std::string& cookie_line,
323 ResourceContext* context,
324 int render_process_id,
325 int render_frame_id,
326 net::CookieOptions* options);
328 // This is called on the IO thread.
329 virtual bool AllowSaveLocalState(ResourceContext* context);
331 // Allow the embedder to control if access to web database by a shared worker
332 // is allowed. |render_frame| is a vector of pairs of
333 // RenderProcessID/RenderFrameID of RenderFrame that are using this worker.
334 // This is called on the IO thread.
335 virtual bool AllowWorkerDatabase(
336 const GURL& url,
337 const base::string16& name,
338 const base::string16& display_name,
339 unsigned long estimated_size,
340 ResourceContext* context,
341 const std::vector<std::pair<int, int> >& render_frames);
343 // Allow the embedder to control if access to file system by a shared worker
344 // is allowed.
345 // This is called on the IO thread.
346 virtual void AllowWorkerFileSystem(
347 const GURL& url,
348 ResourceContext* context,
349 const std::vector<std::pair<int, int> >& render_frames,
350 base::Callback<void(bool)> callback);
352 // Allow the embedder to control if access to IndexedDB by a shared worker
353 // is allowed.
354 // This is called on the IO thread.
355 virtual bool AllowWorkerIndexedDB(
356 const GURL& url,
357 const base::string16& name,
358 ResourceContext* context,
359 const std::vector<std::pair<int, int> >& render_frames);
361 // Allow the embedder to override the request context based on the URL for
362 // certain operations, like cookie access. Returns nullptr to indicate the
363 // regular request context should be used.
364 // This is called on the IO thread.
365 virtual net::URLRequestContext* OverrideRequestContextForURL(
366 const GURL& url, ResourceContext* context);
368 // Allow the embedder to specify a string version of the storage partition
369 // config with a site.
370 virtual std::string GetStoragePartitionIdForSite(
371 BrowserContext* browser_context,
372 const GURL& site);
374 // Allows the embedder to provide a validation check for |partition_id|s.
375 // This domain of valid entries should match the range of outputs for
376 // GetStoragePartitionIdForChildProcess().
377 virtual bool IsValidStoragePartitionId(BrowserContext* browser_context,
378 const std::string& partition_id);
380 // Allows the embedder to provide a storage parititon configuration for a
381 // site. A storage partition configuration includes a domain of the embedder's
382 // choice, an optional name within that domain, and whether the partition is
383 // in-memory only.
385 // If |can_be_default| is false, the caller is telling the embedder that the
386 // |site| is known to not be in the default partition. This is useful in
387 // some shutdown situations where the bookkeeping logic that maps sites to
388 // their partition configuration are no longer valid.
390 // The |partition_domain| is [a-z]* UTF-8 string, specifying the domain in
391 // which partitions live (similar to namespace). Within a domain, partitions
392 // can be uniquely identified by the combination of |partition_name| and
393 // |in_memory| values. When a partition is not to be persisted, the
394 // |in_memory| value must be set to true.
395 virtual void GetStoragePartitionConfigForSite(
396 BrowserContext* browser_context,
397 const GURL& site,
398 bool can_be_default,
399 std::string* partition_domain,
400 std::string* partition_name,
401 bool* in_memory);
403 // Create and return a new quota permission context.
404 virtual QuotaPermissionContext* CreateQuotaPermissionContext();
406 // Informs the embedder that a certificate error has occured. If
407 // |overridable| is true and if |strict_enforcement| is false, the user
408 // can ignore the error and continue. The embedder can call the callback
409 // asynchronously. If |result| is not set to
410 // CERTIFICATE_REQUEST_RESULT_TYPE_CONTINUE, the request will be cancelled
411 // or denied immediately, and the callback won't be run.
412 virtual void AllowCertificateError(int render_process_id,
413 int render_frame_id,
414 int cert_error,
415 const net::SSLInfo& ssl_info,
416 const GURL& request_url,
417 ResourceType resource_type,
418 bool overridable,
419 bool strict_enforcement,
420 bool expired_previous_decision,
421 const base::Callback<void(bool)>& callback,
422 CertificateRequestResultType* result) {}
424 // Selects a SSL client certificate and returns it to the |delegate|. Note:
425 // |delegate| may be called synchronously or asynchronously.
427 // TODO(davidben): Move this hook to WebContentsDelegate.
428 virtual void SelectClientCertificate(
429 WebContents* web_contents,
430 net::SSLCertRequestInfo* cert_request_info,
431 scoped_ptr<ClientCertificateDelegate> delegate);
433 // Adds a new installable certificate or private key.
434 // Typically used to install an X.509 user certificate.
435 // Note that it's up to the embedder to verify that the data is
436 // well-formed. |cert_data| will be nullptr if |cert_size| is 0.
437 virtual void AddCertificate(net::CertificateMimeType cert_type,
438 const void* cert_data,
439 size_t cert_size,
440 int render_process_id,
441 int render_frame_id) {}
443 // Returns a class to get notifications about media event. The embedder can
444 // return nullptr if they're not interested.
445 virtual MediaObserver* GetMediaObserver();
447 // Returns the platform notification service, capable of displaying Web
448 // Notifications to the user. The embedder can return a nullptr if they don't
449 // support this functionality. May be called from any thread.
450 virtual PlatformNotificationService* GetPlatformNotificationService();
452 // Returns true if the given page is allowed to open a window of the given
453 // type. If true is returned, |no_javascript_access| will indicate whether
454 // the window that is created should be scriptable/in the same process.
455 // This is called on the IO thread.
456 virtual bool CanCreateWindow(const GURL& opener_url,
457 const GURL& opener_top_level_frame_url,
458 const GURL& source_origin,
459 WindowContainerType container_type,
460 const GURL& target_url,
461 const Referrer& referrer,
462 WindowOpenDisposition disposition,
463 const blink::WebWindowFeatures& features,
464 bool user_gesture,
465 bool opener_suppressed,
466 ResourceContext* context,
467 int render_process_id,
468 int opener_render_view_id,
469 int opener_render_frame_id,
470 bool* no_javascript_access);
472 // Notifies the embedder that the ResourceDispatcherHost has been created.
473 // This is when it can optionally add a delegate.
474 virtual void ResourceDispatcherHostCreated() {}
476 // Allows the embedder to return a delegate for the SpeechRecognitionManager.
477 // The delegate will be owned by the manager. It's valid to return nullptr.
478 virtual SpeechRecognitionManagerDelegate*
479 CreateSpeechRecognitionManagerDelegate();
481 // Getters for common objects.
482 virtual net::NetLog* GetNetLog();
484 // Creates a new AccessTokenStore for gelocation.
485 virtual AccessTokenStore* CreateAccessTokenStore();
487 // Returns true if fast shutdown is possible.
488 virtual bool IsFastShutdownPossible();
490 // Called by WebContents to override the WebKit preferences that are used by
491 // the renderer. The content layer will add its own settings, and then it's up
492 // to the embedder to update it if it wants.
493 virtual void OverrideWebkitPrefs(RenderViewHost* render_view_host,
494 WebPreferences* prefs) {}
496 // Notifies that BrowserURLHandler has been created, so that the embedder can
497 // optionally add their own handlers.
498 virtual void BrowserURLHandlerCreated(BrowserURLHandler* handler) {}
500 // Clears browser cache.
501 virtual void ClearCache(RenderFrameHost* rfh) {}
503 // Clears browser cookies.
504 virtual void ClearCookies(RenderFrameHost* rfh) {}
506 // Returns the default download directory.
507 // This can be called on any thread.
508 virtual base::FilePath GetDefaultDownloadDirectory();
510 // Returns the default filename used in downloads when we have no idea what
511 // else we should do with the file.
512 virtual std::string GetDefaultDownloadName();
514 // Notification that a pepper plugin has just been spawned. This allows the
515 // embedder to add filters onto the host to implement interfaces.
516 // This is called on the IO thread.
517 virtual void DidCreatePpapiPlugin(BrowserPpapiHost* browser_host) {}
519 // Gets the host for an external out-of-process plugin.
520 virtual BrowserPpapiHost* GetExternalBrowserPpapiHost(
521 int plugin_child_id);
523 // Returns true if the socket operation specified by |params| is allowed from
524 // the given |browser_context| and |url|. If |params| is nullptr, this method
525 // checks the basic "socket" permission, which is for those operations that
526 // don't require a specific socket permission rule.
527 // |private_api| indicates whether this permission check is for the private
528 // Pepper socket API or the public one.
529 virtual bool AllowPepperSocketAPI(BrowserContext* browser_context,
530 const GURL& url,
531 bool private_api,
532 const SocketPermissionRequest* params);
534 // Returns an implementation of a file selecition policy. Can return nullptr.
535 virtual ui::SelectFilePolicy* CreateSelectFilePolicy(
536 WebContents* web_contents);
538 // Returns additional allowed scheme set which can access files in
539 // FileSystem API.
540 virtual void GetAdditionalAllowedSchemesForFileSystem(
541 std::vector<std::string>* additional_schemes) {}
543 // Returns auto mount handlers for URL requests for FileSystem APIs.
544 virtual void GetURLRequestAutoMountHandlers(
545 std::vector<storage::URLRequestAutoMountHandler>* handlers) {}
547 // Returns additional file system backends for FileSystem API.
548 // |browser_context| is needed in the additional FileSystemBackends.
549 // It has mount points to create objects returned by additional
550 // FileSystemBackends, and SpecialStoragePolicy for permission granting.
551 virtual void GetAdditionalFileSystemBackends(
552 BrowserContext* browser_context,
553 const base::FilePath& storage_partition_path,
554 ScopedVector<storage::FileSystemBackend>* additional_backends) {}
556 // Allows an embedder to return its own LocationProvider implementation.
557 // Return nullptr to use the default one for the platform to be created.
558 // FYI: Used by an external project; please don't remove.
559 // Contact Viatcheslav Ostapenko at sl.ostapenko@samsung.com for more
560 // information.
561 virtual LocationProvider* OverrideSystemLocationProvider();
563 // Creates a new DevToolsManagerDelegate. The caller owns the returned value.
564 // It's valid to return nullptr.
565 virtual DevToolsManagerDelegate* GetDevToolsManagerDelegate();
567 // Creates a new TracingDelegate. The caller owns the returned value.
568 // It's valid to return nullptr.
569 virtual TracingDelegate* GetTracingDelegate();
571 // Returns true if plugin referred to by the url can use
572 // pp::FileIO::RequestOSFileHandle.
573 virtual bool IsPluginAllowedToCallRequestOSFileHandle(
574 BrowserContext* browser_context,
575 const GURL& url);
577 // Returns true if dev channel APIs are available for plugins.
578 virtual bool IsPluginAllowedToUseDevChannelAPIs(
579 BrowserContext* browser_context,
580 const GURL& url);
582 // Allows to override browser Mojo services exposed through the
583 // RenderProcessHost.
584 virtual void OverrideRenderProcessMojoServices(ServiceRegistry* registry) {}
586 // Allows to override browser Mojo services exposed through the
587 // RenderFrameHost.
588 virtual void OverrideRenderFrameMojoServices(
589 ServiceRegistry* registry,
590 RenderFrameHost* render_frame_host) {}
592 using StaticMojoApplicationMap =
593 std::map<GURL, base::Callback<scoped_ptr<mojo::ApplicationDelegate>()>>;
595 // Registers in-process Mojo application loaders with the browser's global
596 // Mojo shell.
597 virtual void RegisterMojoApplications(StaticMojoApplicationMap* apps) {}
599 // Registers additional navigator.connect service factories available in a
600 // particular NavigatorConnectContext.
601 virtual void GetAdditionalNavigatorConnectServices(
602 const scoped_refptr<NavigatorConnectContext>& context) {}
604 // Allows to override the visibility state of a RenderFrameHost.
605 // |visibility_state| should not be null. It will only be set if needed.
606 virtual void OverridePageVisibilityState(
607 RenderFrameHost* render_frame_host,
608 blink::WebPageVisibilityState* visibility_state) {}
610 // Allows an embedder to provide its own PresentationServiceDelegate
611 // implementation. Returns nullptr if unavailable.
612 virtual PresentationServiceDelegate* GetPresentationServiceDelegate(
613 WebContents* web_contents);
615 // Allows programmatic opening of a new tab/window without going through
616 // another WebContents. For example, from a Worker. |callback| will be
617 // invoked with the appropriate WebContents* when available.
618 virtual void OpenURL(BrowserContext* browser_context,
619 const OpenURLParams& params,
620 const base::Callback<void(WebContents*)>& callback);
622 // Allows the embedder to record |metric| for a specific |url|.
623 virtual void RecordURLMetric(const std::string& metric, const GURL& url) {}
625 #if defined(OS_POSIX) && !defined(OS_MACOSX)
626 // Populates |mappings| with all files that need to be mapped before launching
627 // a child process.
628 virtual void GetAdditionalMappedFilesForChildProcess(
629 const base::CommandLine& command_line,
630 int child_process_id,
631 FileDescriptorInfo* mappings) {}
632 #endif
634 #if defined(OS_WIN)
635 // Returns the name of the dll that contains cursors and other resources.
636 virtual const wchar_t* GetResourceDllName();
638 // This is called on the PROCESS_LAUNCHER thread before the renderer process
639 // is launched. It gives the embedder a chance to add loosen the sandbox
640 // policy.
641 virtual void PreSpawnRenderer(sandbox::TargetPolicy* policy,
642 bool* success) {}
643 #endif
645 #if defined(VIDEO_HOLE)
646 // Allows an embedder to provide its own ExternalVideoSurfaceContainer
647 // implementation. Return nullptr to disable external surface video.
648 virtual ExternalVideoSurfaceContainer*
649 OverrideCreateExternalVideoSurfaceContainer(WebContents* web_contents);
650 #endif
653 } // namespace content
655 #endif // CONTENT_PUBLIC_BROWSER_CONTENT_BROWSER_CLIENT_H_