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

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

Issue 22938005: Add ErrorConsole UI for Extension Install Warnings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dc_ec_install_warnings
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"
11 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "chrome/common/extensions/extension_manifest_constants.h"
13 #include "chrome/common/extensions/features/feature.h" 14 #include "chrome/common/extensions/features/feature.h"
14 #include "extensions/common/error_utils.h" 15 #include "extensions/common/error_utils.h"
15 #include "extensions/common/features/feature_provider.h" 16 #include "extensions/common/features/feature_provider.h"
16 #include "extensions/common/install_warning.h" 17 #include "extensions/common/install_warning.h"
17 #include "extensions/common/manifest_constants.h" 18 #include "extensions/common/manifest_constants.h"
18 19
19 namespace extensions { 20 namespace extensions {
20 21
21 namespace keys = manifest_keys; 22 namespace keys = manifest_keys;
22 23
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 GetManifestVersion()); 154 GetManifestVersion());
154 if (!result.is_available()) 155 if (!result.is_available())
155 warnings->push_back(InstallWarning(result.message(), *feature_name)); 156 warnings->push_back(InstallWarning(result.message(), *feature_name));
156 } 157 }
157 158
158 // Also generate warnings for keys that are not features. 159 // Also generate warnings for keys that are not features.
159 for (base::DictionaryValue::Iterator it(*value_); !it.IsAtEnd(); 160 for (base::DictionaryValue::Iterator it(*value_); !it.IsAtEnd();
160 it.Advance()) { 161 it.Advance()) {
161 if (!provider->GetFeature(it.key())) { 162 if (!provider->GetFeature(it.key())) {
162 warnings->push_back(InstallWarning( 163 warnings->push_back(InstallWarning(
163 base::StringPrintf("Unrecognized manifest key '%s'.", 164 ErrorUtils::FormatErrorMessage(
164 it.key().c_str()), 165 extension_manifest_errors::kUnrecognizedManifestKey, it.key()),
165 it.key())); 166 it.key()));
166 } 167 }
167 } 168 }
168 return true; 169 return true;
169 } 170 }
170 171
171 bool Manifest::HasKey(const std::string& key) const { 172 bool Manifest::HasKey(const std::string& key) const {
172 return CanAccessKey(key) && value_->HasKey(key); 173 return CanAccessKey(key) && value_->HasKey(key);
173 } 174 }
174 175
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 Feature* feature = FeatureProvider::GetByName("manifest")->GetFeature(key); 249 Feature* feature = FeatureProvider::GetByName("manifest")->GetFeature(key);
249 if (!feature) 250 if (!feature)
250 return true; 251 return true;
251 252
252 return feature->IsAvailableToManifest( 253 return feature->IsAvailableToManifest(
253 extension_id_, type_, Feature::ConvertLocation(location_), 254 extension_id_, type_, Feature::ConvertLocation(location_),
254 GetManifestVersion()).is_available(); 255 GetManifestVersion()).is_available();
255 } 256 }
256 257
257 } // namespace extensions 258 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698