Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Extract UserMetrics "actions" strings from the Chrome source. | 6 """Extract UserMetrics "actions" strings from the Chrome source. |
| 7 | 7 |
| 8 This program generates the list of known actions we expect to see in the | 8 This program generates the list of known actions we expect to see in the |
| 9 user behavior logs. It walks the Chrome source, looking for calls to | 9 user behavior logs. It walks the Chrome source, looking for calls to |
| 10 UserMetrics functions, extracting actions and warning on improper calls, | 10 UserMetrics functions, extracting actions and warning on improper calls, |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 217 actions.add('Accel_BrightnessUp_F7') | 217 actions.add('Accel_BrightnessUp_F7') |
| 218 | 218 |
| 219 # Actions sent by Chrome OS update engine. | 219 # Actions sent by Chrome OS update engine. |
| 220 actions.add('Updater.ServerCertificateChanged') | 220 actions.add('Updater.ServerCertificateChanged') |
| 221 actions.add('Updater.ServerCertificateFailed') | 221 actions.add('Updater.ServerCertificateFailed') |
| 222 | 222 |
| 223 # Actions sent by Chrome OS cryptohome. | 223 # Actions sent by Chrome OS cryptohome. |
| 224 actions.add('Cryptohome.PKCS11InitFail') | 224 actions.add('Cryptohome.PKCS11InitFail') |
| 225 | 225 |
| 226 def AddExtensionActions(actions): | 226 def AddExtensionActions(actions): |
| 227 """Add actions reported by extensions via chrome.experimental.metrics API. | 227 """Add actions reported by extensions via chrome.experimental.metrics API. |
|
Ilya Sherman
2011/12/06 22:01:17
nit: Is this API still in chrome.experimental? I
Vladislav Kaznacheev
2011/12/07 11:18:57
Done.
| |
| 228 | 228 |
| 229 Arguments: | 229 Arguments: |
| 230 actions: set of actions to add to. | 230 actions: set of actions to add to. |
| 231 """ | 231 """ |
| 232 # Actions sent by Chrome OS File Browser. | 232 # Actions sent by Chrome OS File Browser. |
| 233 actions.add('FileBrowser.CreateNewFolder') | 233 actions.add('FileBrowser.CreateNewFolder') |
| 234 actions.add('FileBrowser.PhotoEditor.Edit') | |
| 235 actions.add('FileBrowser.PhotoEditor.View') | |
| 234 | 236 |
| 235 def GrepForActions(path, actions): | 237 def GrepForActions(path, actions): |
| 236 """Grep a source file for calls to UserMetrics functions. | 238 """Grep a source file for calls to UserMetrics functions. |
| 237 | 239 |
| 238 Arguments: | 240 Arguments: |
| 239 path: path to the file | 241 path: path to the file |
| 240 actions: set of actions to add to | 242 actions: set of actions to add to |
| 241 """ | 243 """ |
| 242 global number_of_files_total | 244 global number_of_files_total |
| 243 number_of_files_total = number_of_files_total + 1 | 245 number_of_files_total = number_of_files_total + 1 |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 437 else: | 439 else: |
| 438 print action | 440 print action |
| 439 | 441 |
| 440 if hash_output: | 442 if hash_output: |
| 441 print "Done. Do not forget to add chromeactions.txt to your changelist" | 443 print "Done. Do not forget to add chromeactions.txt to your changelist" |
| 442 return 0 | 444 return 0 |
| 443 | 445 |
| 444 | 446 |
| 445 if '__main__' == __name__: | 447 if '__main__' == __name__: |
| 446 sys.exit(main(sys.argv)) | 448 sys.exit(main(sys.argv)) |
| OLD | NEW |