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 10 matching lines...) Expand all Loading... |
21 | 21 |
22 typedef std::map<std::string, int> RestrictionMap; | 22 typedef std::map<std::string, int> RestrictionMap; |
23 | 23 |
24 struct Restrictions { | 24 struct Restrictions { |
25 Restrictions() { | 25 Restrictions() { |
26 // Base keys that all manifests can specify. | 26 // Base keys that all manifests can specify. |
27 map[keys::kName] = Manifest::kTypeAll; | 27 map[keys::kName] = Manifest::kTypeAll; |
28 map[keys::kVersion] = Manifest::kTypeAll; | 28 map[keys::kVersion] = Manifest::kTypeAll; |
29 map[keys::kManifestVersion] = Manifest::kTypeAll; | 29 map[keys::kManifestVersion] = Manifest::kTypeAll; |
30 map[keys::kDescription] = Manifest::kTypeAll; | 30 map[keys::kDescription] = Manifest::kTypeAll; |
| 31 map[keys::kCommands] = Manifest::kTypeAll; |
31 map[keys::kIcons] = Manifest::kTypeAll; | 32 map[keys::kIcons] = Manifest::kTypeAll; |
32 map[keys::kCurrentLocale] = Manifest::kTypeAll; | 33 map[keys::kCurrentLocale] = Manifest::kTypeAll; |
33 map[keys::kDefaultLocale] = Manifest::kTypeAll; | 34 map[keys::kDefaultLocale] = Manifest::kTypeAll; |
34 map[keys::kSignature] = Manifest::kTypeAll; | 35 map[keys::kSignature] = Manifest::kTypeAll; |
35 map[keys::kUpdateURL] = Manifest::kTypeAll; | 36 map[keys::kUpdateURL] = Manifest::kTypeAll; |
36 map[keys::kPublicKey] = Manifest::kTypeAll; | 37 map[keys::kPublicKey] = Manifest::kTypeAll; |
37 | 38 |
38 // Type specific. | 39 // Type specific. |
39 map[keys::kApp] = Manifest::kTypeHostedApp | Manifest::kTypePackagedApp | | 40 map[keys::kApp] = Manifest::kTypeHostedApp | Manifest::kTypePackagedApp | |
40 Manifest::kTypePlatformApp; | 41 Manifest::kTypePlatformApp; |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 227 |
227 bool Manifest::CanAccessPath(const std::string& path) const { | 228 bool Manifest::CanAccessPath(const std::string& path) const { |
228 std::vector<std::string> components; | 229 std::vector<std::string> components; |
229 base::SplitString(path, '.', &components); | 230 base::SplitString(path, '.', &components); |
230 | 231 |
231 const Restrictions& restrictions = g_restrictions.Get(); | 232 const Restrictions& restrictions = g_restrictions.Get(); |
232 return restrictions.CanAccessKey(components[0], GetType()); | 233 return restrictions.CanAccessKey(components[0], GetType()); |
233 } | 234 } |
234 | 235 |
235 } // namespace extensions | 236 } // namespace extensions |
OLD | NEW |