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