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

Side by Side Diff: chrome/common/extensions/manifest.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: fix chromeos tests Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/common/extensions/manifest.h" 5 #include "chrome/common/extensions/manifest.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 return false; 135 return false;
136 } 136 }
137 137
138 // Check every feature to see if its in the manifest. Note that this means 138 // Check every feature to see if its in the manifest. Note that this means
139 // we will ignore keys that are not features; we do this for forward 139 // we will ignore keys that are not features; we do this for forward
140 // compatibility. 140 // compatibility.
141 // TODO(aa): Consider having an error here in the case of strict error 141 // TODO(aa): Consider having an error here in the case of strict error
142 // checking to let developers know when they screw up. 142 // checking to let developers know when they screw up.
143 143
144 FeatureProvider* provider = BaseFeatureProvider::GetByName("manifest"); 144 FeatureProvider* provider = BaseFeatureProvider::GetByName("manifest");
145 std::set<std::string> feature_names = provider->GetAllFeatureNames(); 145 const std::vector<std::string>& feature_names =
146 for (std::set<std::string>::iterator feature_name = feature_names.begin(); 146 provider->GetAllFeatureNames();
147 for (std::vector<std::string>::const_iterator feature_name =
148 feature_names.begin();
147 feature_name != feature_names.end(); ++feature_name) { 149 feature_name != feature_names.end(); ++feature_name) {
148 // Use Get instead of HasKey because the former uses path expansion. 150 // Use Get instead of HasKey because the former uses path expansion.
149 if (!value_->Get(*feature_name, NULL)) 151 if (!value_->Get(*feature_name, NULL))
150 continue; 152 continue;
151 153
152 Feature* feature = provider->GetFeature(*feature_name); 154 Feature* feature = provider->GetFeature(*feature_name);
153 Feature::Availability result = feature->IsAvailableToManifest( 155 Feature::Availability result = feature->IsAvailableToManifest(
154 extension_id_, type_, Feature::ConvertLocation(location_), 156 extension_id_, type_, Feature::ConvertLocation(location_),
155 GetManifestVersion()); 157 GetManifestVersion());
156 if (!result.is_available()) 158 if (!result.is_available())
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 BaseFeatureProvider::GetByName("manifest")->GetFeature(key); 254 BaseFeatureProvider::GetByName("manifest")->GetFeature(key);
253 if (!feature) 255 if (!feature)
254 return true; 256 return true;
255 257
256 return feature->IsAvailableToManifest( 258 return feature->IsAvailableToManifest(
257 extension_id_, type_, Feature::ConvertLocation(location_), 259 extension_id_, type_, Feature::ConvertLocation(location_),
258 GetManifestVersion()).is_available(); 260 GetManifestVersion()).is_available();
259 } 261 }
260 262
261 } // namespace extensions 263 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/features/simple_feature_unittest.cc ('k') | chrome/renderer/extensions/api_definitions_natives.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698