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

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

Issue 22794012: Rename extension_manifest_keys namespace to extensions::manifest_keys. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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 | 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"
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"
14 #include "chrome/common/extensions/features/feature.h" 13 #include "chrome/common/extensions/features/feature.h"
15 #include "extensions/common/error_utils.h" 14 #include "extensions/common/error_utils.h"
16 #include "extensions/common/features/feature_provider.h" 15 #include "extensions/common/features/feature_provider.h"
17 #include "extensions/common/install_warning.h" 16 #include "extensions/common/install_warning.h"
18 17 #include "extensions/common/manifest_constants.h"
19 namespace errors = extension_manifest_errors;
20 namespace keys = extension_manifest_keys;
21 18
22 namespace extensions { 19 namespace extensions {
23 20
21 namespace keys = manifest_keys;
22
24 namespace { 23 namespace {
25 24
26 // Rank extension locations in a way that allows 25 // Rank extension locations in a way that allows
27 // Manifest::GetHigherPriorityLocation() to compare locations. 26 // Manifest::GetHigherPriorityLocation() to compare locations.
28 // An extension installed from two locations will have the location 27 // An extension installed from two locations will have the location
29 // with the higher rank, as returned by this function. The actual 28 // with the higher rank, as returned by this function. The actual
30 // integer values may change, and should never be persisted. 29 // integer values may change, and should never be persisted.
31 int GetLocationRank(Manifest::Location location) { 30 int GetLocationRank(Manifest::Location location) {
32 const int kInvalidRank = -1; 31 const int kInvalidRank = -1;
33 int rank = kInvalidRank; // Will CHECK that rank is not kInvalidRank. 32 int rank = kInvalidRank; // Will CHECK that rank is not kInvalidRank.
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 CHECK_NE(type_, TYPE_UNKNOWN); 123 CHECK_NE(type_, TYPE_UNKNOWN);
125 } 124 }
126 125
127 Manifest::~Manifest() { 126 Manifest::~Manifest() {
128 } 127 }
129 128
130 bool Manifest::ValidateManifest( 129 bool Manifest::ValidateManifest(
131 std::string* error, 130 std::string* error,
132 std::vector<InstallWarning>* warnings) const { 131 std::vector<InstallWarning>* warnings) const {
133 *error = ""; 132 *error = "";
134 if (type_ == Manifest::TYPE_PLATFORM_APP && GetManifestVersion() < 2) {
135 *error = errors::kPlatformAppNeedsManifestVersion2;
136 return false;
137 }
138 133
139 // Check every feature to see if its in the manifest. Note that this means 134 // Check every feature to see if its in the manifest. Note that this means
140 // we will ignore keys that are not features; we do this for forward 135 // we will ignore keys that are not features; we do this for forward
141 // compatibility. 136 // compatibility.
142 // TODO(aa): Consider having an error here in the case of strict error 137 // TODO(aa): Consider having an error here in the case of strict error
143 // checking to let developers know when they screw up. 138 // checking to let developers know when they screw up.
144 139
145 FeatureProvider* provider = FeatureProvider::GetByName("manifest"); 140 FeatureProvider* provider = FeatureProvider::GetByName("manifest");
146 const std::vector<std::string>& feature_names = 141 const std::vector<std::string>& feature_names =
147 provider->GetAllFeatureNames(); 142 provider->GetAllFeatureNames();
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 Feature* feature = FeatureProvider::GetByName("manifest")->GetFeature(key); 249 Feature* feature = FeatureProvider::GetByName("manifest")->GetFeature(key);
255 if (!feature) 250 if (!feature)
256 return true; 251 return true;
257 252
258 return feature->IsAvailableToManifest( 253 return feature->IsAvailableToManifest(
259 extension_id_, type_, Feature::ConvertLocation(location_), 254 extension_id_, type_, Feature::ConvertLocation(location_),
260 GetManifestVersion()).is_available(); 255 GetManifestVersion()).is_available();
261 } 256 }
262 257
263 } // namespace extensions 258 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/incognito_handler.cc ('k') | chrome/common/extensions/manifest_handlers/app_isolation_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698