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 #ifndef CHROME_COMMON_EXTENSIONS_MANIFEST_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_MANIFEST_H_ |
6 #define CHROME_COMMON_EXTENSIONS_MANIFEST_H_ | 6 #define CHROME_COMMON_EXTENSIONS_MANIFEST_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <set> | 10 #include <set> |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // as this is used in UMA_HISTOGRAM_ENUMERATIONs about extensions. | 48 // as this is used in UMA_HISTOGRAM_ENUMERATIONs about extensions. |
49 enum Type { | 49 enum Type { |
50 TYPE_UNKNOWN = 0, | 50 TYPE_UNKNOWN = 0, |
51 TYPE_EXTENSION, | 51 TYPE_EXTENSION, |
52 TYPE_THEME, | 52 TYPE_THEME, |
53 TYPE_USER_SCRIPT, | 53 TYPE_USER_SCRIPT, |
54 TYPE_HOSTED_APP, | 54 TYPE_HOSTED_APP, |
55 // This is marked legacy because platform apps are preferred. For | 55 // This is marked legacy because platform apps are preferred. For |
56 // backwards compatibility, we can't remove support for packaged apps | 56 // backwards compatibility, we can't remove support for packaged apps |
57 TYPE_LEGACY_PACKAGED_APP, | 57 TYPE_LEGACY_PACKAGED_APP, |
58 TYPE_PLATFORM_APP | 58 TYPE_PLATFORM_APP, |
| 59 TYPE_SHARED_MODULE |
59 }; | 60 }; |
60 | 61 |
61 // Given two install sources, return the one which should take priority | 62 // Given two install sources, return the one which should take priority |
62 // over the other. If an extension is installed from two sources A and B, | 63 // over the other. If an extension is installed from two sources A and B, |
63 // its install source should be set to GetHigherPriorityLocation(A, B). | 64 // its install source should be set to GetHigherPriorityLocation(A, B). |
64 static Location GetHigherPriorityLocation(Location loc1, Location loc2); | 65 static Location GetHigherPriorityLocation(Location loc1, Location loc2); |
65 | 66 |
66 // Whether the |location| is external or not. | 67 // Whether the |location| is external or not. |
67 static inline bool IsExternalLocation(Location location) { | 68 static inline bool IsExternalLocation(Location location) { |
68 return location == EXTERNAL_PREF || | 69 return location == EXTERNAL_PREF || |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 bool is_theme() const { return type_ == TYPE_THEME; } | 116 bool is_theme() const { return type_ == TYPE_THEME; } |
116 bool is_app() const { | 117 bool is_app() const { |
117 return is_legacy_packaged_app() || is_hosted_app() || is_platform_app(); | 118 return is_legacy_packaged_app() || is_hosted_app() || is_platform_app(); |
118 } | 119 } |
119 bool is_platform_app() const { return type_ == TYPE_PLATFORM_APP; } | 120 bool is_platform_app() const { return type_ == TYPE_PLATFORM_APP; } |
120 bool is_hosted_app() const { return type_ == TYPE_HOSTED_APP; } | 121 bool is_hosted_app() const { return type_ == TYPE_HOSTED_APP; } |
121 bool is_legacy_packaged_app() const { | 122 bool is_legacy_packaged_app() const { |
122 return type_ == TYPE_LEGACY_PACKAGED_APP; | 123 return type_ == TYPE_LEGACY_PACKAGED_APP; |
123 } | 124 } |
124 bool is_extension() const { return type_ == TYPE_EXTENSION; } | 125 bool is_extension() const { return type_ == TYPE_EXTENSION; } |
| 126 bool is_shared_module() const { return type_ == TYPE_SHARED_MODULE; } |
125 | 127 |
126 // These access the wrapped manifest value, returning false when the property | 128 // These access the wrapped manifest value, returning false when the property |
127 // does not exist or if the manifest type can't access it. | 129 // does not exist or if the manifest type can't access it. |
128 bool HasKey(const std::string& key) const; | 130 bool HasKey(const std::string& key) const; |
129 bool HasPath(const std::string& path) const; | 131 bool HasPath(const std::string& path) const; |
130 bool Get(const std::string& path, const base::Value** out_value) const; | 132 bool Get(const std::string& path, const base::Value** out_value) const; |
131 bool GetBoolean(const std::string& path, bool* out_value) const; | 133 bool GetBoolean(const std::string& path, bool* out_value) const; |
132 bool GetInteger(const std::string& path, int* out_value) const; | 134 bool GetInteger(const std::string& path, int* out_value) const; |
133 bool GetString(const std::string& path, std::string* out_value) const; | 135 bool GetString(const std::string& path, std::string* out_value) const; |
134 bool GetString(const std::string& path, string16* out_value) const; | 136 bool GetString(const std::string& path, string16* out_value) const; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 scoped_ptr<base::DictionaryValue> value_; | 168 scoped_ptr<base::DictionaryValue> value_; |
167 | 169 |
168 Type type_; | 170 Type type_; |
169 | 171 |
170 DISALLOW_COPY_AND_ASSIGN(Manifest); | 172 DISALLOW_COPY_AND_ASSIGN(Manifest); |
171 }; | 173 }; |
172 | 174 |
173 } // namespace extensions | 175 } // namespace extensions |
174 | 176 |
175 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_H_ | 177 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_H_ |
OLD | NEW |