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

Unified Diff: extensions/common/manifest_handler.h

Issue 51433002: Enable permission warnings from ManifestHandlers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unit test and clang presubmit errors. Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/common/extensions_client.h ('k') | extensions/common/manifest_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/manifest_handler.h
diff --git a/extensions/common/manifest_handler.h b/extensions/common/manifest_handler.h
index fd7b571e33666830d3d2bb98c6c80b7a1e7a8c50..90fbe84998fa2f7d13f9881cb296cc7e8ed9a9c2 100644
--- a/extensions/common/manifest_handler.h
+++ b/extensions/common/manifest_handler.h
@@ -16,6 +16,8 @@
namespace extensions {
class Extension;
+class ManifestPermission;
+class ManifestPermissionSet;
// An interface for clients that recognize and parse keys in extension
// manifests.
@@ -64,6 +66,19 @@ class ManifestHandler {
// (new MyManifestHandler)->Register();
void Register();
+ // Creates a |ManifestPermission| instance for the given manifest key |name|.
+ // The returned permission does not contain any permission data, so this
+ // method is usually used before calling |FromValue| or |Read|. Returns
+ // |NULL| if the manifest handler does not support custom permissions.
+ virtual ManifestPermission* CreatePermission();
+
+ // Creates a |ManifestPermission| instance containing the initial set of
+ // required manifest permissions for the given |extension|. Returns |NULL| if
+ // the manifest handler does not support custom permissions or if there was
+ // no manifest key in the extension manifest for this handler.
+ virtual ManifestPermission* CreateInitialRequiredPermission(
+ const Extension* extension);
+
// Calling FinalizeRegistration indicates that there are no more
// manifest handlers to be registered.
static void FinalizeRegistration();
@@ -79,6 +94,20 @@ class ManifestHandler {
std::string* error,
std::vector<InstallWarning>* warnings);
+ // Calls |CreatePermission| on the manifest handler for |key|. Returns |NULL|
+ // if there is no manifest handler for |key| or if the manifest handler for
+ // |key| does not support custom permissions.
+ static ManifestPermission* CreatePermission(const std::string& key);
+
+ // Calls |CreateInitialRequiredPermission| on all registered manifest handlers
+ // and adds the returned permissions to |permission_set|. Note this should be
+ // called after all manifest data elements have been read, parsed and stored
+ // in the manifest data property of |extension|, as manifest handlers need
+ // access to their manifest data to initialize their required manifest
+ // permission.
+ static void AddExtensionInitialRequiredPermissions(
+ const Extension* extension, ManifestPermissionSet* permission_set);
+
protected:
// A convenience method for handlers that only register for 1 key,
// so that they can define keys() { return SingleKey(kKey); }
@@ -108,6 +137,12 @@ class ManifestHandlerRegistry {
std::string* error,
std::vector<InstallWarning>* warnings);
+ ManifestPermission* CreatePermission(const std::string& key);
+
+ void AddExtensionInitialRequiredPermissions(
+ const Extension* extension,
+ ManifestPermissionSet* permission_set);
+
// Overrides the current global ManifestHandlerRegistry with
// |registry|, returning the current one.
static ManifestHandlerRegistry* SetForTesting(
« no previous file with comments | « extensions/common/extensions_client.h ('k') | extensions/common/manifest_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698