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

Unified Diff: chrome/common/extensions/api/extension_api.cc

Issue 14730002: Remove features code from ExtensionAPI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add CHECK back Created 7 years, 8 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 | « chrome/common/extensions/api/extension_api.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/api/extension_api.cc
diff --git a/chrome/common/extensions/api/extension_api.cc b/chrome/common/extensions/api/extension_api.cc
index 9862c5fa11854e42fc96c1c3122aea3d3db4d060..b158aa98ce371f60a63eb977bbbed5d13c81f47e 100644
--- a/chrome/common/extensions/api/extension_api.cc
+++ b/chrome/common/extensions/api/extension_api.cc
@@ -266,63 +266,6 @@ void ExtensionAPI::LoadSchema(const std::string& name,
HasUnprivilegedChild(schema, "properties")) {
partially_unprivileged_apis_.insert(schema_namespace);
}
-
- bool uses_feature_system = false;
- schema->GetBoolean("uses_feature_system", &uses_feature_system);
-
- if (!uses_feature_system) {
- // Populate |url_matching_apis_|.
- ListValue* matches = NULL;
- if (schema->GetList("matches", &matches)) {
- URLPatternSet pattern_set;
- for (size_t i = 0; i < matches->GetSize(); ++i) {
- std::string pattern;
- CHECK(matches->GetString(i, &pattern));
- pattern_set.AddPattern(
- URLPattern(UserScript::ValidUserScriptSchemes(), pattern));
- }
- url_matching_apis_[schema_namespace] = pattern_set;
- }
- continue;
- }
-
- // Populate feature maps.
- // TODO(aa): Consider not storing features that can never run on the current
- // machine (e.g., because of platform restrictions).
- SimpleFeature* feature = new SimpleFeature();
- feature->set_name(schema_namespace);
- feature->Parse(schema);
-
- FeatureMap* schema_features = new FeatureMap();
- CHECK(features_.insert(
- std::make_pair(schema_namespace,
- make_linked_ptr(schema_features))).second);
- CHECK(schema_features->insert(
- std::make_pair("", make_linked_ptr(feature))).second);
-
- for (size_t i = 0; i < arraysize(kChildKinds); ++i) {
- ListValue* child_list = NULL;
- schema->GetList(kChildKinds[i], &child_list);
- if (!child_list)
- continue;
-
- for (size_t j = 0; j < child_list->GetSize(); ++j) {
- DictionaryValue* child = NULL;
- CHECK(child_list->GetDictionary(j, &child));
-
- scoped_ptr<SimpleFeature> child_feature(new SimpleFeature(*feature));
- child_feature->Parse(child);
- if (child_feature->Equals(*feature))
- continue; // no need to store no-op features
-
- std::string child_name;
- CHECK(child->GetString("name", &child_name));
- child_feature->set_name(schema_namespace + "." + child_name);
- CHECK(schema_features->insert(
- std::make_pair(child_name,
- make_linked_ptr(child_feature.release()))).second);
- }
- }
}
}
@@ -565,11 +508,7 @@ bool ExtensionAPI::IsNonFeatureAPIAvailable(const std::string& name,
break;
case Feature::WEB_PAGE_CONTEXT:
- if (!url_matching_apis_.count(name))
- return false;
- CHECK(url.is_valid());
- // Availablility is determined by the url.
- return url_matching_apis_[name].MatchesURL(url);
+ return false;
}
return true;
@@ -610,8 +549,7 @@ std::string ExtensionAPI::GetAPINameFromFullName(const std::string& full_name,
std::string* child_name) {
std::string api_name_candidate = full_name;
while (true) {
- if (features_.find(api_name_candidate) != features_.end() ||
- schemas_.find(api_name_candidate) != schemas_.end() ||
+ if (schemas_.find(api_name_candidate) != schemas_.end() ||
unloaded_schemas_.find(api_name_candidate) != unloaded_schemas_.end()) {
std::string result = api_name_candidate;
« no previous file with comments | « chrome/common/extensions/api/extension_api.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698