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

Unified Diff: chrome/common/extensions/features/simple_feature.cc

Issue 15091002: Lazily load API schemas from resource files and convert all APIs to features (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 7 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/common/extensions/features/simple_feature.cc
diff --git a/chrome/common/extensions/features/simple_feature.cc b/chrome/common/extensions/features/simple_feature.cc
index 2d20787282b4ab89a20f2fff0c67849f45753734..56807ca12bef509aa3010fa000951cda7b9213a1 100644
--- a/chrome/common/extensions/features/simple_feature.cc
+++ b/chrome/common/extensions/features/simple_feature.cc
@@ -141,6 +141,7 @@ void ParseURLPatterns(const DictionaryValue* value,
URLPatternSet* set) {
const ListValue* matches = NULL;
if (value->GetList(key, &matches)) {
+ set->ClearPatterns();
for (size_t i = 0; i < matches->GetSize(); ++i) {
std::string pattern;
CHECK(matches->GetString(i, &pattern));
@@ -187,7 +188,8 @@ SimpleFeature::SimpleFeature()
platform_(UNSPECIFIED_PLATFORM),
min_manifest_version_(0),
max_manifest_version_(0),
- channel_(VersionInfo::CHANNEL_UNKNOWN) {
+ channel_(VersionInfo::CHANNEL_UNKNOWN),
+ has_parent_(false) {
}
SimpleFeature::SimpleFeature(const SimpleFeature& other)
@@ -199,7 +201,8 @@ SimpleFeature::SimpleFeature(const SimpleFeature& other)
platform_(other.platform_),
min_manifest_version_(other.min_manifest_version_),
max_manifest_version_(other.max_manifest_version_),
- channel_(other.channel_) {
+ channel_(other.channel_),
+ has_parent_(other.has_parent_) {
}
SimpleFeature::~SimpleFeature() {
@@ -214,7 +217,8 @@ bool SimpleFeature::Equals(const SimpleFeature& other) const {
platform_ == other.platform_ &&
min_manifest_version_ == other.min_manifest_version_ &&
max_manifest_version_ == other.max_manifest_version_ &&
- channel_ == other.channel_;
+ channel_ == other.channel_ &&
+ has_parent_ == other.has_parent_;
}
std::string SimpleFeature::Parse(const DictionaryValue* value) {
@@ -238,6 +242,7 @@ std::string SimpleFeature::Parse(const DictionaryValue* value) {
return name() + ": Allowing web_page contexts requires supplying a value " +
"for matches.";
}
+ has_parent_ = value->HasKey("parent");
return std::string();
}
@@ -288,7 +293,7 @@ Feature::Availability SimpleFeature::IsAvailableToManifest(
if (max_manifest_version_ != 0 && manifest_version > max_manifest_version_)
return CreateAvailability(INVALID_MAX_MANIFEST_VERSION, type);
- if (channel_ < Feature::GetCurrentChannel())
+ if (dependencies_.empty() && channel_ < Feature::GetCurrentChannel())
not at google - send to devlin 2013/05/24 19:09:18 why this change? if we're merging in our parent's
cduvall 2013/05/30 00:50:51 This is different than the parent features. This i
not at google - send to devlin 2013/05/30 16:38:51 Oh ok. I think I made a comment like this earlier
cduvall 2013/06/12 01:22:19 Done.
return CreateAvailability(UNSUPPORTED_CHANNEL, type);
return CreateAvailability(IS_AVAILABLE, type);
@@ -423,6 +428,10 @@ bool SimpleFeature::IsInternal() const {
return false;
}
+bool SimpleFeature::HasParent() const {
+ return has_parent_;
+}
+
bool SimpleFeature::IsIdInWhitelist(const std::string& extension_id) const {
// Belt-and-suspenders philosophy here. We should be pretty confident by this
// point that we've validated the extension ID format, but in case something

Powered by Google App Engine
This is Rietveld 408576698