OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_PUBLIC_BROWSER_CONTENT_BROWSER_CLIENT_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_CONTENT_BROWSER_CLIENT_H_ |
6 #define CONTENT_PUBLIC_BROWSER_CONTENT_BROWSER_CLIENT_H_ | 6 #define CONTENT_PUBLIC_BROWSER_CONTENT_BROWSER_CLIENT_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 class SiteInstance; | 101 class SiteInstance; |
102 class SpeechRecognitionManagerDelegate; | 102 class SpeechRecognitionManagerDelegate; |
103 class VibrationProvider; | 103 class VibrationProvider; |
104 class WebContents; | 104 class WebContents; |
105 class WebContentsViewDelegate; | 105 class WebContentsViewDelegate; |
106 struct MainFunctionParams; | 106 struct MainFunctionParams; |
107 struct Referrer; | 107 struct Referrer; |
108 struct ShowDesktopNotificationHostMsgParams; | 108 struct ShowDesktopNotificationHostMsgParams; |
109 struct WebPreferences; | 109 struct WebPreferences; |
110 | 110 |
111 | |
112 // Enum for UMA purposes, make sure you update histograms.xml if you add new | |
Bernhard Bauer
2014/10/20 14:57:24
This enum is now for more than just UMA.
Miguel Garcia
2014/10/21 17:17:12
Acknowledged.
| |
113 // permission actions. Never delete or reorder an entry; only add new entries | |
114 // immediately before PERMISSION_NUM | |
115 enum PermissionType { | |
jam
2014/10/20 20:13:57
this should go into a separate file in content/pub
Miguel Garcia
2014/10/21 17:17:12
Done.
| |
116 PERMISSION_UNKNOWN = 0, | |
jam
2014/10/20 20:13:57
why is unknown needed?
Miguel Garcia
2014/10/21 17:17:12
It is not really needed but UMA expects it so I'd
Bernhard Bauer
2014/10/23 08:38:01
Why does UMA expect it? The only reference I can f
Miguel Garcia
2014/10/23 12:48:11
Bernhard explained that the one exception to the r
| |
117 PERMISSION_MIDI_SYSEX = 1, | |
118 PERMISSION_PUSH_MESSAGING = 2, | |
119 PERMISSION_NOTIFICATIONS = 3, | |
120 PERMISSION_GEOLOCATION = 4, | |
121 PERMISSION_PROTECTED_MEDIA = 5, | |
122 | |
123 // Always keep this at the end. | |
124 PERMISSION_NUM, | |
125 }; | |
126 | |
111 // A mapping from the scheme name to the protocol handler that services its | 127 // A mapping from the scheme name to the protocol handler that services its |
112 // content. | 128 // content. |
113 typedef std::map< | 129 typedef std::map< |
114 std::string, linked_ptr<net::URLRequestJobFactory::ProtocolHandler> > | 130 std::string, linked_ptr<net::URLRequestJobFactory::ProtocolHandler> > |
115 ProtocolHandlerMap; | 131 ProtocolHandlerMap; |
116 | 132 |
117 // A scoped vector of protocol interceptors. | 133 // A scoped vector of protocol interceptors. |
118 typedef ScopedVector<net::URLRequestInterceptor> | 134 typedef ScopedVector<net::URLRequestInterceptor> |
119 URLRequestInterceptorScopedVector; | 135 URLRequestInterceptorScopedVector; |
120 | 136 |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
410 virtual void AddCertificate(net::CertificateMimeType cert_type, | 426 virtual void AddCertificate(net::CertificateMimeType cert_type, |
411 const void* cert_data, | 427 const void* cert_data, |
412 size_t cert_size, | 428 size_t cert_size, |
413 int render_process_id, | 429 int render_process_id, |
414 int render_frame_id) {} | 430 int render_frame_id) {} |
415 | 431 |
416 // Returns a class to get notifications about media event. The embedder can | 432 // Returns a class to get notifications about media event. The embedder can |
417 // return NULL if they're not interested. | 433 // return NULL if they're not interested. |
418 virtual MediaObserver* GetMediaObserver(); | 434 virtual MediaObserver* GetMediaObserver(); |
419 | 435 |
420 // Asks permission to show desktop notifications. |callback| needs to be run | |
421 // when the user approves the request. | |
422 virtual void RequestDesktopNotificationPermission( | |
423 const GURL& source_origin, | |
424 RenderFrameHost* render_frame_host, | |
425 const base::Callback<void(blink::WebNotificationPermission)>& callback) {} | |
426 | |
427 // Checks if the given page has permission to show desktop notifications. | 436 // Checks if the given page has permission to show desktop notifications. |
428 // This is called on the IO thread. | 437 // This is called on the IO thread. |
429 virtual blink::WebNotificationPermission | 438 virtual blink::WebNotificationPermission |
430 CheckDesktopNotificationPermission( | 439 CheckDesktopNotificationPermission( |
431 const GURL& source_url, | 440 const GURL& source_url, |
432 ResourceContext* context, | 441 ResourceContext* context, |
433 int render_process_id); | 442 int render_process_id); |
434 | 443 |
435 // Show a desktop notification. If |cancel_callback| is non-null, it's set to | 444 // Show a desktop notification. If |cancel_callback| is non-null, it's set to |
436 // a callback which can be used to cancel the notification. | 445 // a callback which can be used to cancel the notification. |
437 virtual void ShowDesktopNotification( | 446 virtual void ShowDesktopNotification( |
438 const ShowDesktopNotificationHostMsgParams& params, | 447 const ShowDesktopNotificationHostMsgParams& params, |
439 RenderFrameHost* render_frame_host, | 448 RenderFrameHost* render_frame_host, |
440 scoped_ptr<DesktopNotificationDelegate> delegate, | 449 scoped_ptr<DesktopNotificationDelegate> delegate, |
441 base::Closure* cancel_callback) {} | 450 base::Closure* cancel_callback) {} |
442 | 451 |
443 // The renderer is requesting permission to use Geolocation. When the answer | 452 virtual void RequestPermission( |
444 // to a permission request has been determined, |result_callback| should be | 453 PermissionType permission, |
445 // called with the result. If |cancel_callback| is non-null, it's set to a | |
446 // callback which can be used to cancel the permission request. | |
447 virtual void RequestGeolocationPermission( | |
448 WebContents* web_contents, | 454 WebContents* web_contents, |
449 int bridge_id, | 455 int bridge_id, |
450 const GURL& requesting_frame, | 456 const GURL& requesting_frame, |
451 bool user_gesture, | 457 bool user_gesture, |
452 const base::Callback<void(bool)>& result_callback); | 458 const base::Callback<void(bool)>& result_callback) {} |
453 | 459 |
454 virtual void CancelGeolocationPermissionRequest( | 460 |
461 virtual void CancelPermissionRequest( | |
462 PermissionType permission, | |
455 WebContents* web_contents, | 463 WebContents* web_contents, |
456 int bridge_id, | 464 int bridge_id, |
457 const GURL& requesting_frame); | 465 const GURL& requesting_frame) {} |
458 | 466 |
459 // Invoked when the Geolocation API uses its permission. | 467 virtual void RegisterPermissionUsage(PermissionType permission, |
460 virtual void DidUseGeolocationPermission(WebContents* web_contents, | 468 WebContents* web_contents, |
461 const GURL& frame_url, | 469 const GURL& frame_url, |
462 const GURL& main_frame_url) {} | 470 const GURL& main_frame_url) {} |
463 | 471 |
464 // Requests a permission to use system exclusive messages in MIDI events. | |
465 // |result_callback| will be invoked when the request is resolved. If | |
466 // |cancel_callback| is non-null, it's set to a callback which can be used to | |
467 // cancel the permission request. | |
468 virtual void RequestMidiSysExPermission( | |
469 WebContents* web_contents, | |
470 int bridge_id, | |
471 const GURL& requesting_frame, | |
472 bool user_gesture, | |
473 base::Callback<void(bool)> result_callback, | |
474 base::Closure* cancel_callback); | |
475 | |
476 // Request permission to access protected media identifier. |result_callback | |
477 // will tell whether it's permitted. If |cancel_callback| is non-null, it's | |
478 // set to a callback which can be used to cancel the permission request. | |
479 virtual void RequestProtectedMediaIdentifierPermission( | |
480 WebContents* web_contents, | |
481 const GURL& origin, | |
482 base::Callback<void(bool)> result_callback, | |
483 base::Closure* cancel_callback); | |
484 | 472 |
485 // Returns true if the given page is allowed to open a window of the given | 473 // Returns true if the given page is allowed to open a window of the given |
486 // type. If true is returned, |no_javascript_access| will indicate whether | 474 // type. If true is returned, |no_javascript_access| will indicate whether |
487 // the window that is created should be scriptable/in the same process. | 475 // the window that is created should be scriptable/in the same process. |
488 // This is called on the IO thread. | 476 // This is called on the IO thread. |
489 virtual bool CanCreateWindow(const GURL& opener_url, | 477 virtual bool CanCreateWindow(const GURL& opener_url, |
490 const GURL& opener_top_level_frame_url, | 478 const GURL& opener_top_level_frame_url, |
491 const GURL& source_origin, | 479 const GURL& source_origin, |
492 WindowContainerType container_type, | 480 WindowContainerType container_type, |
493 const GURL& target_url, | 481 const GURL& target_url, |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
652 // camera. Note that this does not query the user. |type| must be | 640 // camera. Note that this does not query the user. |type| must be |
653 // MEDIA_DEVICE_AUDIO_CAPTURE or MEDIA_DEVICE_VIDEO_CAPTURE. | 641 // MEDIA_DEVICE_AUDIO_CAPTURE or MEDIA_DEVICE_VIDEO_CAPTURE. |
654 virtual bool CheckMediaAccessPermission(BrowserContext* browser_context, | 642 virtual bool CheckMediaAccessPermission(BrowserContext* browser_context, |
655 const GURL& security_origin, | 643 const GURL& security_origin, |
656 MediaStreamType type); | 644 MediaStreamType type); |
657 }; | 645 }; |
658 | 646 |
659 } // namespace content | 647 } // namespace content |
660 | 648 |
661 #endif // CONTENT_PUBLIC_BROWSER_CONTENT_BROWSER_CLIENT_H_ | 649 #endif // CONTENT_PUBLIC_BROWSER_CONTENT_BROWSER_CLIENT_H_ |
OLD | NEW |