| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """Extract UserMetrics "actions" strings from the Chrome source. | 7 """Extract UserMetrics "actions" strings from the Chrome source. |
| 8 | 8 |
| 9 This program generates the list of known actions we expect to see in the | 9 This program generates the list of known actions we expect to see in the |
| 10 user behavior logs. It walks the Chrome source, looking for calls to | 10 user behavior logs. It walks the Chrome source, looking for calls to |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 | 400 |
| 401 # Actions sent by Chrome Connectivity Diagnostics. | 401 # Actions sent by Chrome Connectivity Diagnostics. |
| 402 actions.add('ConnectivityDiagnostics.LaunchSource.OfflineChromeOS') | 402 actions.add('ConnectivityDiagnostics.LaunchSource.OfflineChromeOS') |
| 403 actions.add('ConnectivityDiagnostics.LaunchSource.WebStore') | 403 actions.add('ConnectivityDiagnostics.LaunchSource.WebStore') |
| 404 actions.add('ConnectivityDiagnostics.UA.LogsShown') | 404 actions.add('ConnectivityDiagnostics.UA.LogsShown') |
| 405 actions.add('ConnectivityDiagnostics.UA.PassingTestsShown') | 405 actions.add('ConnectivityDiagnostics.UA.PassingTestsShown') |
| 406 actions.add('ConnectivityDiagnostics.UA.SettingsShown') | 406 actions.add('ConnectivityDiagnostics.UA.SettingsShown') |
| 407 actions.add('ConnectivityDiagnostics.UA.TestResultExpanded') | 407 actions.add('ConnectivityDiagnostics.UA.TestResultExpanded') |
| 408 actions.add('ConnectivityDiagnostics.UA.TestSuiteRun') | 408 actions.add('ConnectivityDiagnostics.UA.TestSuiteRun') |
| 409 | 409 |
| 410 # Actions sent by 'Ok Google' Hotwording. |
| 411 actions.add('Hotword.HotwordTrigger') |
| 412 |
| 410 def GrepForActions(path, actions): | 413 def GrepForActions(path, actions): |
| 411 """Grep a source file for calls to UserMetrics functions. | 414 """Grep a source file for calls to UserMetrics functions. |
| 412 | 415 |
| 413 Arguments: | 416 Arguments: |
| 414 path: path to the file | 417 path: path to the file |
| 415 actions: set of actions to add to | 418 actions: set of actions to add to |
| 416 """ | 419 """ |
| 417 global number_of_files_total | 420 global number_of_files_total |
| 418 number_of_files_total = number_of_files_total + 1 | 421 number_of_files_total = number_of_files_total + 1 |
| 419 # we look for the UserMetricsAction structure constructor | 422 # we look for the UserMetricsAction structure constructor |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 | 826 |
| 824 with open(actions_xml_path, 'wb') as f: | 827 with open(actions_xml_path, 'wb') as f: |
| 825 f.write(pretty) | 828 f.write(pretty) |
| 826 print ('Updated %s. Don\'t forget to add it to your changelist' % | 829 print ('Updated %s. Don\'t forget to add it to your changelist' % |
| 827 actions_xml_path) | 830 actions_xml_path) |
| 828 return 0 | 831 return 0 |
| 829 | 832 |
| 830 | 833 |
| 831 if '__main__' == __name__: | 834 if '__main__' == __name__: |
| 832 sys.exit(main(sys.argv)) | 835 sys.exit(main(sys.argv)) |
| OLD | NEW |