| OLD | NEW |
| 1 # Extension Features Files | 1 # Extension Features Files |
| 2 | 2 |
| 3 [TOC] | 3 [TOC] |
| 4 | 4 |
| 5 ## Summary | 5 ## Summary |
| 6 | 6 |
| 7 The Extension features files specify the different requirements for extension | 7 The Extension features files specify the different requirements for extension |
| 8 feature availability. | 8 feature availability. |
| 9 | 9 |
| 10 An **extension feature** can be any component of extension capabilities. Most | 10 An **extension feature** can be any component of extension capabilities. Most |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 `"default_parent": true` to one of the feature definitions in the parent | 115 `"default_parent": true` to one of the feature definitions in the parent |
| 116 feature. | 116 feature. |
| 117 | 117 |
| 118 ## Properties | 118 ## Properties |
| 119 | 119 |
| 120 The following properties are supported in the feature system. | 120 The following properties are supported in the feature system. |
| 121 | 121 |
| 122 ### blacklist | 122 ### blacklist |
| 123 | 123 |
| 124 The `blacklist` property specifies a list of ID hashes for extensions that | 124 The `blacklist` property specifies a list of ID hashes for extensions that |
| 125 cannot access a feature. See _api_features.json for how to generate these | 125 cannot access a feature. See ID Hashes in this document for how to generate |
| 126 hashes. | 126 these hashes. |
| 127 | 127 |
| 128 Accepted values are lists of id hashes. | 128 Accepted values are lists of id hashes. |
| 129 | 129 |
| 130 ### channel | 130 ### channel |
| 131 | 131 |
| 132 The `channel` property specifies a maximum channel for the feature availability. | 132 The `channel` property specifies a maximum channel for the feature availability. |
| 133 That is, specifying `dev` means that the feature is available on `dev`, | 133 That is, specifying `dev` means that the feature is available on `dev`, |
| 134 `canary`, and `trunk`. | 134 `canary`, and `trunk`. |
| 135 | 135 |
| 136 Accepted values are a single string from `trunk`, `canary`, `dev`, `beta`, and | 136 Accepted values are a single string from `trunk`, `canary`, `dev`, `beta`, and |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 The accepted values are lists of strings from `chromeos`, `mac`, `linux`, and | 253 The accepted values are lists of strings from `chromeos`, `mac`, `linux`, and |
| 254 `win`. | 254 `win`. |
| 255 | 255 |
| 256 ### whitelist | 256 ### whitelist |
| 257 | 257 |
| 258 The `whitelist` property specifies a list of ID hashes for extensions that | 258 The `whitelist` property specifies a list of ID hashes for extensions that |
| 259 are the only extensions allowed to access a feature. | 259 are the only extensions allowed to access a feature. |
| 260 | 260 |
| 261 Accepted values are lists of id hashes. | 261 Accepted values are lists of id hashes. |
| 262 | 262 |
| 263 ## ID Hashes |
| 264 |
| 265 Instead of listing the ID directly in the whitelist or blacklist section, we |
| 266 use an uppercased SHA1 hash of the id. |
| 267 |
| 268 To generate a new whitelisted ID for an extension ID, do the following in bash: |
| 269 ``` |
| 270 $ echo -n "aaaabbbbccccddddeeeeffffgggghhhh" | \ |
| 271 sha1sum | tr '[:lower:]' '[:upper:]' |
| 272 ``` |
| 273 (Replacing `aaaabbbbccccddddeeeeffffgggghhhh` with your extension ID.) |
| 274 |
| 275 The output should be something like: |
| 276 ``` |
| 277 9A0417016F345C934A1A88F55CA17C05014EEEBA - |
| 278 ``` |
| 279 |
| 280 Add the ID to the whitelist or blacklist for the desired feature. It is also |
| 281 often useful to link the crbug next to the id hash, e.g.: |
| 282 ``` |
| 283 "whitelist": [ |
| 284 "9A0417016F345C934A1A88F55CA17C05014EEEBA" // crbug.com/<num> |
| 285 ] |
| 286 ``` |
| 287 |
| 288 Google employees: please update http://go/chrome-api-whitelist to map hashes |
| 289 back to ids. |
| 290 |
| 291 ## Compilation |
| 292 |
| 293 The feature files are compiled as part of the suite of tools in |
| 294 //tools/json\_schema\_compiler/. The output is a set of FeatureProviders that |
| 295 contain a mapping of all features. |
| 296 |
| 297 In addition to being significantly more performant than parsing the JSON files |
| 298 at runtime, this has the added benefit of allowing us to validate at compile |
| 299 time rather than needing a unittest (or allowing incorrect features). |
| 300 |
| 301 In theory, invalid features should result in a compilation failure; in practice, |
| 302 the compiler is probably missing some cases. |
| 303 |
| 263 ## Still to come | 304 ## Still to come |
| 264 | 305 |
| 265 TODO(devlin): Move documentation for how to create ID hashes, possibly move | 306 TODO(devlin): Possibly move documentation for feature contexts, add |
| 266 documentation for feature contexts, add documentation for extension types, and | 307 documentation for extension types. Probably also more on requirements for |
| 267 add documentation for the compilation process. Probably also more on | 308 individual features. |
| 268 requirements for individual features. | |
| OLD | NEW |