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

Unified 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: Created 6 years, 2 months 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 side-by-side diff with in-line comments
Download patch
Index: content/public/browser/content_browser_client.h
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
index ac87e075ccc86f8dd5c521955eaeed1071a13852..0af8ead0f7aaa79d05ae2ff672007cc287baf82e 100644
--- a/content/public/browser/content_browser_client.h
+++ b/content/public/browser/content_browser_client.h
@@ -108,6 +108,22 @@ struct Referrer;
struct ShowDesktopNotificationHostMsgParams;
struct WebPreferences;
+
+// 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.
+// permission actions. Never delete or reorder an entry; only add new entries
+// immediately before PERMISSION_NUM
+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.
+ 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
+ PERMISSION_MIDI_SYSEX = 1,
+ PERMISSION_PUSH_MESSAGING = 2,
+ PERMISSION_NOTIFICATIONS = 3,
+ PERMISSION_GEOLOCATION = 4,
+ PERMISSION_PROTECTED_MEDIA = 5,
+
+ // Always keep this at the end.
+ PERMISSION_NUM,
+};
+
// A mapping from the scheme name to the protocol handler that services its
// content.
typedef std::map<
@@ -417,13 +433,6 @@ class CONTENT_EXPORT ContentBrowserClient {
// return NULL if they're not interested.
virtual MediaObserver* GetMediaObserver();
- // Asks permission to show desktop notifications. |callback| needs to be run
- // when the user approves the request.
- virtual void RequestDesktopNotificationPermission(
- const GURL& source_origin,
- RenderFrameHost* render_frame_host,
- const base::Callback<void(blink::WebNotificationPermission)>& callback) {}
-
// Checks if the given page has permission to show desktop notifications.
// This is called on the IO thread.
virtual blink::WebNotificationPermission
@@ -440,47 +449,26 @@ class CONTENT_EXPORT ContentBrowserClient {
scoped_ptr<DesktopNotificationDelegate> delegate,
base::Closure* cancel_callback) {}
- // The renderer is requesting permission to use Geolocation. When the answer
- // to a permission request has been determined, |result_callback| should be
- // called with the result. If |cancel_callback| is non-null, it's set to a
- // callback which can be used to cancel the permission request.
- virtual void RequestGeolocationPermission(
+ virtual void RequestPermission(
+ PermissionType permission,
WebContents* web_contents,
int bridge_id,
const GURL& requesting_frame,
bool user_gesture,
- const base::Callback<void(bool)>& result_callback);
+ const base::Callback<void(bool)>& result_callback) {}
- virtual void CancelGeolocationPermissionRequest(
- WebContents* web_contents,
- int bridge_id,
- const GURL& requesting_frame);
-
- // Invoked when the Geolocation API uses its permission.
- virtual void DidUseGeolocationPermission(WebContents* web_contents,
- const GURL& frame_url,
- const GURL& main_frame_url) {}
-
- // Requests a permission to use system exclusive messages in MIDI events.
- // |result_callback| will be invoked when the request is resolved. If
- // |cancel_callback| is non-null, it's set to a callback which can be used to
- // cancel the permission request.
- virtual void RequestMidiSysExPermission(
+
+ virtual void CancelPermissionRequest(
+ PermissionType permission,
WebContents* web_contents,
int bridge_id,
- const GURL& requesting_frame,
- bool user_gesture,
- base::Callback<void(bool)> result_callback,
- base::Closure* cancel_callback);
+ const GURL& requesting_frame) {}
+
+ virtual void RegisterPermissionUsage(PermissionType permission,
+ WebContents* web_contents,
+ const GURL& frame_url,
+ const GURL& main_frame_url) {}
- // Request permission to access protected media identifier. |result_callback
- // will tell whether it's permitted. If |cancel_callback| is non-null, it's
- // set to a callback which can be used to cancel the permission request.
- virtual void RequestProtectedMediaIdentifierPermission(
- WebContents* web_contents,
- const GURL& origin,
- base::Callback<void(bool)> result_callback,
- base::Closure* cancel_callback);
// Returns true if the given page is allowed to open a window of the given
// type. If true is returned, |no_javascript_access| will indicate whether

Powered by Google App Engine
This is Rietveld 408576698