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