OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #ifndef EXTENSIONS_COMMON_EXTENSION_H_ | 5 #ifndef EXTENSIONS_COMMON_EXTENSION_H_ |
6 #define EXTENSIONS_COMMON_EXTENSION_H_ | 6 #define EXTENSIONS_COMMON_EXTENSION_H_ |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <iosfwd> | 9 #include <iosfwd> |
10 #include <map> | 10 #include <map> |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 NEW_INSTALL | 110 NEW_INSTALL |
111 }; | 111 }; |
112 | 112 |
113 // A base class for parsed manifest data that APIs want to store on | 113 // A base class for parsed manifest data that APIs want to store on |
114 // the extension. Related to base::SupportsUserData, but with an immutable | 114 // the extension. Related to base::SupportsUserData, but with an immutable |
115 // thread-safe interface to match Extension. | 115 // thread-safe interface to match Extension. |
116 struct ManifestData { | 116 struct ManifestData { |
117 virtual ~ManifestData() {} | 117 virtual ~ManifestData() {} |
118 }; | 118 }; |
119 | 119 |
| 120 // Do not change the order of entries or remove entries in this list |
| 121 // as this is used in UMA_HISTOGRAM_ENUMERATIONs about extensions. |
120 enum InitFromValueFlags { | 122 enum InitFromValueFlags { |
121 NO_FLAGS = 0, | 123 NO_FLAGS = 0, |
122 | 124 |
123 // Usually, the id of an extension is generated by the "key" property of | 125 // Usually, the id of an extension is generated by the "key" property of |
124 // its manifest, but if |REQUIRE_KEY| is not set, a temporary ID will be | 126 // its manifest, but if |REQUIRE_KEY| is not set, a temporary ID will be |
125 // generated based on the path. | 127 // generated based on the path. |
126 REQUIRE_KEY = 1 << 0, | 128 REQUIRE_KEY = 1 << 0, |
127 | 129 |
128 // Requires the extension to have an up-to-date manifest version. | 130 // Requires the extension to have an up-to-date manifest version. |
129 // Typically, we'll support multiple manifest versions during a version | 131 // Typically, we'll support multiple manifest versions during a version |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 REQUIRE_PERMISSIONS_CONSENT = 1 << 8, | 164 REQUIRE_PERMISSIONS_CONSENT = 1 << 8, |
163 | 165 |
164 // |IS_EPHEMERAL| identifies ephemeral apps (experimental), which are not | 166 // |IS_EPHEMERAL| identifies ephemeral apps (experimental), which are not |
165 // permanently installed. | 167 // permanently installed. |
166 IS_EPHEMERAL = 1 << 9, | 168 IS_EPHEMERAL = 1 << 9, |
167 | 169 |
168 // |WAS_INSTALLED_BY_OEM| installed by an OEM (e.g on Chrome OS) and should | 170 // |WAS_INSTALLED_BY_OEM| installed by an OEM (e.g on Chrome OS) and should |
169 // be placed in a special OEM folder in the App Launcher. Note: OEM apps are | 171 // be placed in a special OEM folder in the App Launcher. Note: OEM apps are |
170 // also installed by Default (i.e. WAS_INSTALLED_BY_DEFAULT is also true). | 172 // also installed by Default (i.e. WAS_INSTALLED_BY_DEFAULT is also true). |
171 WAS_INSTALLED_BY_OEM = 1 << 10, | 173 WAS_INSTALLED_BY_OEM = 1 << 10, |
| 174 |
| 175 // When adding new flags, make sure to update kInitFromValueFlagBits. |
172 }; | 176 }; |
173 | 177 |
| 178 // This is the highest bit index of the flags defined above. |
| 179 static const int kInitFromValueFlagBits; |
| 180 |
174 static scoped_refptr<Extension> Create(const base::FilePath& path, | 181 static scoped_refptr<Extension> Create(const base::FilePath& path, |
175 Manifest::Location location, | 182 Manifest::Location location, |
176 const base::DictionaryValue& value, | 183 const base::DictionaryValue& value, |
177 int flags, | 184 int flags, |
178 std::string* error); | 185 std::string* error); |
179 | 186 |
180 // In a few special circumstances, we want to create an Extension and give it | 187 // In a few special circumstances, we want to create an Extension and give it |
181 // an explicit id. Most consumers should just use the other Create() method. | 188 // an explicit id. Most consumers should just use the other Create() method. |
182 static scoped_refptr<Extension> Create(const base::FilePath& path, | 189 static scoped_refptr<Extension> Create(const base::FilePath& path, |
183 Manifest::Location location, | 190 Manifest::Location location, |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 | 554 |
548 UpdatedExtensionPermissionsInfo( | 555 UpdatedExtensionPermissionsInfo( |
549 const Extension* extension, | 556 const Extension* extension, |
550 const PermissionSet* permissions, | 557 const PermissionSet* permissions, |
551 Reason reason); | 558 Reason reason); |
552 }; | 559 }; |
553 | 560 |
554 } // namespace extensions | 561 } // namespace extensions |
555 | 562 |
556 #endif // EXTENSIONS_COMMON_EXTENSION_H_ | 563 #endif // EXTENSIONS_COMMON_EXTENSION_H_ |
OLD | NEW |