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