Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: content/public/browser/content_browser_client.h

Issue 622793002: Group the different permission related methods in the content api. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/callback_forward.h" 13 #include "base/callback_forward.h"
14 #include "base/memory/linked_ptr.h" 14 #include "base/memory/linked_ptr.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/scoped_vector.h" 16 #include "base/memory/scoped_vector.h"
17 #include "base/values.h" 17 #include "base/values.h"
18 #include "content/public/browser/certificate_request_result_type.h" 18 #include "content/public/browser/certificate_request_result_type.h"
19 #include "content/public/browser/desktop_notification_delegate.h" 19 #include "content/public/browser/desktop_notification_delegate.h"
20 #include "content/public/browser/permission_type.h"
20 #include "content/public/common/content_client.h" 21 #include "content/public/common/content_client.h"
21 #include "content/public/common/media_stream_request.h" 22 #include "content/public/common/media_stream_request.h"
22 #include "content/public/common/resource_type.h" 23 #include "content/public/common/resource_type.h"
23 #include "content/public/common/socket_permission_request.h" 24 #include "content/public/common/socket_permission_request.h"
24 #include "content/public/common/window_container_type.h" 25 #include "content/public/common/window_container_type.h"
25 #include "net/base/mime_util.h" 26 #include "net/base/mime_util.h"
26 #include "net/cookies/canonical_cookie.h" 27 #include "net/cookies/canonical_cookie.h"
27 #include "net/url_request/url_request_interceptor.h" 28 #include "net/url_request/url_request_interceptor.h"
28 #include "net/url_request/url_request_job_factory.h" 29 #include "net/url_request/url_request_job_factory.h"
29 #include "storage/browser/fileapi/file_system_context.h" 30 #include "storage/browser/fileapi/file_system_context.h"
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 virtual void AddCertificate(net::CertificateMimeType cert_type, 411 virtual void AddCertificate(net::CertificateMimeType cert_type,
411 const void* cert_data, 412 const void* cert_data,
412 size_t cert_size, 413 size_t cert_size,
413 int render_process_id, 414 int render_process_id,
414 int render_frame_id) {} 415 int render_frame_id) {}
415 416
416 // Returns a class to get notifications about media event. The embedder can 417 // Returns a class to get notifications about media event. The embedder can
417 // return NULL if they're not interested. 418 // return NULL if they're not interested.
418 virtual MediaObserver* GetMediaObserver(); 419 virtual MediaObserver* GetMediaObserver();
419 420
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. 421 // Checks if the given page has permission to show desktop notifications.
428 // This is called on the IO thread. 422 // This is called on the IO thread.
429 virtual blink::WebNotificationPermission 423 virtual blink::WebNotificationPermission
430 CheckDesktopNotificationPermission( 424 CheckDesktopNotificationPermission(
431 const GURL& source_url, 425 const GURL& source_url,
432 ResourceContext* context, 426 ResourceContext* context,
433 int render_process_id); 427 int render_process_id);
434 428
435 // Show a desktop notification. If |cancel_callback| is non-null, it's set to 429 // 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. 430 // a callback which can be used to cancel the notification.
437 virtual void ShowDesktopNotification( 431 virtual void ShowDesktopNotification(
438 const ShowDesktopNotificationHostMsgParams& params, 432 const ShowDesktopNotificationHostMsgParams& params,
439 RenderFrameHost* render_frame_host, 433 RenderFrameHost* render_frame_host,
440 scoped_ptr<DesktopNotificationDelegate> delegate, 434 scoped_ptr<DesktopNotificationDelegate> delegate,
441 base::Closure* cancel_callback) {} 435 base::Closure* cancel_callback) {}
442 436
443 // The renderer is requesting permission to use Geolocation. When the answer 437 virtual void RequestPermission(
444 // to a permission request has been determined, |result_callback| should be 438 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, 439 WebContents* web_contents,
449 int bridge_id, 440 int bridge_id,
450 const GURL& requesting_frame, 441 const GURL& requesting_frame,
451 bool user_gesture, 442 bool user_gesture,
452 const base::Callback<void(bool)>& result_callback); 443 const base::Callback<void(bool)>& result_callback);
453 444
454 virtual void CancelGeolocationPermissionRequest( 445 virtual void CancelPermissionRequest(PermissionType permission,
455 WebContents* web_contents, 446 WebContents* web_contents,
456 int bridge_id, 447 int bridge_id,
457 const GURL& requesting_frame); 448 const GURL& requesting_frame) {}
458 449
459 // Invoked when the Geolocation API uses its permission. 450 virtual void RegisterPermissionUsage(PermissionType permission,
460 virtual void DidUseGeolocationPermission(WebContents* web_contents, 451 WebContents* web_contents,
461 const GURL& frame_url, 452 const GURL& frame_url,
462 const GURL& main_frame_url) {} 453 const GURL& main_frame_url) {}
463
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 454
485 // Returns true if the given page is allowed to open a window of the given 455 // 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 456 // type. If true is returned, |no_javascript_access| will indicate whether
487 // the window that is created should be scriptable/in the same process. 457 // the window that is created should be scriptable/in the same process.
488 // This is called on the IO thread. 458 // This is called on the IO thread.
489 virtual bool CanCreateWindow(const GURL& opener_url, 459 virtual bool CanCreateWindow(const GURL& opener_url,
490 const GURL& opener_top_level_frame_url, 460 const GURL& opener_top_level_frame_url,
491 const GURL& source_origin, 461 const GURL& source_origin,
492 WindowContainerType container_type, 462 WindowContainerType container_type,
493 const GURL& target_url, 463 const GURL& target_url,
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 // camera. Note that this does not query the user. |type| must be 622 // camera. Note that this does not query the user. |type| must be
653 // MEDIA_DEVICE_AUDIO_CAPTURE or MEDIA_DEVICE_VIDEO_CAPTURE. 623 // MEDIA_DEVICE_AUDIO_CAPTURE or MEDIA_DEVICE_VIDEO_CAPTURE.
654 virtual bool CheckMediaAccessPermission(BrowserContext* browser_context, 624 virtual bool CheckMediaAccessPermission(BrowserContext* browser_context,
655 const GURL& security_origin, 625 const GURL& security_origin,
656 MediaStreamType type); 626 MediaStreamType type);
657 }; 627 };
658 628
659 } // namespace content 629 } // namespace content
660 630
661 #endif // CONTENT_PUBLIC_BROWSER_CONTENT_BROWSER_CLIENT_H_ 631 #endif // CONTENT_PUBLIC_BROWSER_CONTENT_BROWSER_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698