| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "extensions/common/manifest.h" | 5 #include "extensions/common/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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 | 235 |
| 236 int Manifest::GetManifestVersion() const { | 236 int Manifest::GetManifestVersion() const { |
| 237 // Platform apps were launched after manifest version 2 was the preferred | 237 // Platform apps were launched after manifest version 2 was the preferred |
| 238 // version, so they default to that. | 238 // version, so they default to that. |
| 239 int manifest_version = type_ == TYPE_PLATFORM_APP ? 2 : 1; | 239 int manifest_version = type_ == TYPE_PLATFORM_APP ? 2 : 1; |
| 240 value_->GetInteger(keys::kManifestVersion, &manifest_version); | 240 value_->GetInteger(keys::kManifestVersion, &manifest_version); |
| 241 return manifest_version; | 241 return manifest_version; |
| 242 } | 242 } |
| 243 | 243 |
| 244 bool Manifest::CanAccessPath(const std::string& path) const { | 244 bool Manifest::CanAccessPath(const std::string& path) const { |
| 245 return true; |
| 245 std::vector<std::string> components; | 246 std::vector<std::string> components; |
| 246 base::SplitString(path, '.', &components); | 247 base::SplitString(path, '.', &components); |
| 247 std::string key; | 248 std::string key; |
| 248 for (size_t i = 0; i < components.size(); ++i) { | 249 for (size_t i = 0; i < components.size(); ++i) { |
| 249 key += components[i]; | 250 key += components[i]; |
| 250 if (!CanAccessKey(key)) | 251 if (!CanAccessKey(key)) |
| 251 return false; | 252 return false; |
| 252 key += '.'; | 253 key += '.'; |
| 253 } | 254 } |
| 254 return true; | 255 return true; |
| 255 } | 256 } |
| 256 | 257 |
| 257 bool Manifest::CanAccessKey(const std::string& key) const { | 258 bool Manifest::CanAccessKey(const std::string& key) const { |
| 258 Feature* feature = FeatureProvider::GetManifestFeatures()->GetFeature(key); | 259 Feature* feature = FeatureProvider::GetManifestFeatures()->GetFeature(key); |
| 259 if (!feature) | 260 if (!feature) |
| 260 return true; | 261 return true; |
| 261 | 262 |
| 262 return feature->IsAvailableToManifest( | 263 return feature->IsAvailableToManifest( |
| 263 extension_id_, type_, Feature::ConvertLocation(location_), | 264 extension_id_, type_, Feature::ConvertLocation(location_), |
| 264 GetManifestVersion()).is_available(); | 265 GetManifestVersion()).is_available(); |
| 265 } | 266 } |
| 266 | 267 |
| 267 } // namespace extensions | 268 } // namespace extensions |
| OLD | NEW |