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)>;
// - Define your new permission in the ContentSettingsType enum.
// - Create a class that inherits from PermissionContextBase and passes the
// new permission.
// - Inherit from PermissionInfobarDelegate and implement
// |GetMessageText|
// - Edit the PermissionRequestImpl methods to add the new text.
// - Hit several asserts for the missing plumbing and fix them :)
// After this you can override several other methods to customize behavior,
......@@ -70,9 +68,8 @@ class PermissionContextBase : public KeyedService {
// PermissionContextBase can use it.
static const char kPermissionsKillSwitchBlockedValue[];
// The renderer is requesting permission to push messages.
// When the answer to a permission request has been determined, |callback|
// should be called with the result.
// |callback| is called upon resolution of the request, but not if a prompt
// is shown and ignored.
virtual void RequestPermission(content::WebContents* web_contents,
const PermissionRequestID& id,
const GURL& requesting_frame,
......@@ -117,9 +114,8 @@ class PermissionContextBase : public KeyedService {
const GURL& requesting_origin,
const GURL& embedding_origin) const;
// Decide whether the permission should be granted.
// Calls PermissionDecided if permission can be decided non-interactively,
// or NotifyPermissionSet if permission decided by presenting an infobar.
// Called if generic checks (existing content setting, embargo, etc.) fail to
// resolve a permission request. The default implementation prompts the user.
virtual void DecidePermission(content::WebContents* web_contents,
const PermissionRequestID& id,
const GURL& requesting_origin,
......@@ -127,15 +123,8 @@ class PermissionContextBase : public KeyedService {
bool user_gesture,
const BrowserPermissionCallback& callback);
// Called when permission is granted without interactively asking the user.
void PermissionDecided(const PermissionRequestID& id,
const GURL& requesting_origin,
const GURL& embedding_origin,
bool user_gesture,
const BrowserPermissionCallback& callback,
bool persist,
ContentSetting content_setting);
// Updates stored content setting if persist is set, updates tab indicators
// and runs the callback to finish the request.
virtual void NotifyPermissionSet(const PermissionRequestID& id,
const GURL& requesting_origin,
const GURL& embedding_origin,
......@@ -185,6 +174,16 @@ class PermissionContextBase : public KeyedService {
const BrowserPermissionCallback& callback,
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
// descendent classes to do appropriate things they might need to do when this
// 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