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

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

Issue 11316164: Implement ComplexFeature to support permission features with multiple rules. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: new Created 8 years 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/common/extensions/features/feature.h
diff --git a/chrome/common/extensions/features/feature.h b/chrome/common/extensions/features/feature.h
index 41711835c9972685793281e50dfef9015090cb26..058c5b654c63e8f0e93452aa2709d2fa6e272912 100644
--- a/chrome/common/extensions/features/feature.h
+++ b/chrome/common/extensions/features/feature.h
@@ -83,9 +83,11 @@ class Feature {
const std::string message_;
};
- Feature();
- Feature(const Feature& other);
- virtual ~Feature();
+ Feature() {}
+ virtual ~Feature() {}
+
+ const std::string& name() const { return name_; }
+ void set_name(const std::string& name) { name_ = name; }
// Gets the current channel as seen by the Feature system.
static chrome::VersionInfo::Channel GetCurrentChannel();
@@ -115,42 +117,12 @@ class Feature {
chrome::VersionInfo::Channel original_channel_;
};
- const std::string& name() const { return name_; }
- void set_name(const std::string& name) { name_ = name; }
-
// Gets the platform the code is currently running on.
static Platform GetCurrentPlatform();
// Gets the Feature::Location value for the specified Extension::Location.
static Location ConvertLocation(Extension::Location extension_location);
- std::set<std::string>* whitelist() { return &whitelist_; }
- std::set<Extension::Type>* extension_types() { return &extension_types_; }
- std::set<Context>* contexts() { return &contexts_; }
-
- Location location() const { return location_; }
- void set_location(Location location) { location_ = location; }
-
- Platform platform() const { return platform_; }
- void set_platform(Platform platform) { platform_ = platform; }
-
- int min_manifest_version() const { return min_manifest_version_; }
- void set_min_manifest_version(int min_manifest_version) {
- min_manifest_version_ = min_manifest_version;
- }
-
- int max_manifest_version() const { return max_manifest_version_; }
- void set_max_manifest_version(int max_manifest_version) {
- max_manifest_version_ = max_manifest_version;
- }
-
- // Parses the JSON representation of a feature into the fields of this object.
- // Unspecified values in the JSON are not modified in the object. This allows
- // us to implement inheritance by parsing one value after another.
- void Parse(const DictionaryValue* value);
-
- // Returns true if the feature contains the same values as another.
- bool Equals(const Feature& other) const;
// Returns true if the feature is available to be parsed into a new extension
// manifest.
@@ -161,11 +133,11 @@ class Feature {
return IsAvailableToManifest(extension_id, type, location, manifest_version,
GetCurrentPlatform());
}
- Availability IsAvailableToManifest(const std::string& extension_id,
- Extension::Type type,
- Location location,
- int manifest_version,
- Platform platform) const;
+ virtual Availability IsAvailableToManifest(const std::string& extension_id,
+ Extension::Type type,
+ Location location,
+ int manifest_version,
+ Platform platform) const = 0;
// Returns true if the feature is available to be used in the specified
// extension and context.
@@ -175,31 +147,17 @@ class Feature {
}
virtual Availability IsAvailableToContext(const Extension* extension,
Context context,
- Platform platform) const;
+ Platform platform) const = 0;
protected:
Availability CreateAvailability(AvailabilityResult result) const;
Availability CreateAvailability(AvailabilityResult result,
Extension::Type type) const;
- private:
- std::string GetAvailabilityMessage(
- AvailabilityResult result, Extension::Type type) const;
+ virtual std::string GetAvailabilityMessage(
+ AvailabilityResult result, Extension::Type type) const = 0;
std::string name_;
-
- // For clarify and consistency, we handle the default value of each of these
- // members the same way: it matches everything. It is up to the higher level
- // code that reads Features out of static data to validate that data and set
- // sensible defaults.
- std::set<std::string> whitelist_;
- std::set<Extension::Type> extension_types_;
- std::set<Context> contexts_;
- Location location_; // we only care about component/not-component now
- Platform platform_; // we only care about chromeos/not-chromeos now
- int min_manifest_version_;
- int max_manifest_version_;
- chrome::VersionInfo::Channel channel_;
};
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698