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

Side by Side Diff: chrome/common/extensions/manifest.cc

Issue 22470007: Add a "key" entry to InstallWarnings, remove InstallWarning::Format (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dc_ec_infrastructure
Patch Set: Created 7 years, 4 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
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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 feature_name != feature_names.end(); ++feature_name) { 150 feature_name != feature_names.end(); ++feature_name) {
151 // Use Get instead of HasKey because the former uses path expansion. 151 // Use Get instead of HasKey because the former uses path expansion.
152 if (!value_->Get(*feature_name, NULL)) 152 if (!value_->Get(*feature_name, NULL))
153 continue; 153 continue;
154 154
155 Feature* feature = provider->GetFeature(*feature_name); 155 Feature* feature = provider->GetFeature(*feature_name);
156 Feature::Availability result = feature->IsAvailableToManifest( 156 Feature::Availability result = feature->IsAvailableToManifest(
157 extension_id_, type_, Feature::ConvertLocation(location_), 157 extension_id_, type_, Feature::ConvertLocation(location_),
158 GetManifestVersion()); 158 GetManifestVersion());
159 if (!result.is_available()) 159 if (!result.is_available())
160 warnings->push_back(InstallWarning( 160 warnings->push_back(InstallWarning(*feature_name, result.message()));
161 InstallWarning::FORMAT_TEXT, result.message()));
162 } 161 }
163 162
164 // Also generate warnings for keys that are not features. 163 // Also generate warnings for keys that are not features.
165 for (base::DictionaryValue::Iterator it(*value_); !it.IsAtEnd(); 164 for (base::DictionaryValue::Iterator it(*value_); !it.IsAtEnd();
166 it.Advance()) { 165 it.Advance()) {
167 if (!provider->GetFeature(it.key())) { 166 if (!provider->GetFeature(it.key())) {
168 warnings->push_back(InstallWarning( 167 warnings->push_back(InstallWarning(
169 InstallWarning::FORMAT_TEXT, 168 it.key(),
170 base::StringPrintf("Unrecognized manifest key '%s'.", 169 base::StringPrintf("Unrecognized manifest key '%s'.",
171 it.key().c_str()))); 170 it.key().c_str())));
172 } 171 }
173 } 172 }
174 return true; 173 return true;
175 } 174 }
176 175
177 bool Manifest::HasKey(const std::string& key) const { 176 bool Manifest::HasKey(const std::string& key) const {
178 return CanAccessKey(key) && value_->HasKey(key); 177 return CanAccessKey(key) && value_->HasKey(key);
179 } 178 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 Feature* feature = FeatureProvider::GetByName("manifest")->GetFeature(key); 253 Feature* feature = FeatureProvider::GetByName("manifest")->GetFeature(key);
255 if (!feature) 254 if (!feature)
256 return true; 255 return true;
257 256
258 return feature->IsAvailableToManifest( 257 return feature->IsAvailableToManifest(
259 extension_id_, type_, Feature::ConvertLocation(location_), 258 extension_id_, type_, Feature::ConvertLocation(location_),
260 GetManifestVersion()).is_available(); 259 GetManifestVersion()).is_available();
261 } 260 }
262 261
263 } // namespace extensions 262 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698