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