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

Unified Diff: chrome/browser/chromeos/extensions/public_session_permission_helper.h

Issue 2858013002: PS - Showing permission prompt for activeTab (Closed)
Patch Set: Update a unittest (.mm) Created 3 years, 7 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: chrome/browser/chromeos/extensions/public_session_permission_helper.h
diff --git a/chrome/browser/chromeos/extensions/public_session_permission_helper.h b/chrome/browser/chromeos/extensions/public_session_permission_helper.h
index 445f879aa0fd10a2c2dff7658f0ade8e4c69fc84..251337fa470535a6e93929a37b774e52b6bd7fe6 100644
--- a/chrome/browser/chromeos/extensions/public_session_permission_helper.h
+++ b/chrome/browser/chromeos/extensions/public_session_permission_helper.h
@@ -37,7 +37,8 @@ using PromptFactory = base::Callback<std::unique_ptr<ExtensionInstallPrompt>(
//
// This function sets up the prompt asking the user for additional
// permission(s), handles the result, caches it, and then runs the callback with
-// the allowed permissions as the argument.
+// the allowed permissions as the argument. It returns true if this
+// permission(s) is already resolved, and false otherwise.
//
// The user will be prompted about a certain permission only once, and that
// choice will be cached and used in any subsequent requests that use the same
@@ -47,14 +48,21 @@ using PromptFactory = base::Callback<std::unique_ptr<ExtensionInstallPrompt>(
//
// Caller must ensure that web_contents is valid. Must be called on UI thread.
//
+// Callback can be null (permission_helper::RequestResolvedCallback()), in which
+// case it's not invoked but the permission prompt is still shown.
+//
// Passing in a null prompt_factory (permission_helper::PromptFactory())
// callback gets the default behaviour (ie. it is is used only for tests).
-void HandlePermissionRequest(const Extension& extension,
+bool HandlePermissionRequest(const Extension& extension,
const PermissionIDSet& requested_permissions,
content::WebContents* web_contents,
const RequestResolvedCallback& callback,
const PromptFactory& prompt_factory);
+// Returns true if user granted this permission to the extension.
+bool PermissionAllowed(const Extension* extension,
Devlin 2017/05/25 20:52:57 I wonder if instead of this, we should have Handle
Ivan Šandrk 2017/05/26 14:04:22 Quite a good idea, but one problem - HandlePermiss
Devlin 2017/05/26 14:49:51 Fair enough; this is fine. :)
+ APIPermission::ID permission);
+
// Used to completely reset state in between tests.
void ResetPermissionsForTesting();

Powered by Google App Engine
This is Rietveld 408576698