Commit 4030e58e authored by Timothy Loh's avatar Timothy Loh Committed by Commit Bot

Tidy up permission_context_base.h

This CL fixes some comments in permission_context_base.h which are
outdated or incorrect, and moves PermissionDecided from protected to
private.

Change-Id: I62ed3d82f46dc8680656c6072d9e45f4585197dd
Reviewed-on: https://chromium-review.googlesource.com/776493Reviewed-by: default avatarRaymes Khoury <raymes@chromium.org>
Commit-Queue: Timothy Loh <timloh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#517757}
parent 3587d94a
...@@ -42,8 +42,6 @@ using BrowserPermissionCallback = base::Callback<void(ContentSetting)>; ...@@ -42,8 +42,6 @@ using BrowserPermissionCallback = base::Callback<void(ContentSetting)>;
// - Define your new permission in the ContentSettingsType enum. // - Define your new permission in the ContentSettingsType enum.
// - Create a class that inherits from PermissionContextBase and passes the // - Create a class that inherits from PermissionContextBase and passes the
// new permission. // new permission.
// - Inherit from PermissionInfobarDelegate and implement
// |GetMessageText|
// - Edit the PermissionRequestImpl methods to add the new text. // - Edit the PermissionRequestImpl methods to add the new text.
// - Hit several asserts for the missing plumbing and fix them :) // - Hit several asserts for the missing plumbing and fix them :)
// After this you can override several other methods to customize behavior, // After this you can override several other methods to customize behavior,
...@@ -70,9 +68,8 @@ class PermissionContextBase : public KeyedService { ...@@ -70,9 +68,8 @@ class PermissionContextBase : public KeyedService {
// PermissionContextBase can use it. // PermissionContextBase can use it.
static const char kPermissionsKillSwitchBlockedValue[]; static const char kPermissionsKillSwitchBlockedValue[];
// The renderer is requesting permission to push messages. // |callback| is called upon resolution of the request, but not if a prompt
// When the answer to a permission request has been determined, |callback| // is shown and ignored.
// should be called with the result.
virtual void RequestPermission(content::WebContents* web_contents, virtual void RequestPermission(content::WebContents* web_contents,
const PermissionRequestID& id, const PermissionRequestID& id,
const GURL& requesting_frame, const GURL& requesting_frame,
...@@ -117,9 +114,8 @@ class PermissionContextBase : public KeyedService { ...@@ -117,9 +114,8 @@ class PermissionContextBase : public KeyedService {
const GURL& requesting_origin, const GURL& requesting_origin,
const GURL& embedding_origin) const; const GURL& embedding_origin) const;
// Decide whether the permission should be granted. // Called if generic checks (existing content setting, embargo, etc.) fail to
// Calls PermissionDecided if permission can be decided non-interactively, // resolve a permission request. The default implementation prompts the user.
// or NotifyPermissionSet if permission decided by presenting an infobar.
virtual void DecidePermission(content::WebContents* web_contents, virtual void DecidePermission(content::WebContents* web_contents,
const PermissionRequestID& id, const PermissionRequestID& id,
const GURL& requesting_origin, const GURL& requesting_origin,
...@@ -127,15 +123,8 @@ class PermissionContextBase : public KeyedService { ...@@ -127,15 +123,8 @@ class PermissionContextBase : public KeyedService {
bool user_gesture, bool user_gesture,
const BrowserPermissionCallback& callback); const BrowserPermissionCallback& callback);
// Called when permission is granted without interactively asking the user. // Updates stored content setting if persist is set, updates tab indicators
void PermissionDecided(const PermissionRequestID& id, // and runs the callback to finish the request.
const GURL& requesting_origin,
const GURL& embedding_origin,
bool user_gesture,
const BrowserPermissionCallback& callback,
bool persist,
ContentSetting content_setting);
virtual void NotifyPermissionSet(const PermissionRequestID& id, virtual void NotifyPermissionSet(const PermissionRequestID& id,
const GURL& requesting_origin, const GURL& requesting_origin,
const GURL& embedding_origin, const GURL& embedding_origin,
...@@ -185,6 +174,16 @@ class PermissionContextBase : public KeyedService { ...@@ -185,6 +174,16 @@ class PermissionContextBase : public KeyedService {
const BrowserPermissionCallback& callback, const BrowserPermissionCallback& callback,
bool permission_blocked); bool permission_blocked);
// This is the callback for PermissionRequestImpl and is called once the user
// allows/blocks/dismisses a permission prompt.
void PermissionDecided(const PermissionRequestID& id,
const GURL& requesting_origin,
const GURL& embedding_origin,
bool user_gesture,
const BrowserPermissionCallback& callback,
bool persist,
ContentSetting content_setting);
// Called when the user has made a permission decision. This is a hook for // Called when the user has made a permission decision. This is a hook for
// descendent classes to do appropriate things they might need to do when this // descendent classes to do appropriate things they might need to do when this
// happens. // happens.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment