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

Unified Diff: extensions/common/features/feature.h

Issue 2116293003: extensions: Generate hash of extension ID at a higher level Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « extensions/common/features/complex_feature_unittest.cc ('k') | extensions/common/features/feature.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/features/feature.h
diff --git a/extensions/common/features/feature.h b/extensions/common/features/feature.h
index b9f8073a020ea0d7b0028ded400f033ac75d699e..d82f9c8d91c39aa1db314958db22620c5690235f 100644
--- a/extensions/common/features/feature.h
+++ b/extensions/common/features/feature.h
@@ -9,8 +9,11 @@
#include <string>
#include "base/values.h"
+#include "components/crx_file/id_util.h"
#include "extensions/common/manifest.h"
+using crx_file::id_util::HashedIdInHex;
+
class GURL;
namespace extensions {
@@ -117,10 +120,12 @@ class Feature {
Manifest::Type type,
Manifest::Location location,
int manifest_version) const {
- return IsAvailableToManifest(extension_id, type, location, manifest_version,
+ return IsAvailableToManifest(extension_id, HashedIdInHex(extension_id),
+ type, location, manifest_version,
GetCurrentPlatform());
}
virtual Availability IsAvailableToManifest(const std::string& extension_id,
+ const std::string& hashed_id,
Manifest::Type type,
Manifest::Location location,
int manifest_version,
@@ -157,8 +162,18 @@ class Feature {
// method instead.
Availability IsAvailableToEnvironment() const;
- virtual bool IsIdInBlacklist(const std::string& extension_id) const = 0;
- virtual bool IsIdInWhitelist(const std::string& extension_id) const = 0;
+ bool IsIdInBlacklist(const std::string& extension_id) {
+ return IsIdInBlacklist(extension_id, HashedIdInHex(extension_id));
+ }
+
+ bool IsIdInWhitelist(const std::string& extension_id) {
+ return IsIdInWhitelist(extension_id, HashedIdInHex(extension_id));
+ }
+
+ virtual bool IsIdInBlacklist(const std::string& extension_id,
+ const std::string& hashed_id) const = 0;
+ virtual bool IsIdInWhitelist(const std::string& extension_id,
+ const std::string& hashed_id) const = 0;
protected:
std::string name_;
« no previous file with comments | « extensions/common/features/complex_feature_unittest.cc ('k') | extensions/common/features/feature.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698