OLD | NEW |
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/string_split.h" | 10 #include "base/string_split.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 scoped_ptr<Feature> feature = | 31 scoped_ptr<Feature> feature = |
32 SimpleFeatureProvider::GetManifestFeatures()->GetFeature(*key); | 32 SimpleFeatureProvider::GetManifestFeatures()->GetFeature(*key); |
33 if (!feature.get()) { | 33 if (!feature.get()) { |
34 // When validating the extension manifests, we ignore keys that are not | 34 // When validating the extension manifests, we ignore keys that are not |
35 // recognized for forward compatibility. | 35 // recognized for forward compatibility. |
36 // TODO(aa): Consider having an error here in the case of strict error | 36 // TODO(aa): Consider having an error here in the case of strict error |
37 // checking to let developers know when they screw up. | 37 // checking to let developers know when they screw up. |
38 continue; | 38 continue; |
39 } | 39 } |
40 | 40 |
41 Feature::Availability result = feature->IsAvailable( | 41 Feature::Availability result = feature->IsAvailableToManifest( |
42 extension_id_, GetType(), Feature::ConvertLocation(location_), | 42 extension_id_, GetType(), Feature::ConvertLocation(location_), |
43 GetManifestVersion()); | 43 GetManifestVersion()); |
44 if (result != Feature::IS_AVAILABLE) { | 44 if (result != Feature::IS_AVAILABLE) { |
45 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( | 45 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( |
46 errors::kFeatureNotAllowed, | 46 errors::kFeatureNotAllowed, |
47 *key, | 47 *key, |
48 feature->GetErrorMessage(result)); | 48 feature->GetErrorMessage(result)); |
49 return false; | 49 return false; |
50 } | 50 } |
51 } | 51 } |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 base::SplitString(path, '.', &components); | 148 base::SplitString(path, '.', &components); |
149 return CanAccessKey(components[0]); | 149 return CanAccessKey(components[0]); |
150 } | 150 } |
151 | 151 |
152 bool Manifest::CanAccessKey(const std::string& key) const { | 152 bool Manifest::CanAccessKey(const std::string& key) const { |
153 scoped_ptr<Feature> feature = | 153 scoped_ptr<Feature> feature = |
154 SimpleFeatureProvider::GetManifestFeatures()->GetFeature(key); | 154 SimpleFeatureProvider::GetManifestFeatures()->GetFeature(key); |
155 if (!feature.get()) | 155 if (!feature.get()) |
156 return false; | 156 return false; |
157 | 157 |
158 return Feature::IS_AVAILABLE == feature->IsAvailable( | 158 return Feature::IS_AVAILABLE == feature->IsAvailableToManifest( |
159 extension_id_, GetType(), Feature::ConvertLocation(location_), | 159 extension_id_, GetType(), Feature::ConvertLocation(location_), |
160 GetManifestVersion()); | 160 GetManifestVersion()); |
161 } | 161 } |
162 | 162 |
163 } // namespace extensions | 163 } // namespace extensions |
OLD | NEW |