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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 # they require special handling code in this script. | 46 # they require special handling code in this script. |
47 # To add a new file, add it to this list and add the appropriate logic to | 47 # To add a new file, add it to this list and add the appropriate logic to |
48 # generate the known actions to AddComputedActions() below. | 48 # generate the known actions to AddComputedActions() below. |
49 KNOWN_COMPUTED_USERS = ( | 49 KNOWN_COMPUTED_USERS = ( |
50 'back_forward_menu_model.cc', | 50 'back_forward_menu_model.cc', |
51 'options_page_view.cc', | 51 'options_page_view.cc', |
52 'render_view_host.cc', # called using webkit identifiers | 52 'render_view_host.cc', # called using webkit identifiers |
53 'user_metrics.cc', # method definition | 53 'user_metrics.cc', # method definition |
54 'new_tab_ui.cc', # most visited clicks 1-9 | 54 'new_tab_ui.cc', # most visited clicks 1-9 |
55 'extension_metrics_module.cc', # extensions hook for user metrics | 55 'extension_metrics_module.cc', # extensions hook for user metrics |
56 'safe_browsing_blocking_page.cc', # various interstitial types and actions | |
57 'language_options_handler_common.cc', # languages and input methods in CrOS | 56 'language_options_handler_common.cc', # languages and input methods in CrOS |
58 'cros_language_options_handler.cc', # languages and input methods in CrOS | 57 'cros_language_options_handler.cc', # languages and input methods in CrOS |
59 'about_flags.cc', # do not generate a warning; see AddAboutFlagsActions() | 58 'about_flags.cc', # do not generate a warning; see AddAboutFlagsActions() |
60 'external_metrics.cc', # see AddChromeOSActions() | 59 'external_metrics.cc', # see AddChromeOSActions() |
61 'core_options_handler.cc', # see AddWebUIActions() | 60 'core_options_handler.cc', # see AddWebUIActions() |
62 'browser_render_process_host.cc', # see AddRendererActions() | 61 'browser_render_process_host.cc', # see AddRendererActions() |
63 'render_thread_impl.cc', # impl of RenderThread::RecordComputedAction() | 62 'render_thread_impl.cc', # impl of RenderThread::RecordComputedAction() |
64 'render_process_host_impl.cc', # browser side impl for | 63 'render_process_host_impl.cc', # browser side impl for |
65 # RenderThread::RecordComputedAction() | 64 # RenderThread::RecordComputedAction() |
66 'mock_render_thread.cc', # mock of RenderThread::RecordComputedAction() | 65 'mock_render_thread.cc', # mock of RenderThread::RecordComputedAction() |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 actions.add(dir + 'ShowFullHistory') | 144 actions.add(dir + 'ShowFullHistory') |
146 actions.add(dir + 'Popup') | 145 actions.add(dir + 'Popup') |
147 for i in range(1, 20): | 146 for i in range(1, 20): |
148 actions.add(dir + 'HistoryClick' + str(i)) | 147 actions.add(dir + 'HistoryClick' + str(i)) |
149 actions.add(dir + 'ChapterClick' + str(i)) | 148 actions.add(dir + 'ChapterClick' + str(i)) |
150 | 149 |
151 # Actions for new_tab_ui.cc. | 150 # Actions for new_tab_ui.cc. |
152 for i in range(1, 10): | 151 for i in range(1, 10): |
153 actions.add('MostVisited%d' % i) | 152 actions.add('MostVisited%d' % i) |
154 | 153 |
155 # Actions for safe_browsing_blocking_page.cc. | |
156 for interstitial in ('Phishing', 'Malware', 'Multiple'): | |
157 for action in ('Show', 'Proceed', 'DontProceed', 'ForcedDontProceed'): | |
158 actions.add('SBInterstitial%s%s' % (interstitial, action)) | |
159 | |
160 # Actions for language_options_handler.cc (Chrome OS specific). | 154 # Actions for language_options_handler.cc (Chrome OS specific). |
161 for input_method_id in INPUT_METHOD_IDS: | 155 for input_method_id in INPUT_METHOD_IDS: |
162 actions.add('LanguageOptions_DisableInputMethod_%s' % input_method_id) | 156 actions.add('LanguageOptions_DisableInputMethod_%s' % input_method_id) |
163 actions.add('LanguageOptions_EnableInputMethod_%s' % input_method_id) | 157 actions.add('LanguageOptions_EnableInputMethod_%s' % input_method_id) |
164 for language_code in LANGUAGE_CODES: | 158 for language_code in LANGUAGE_CODES: |
165 actions.add('LanguageOptions_UiLanguageChange_%s' % language_code) | 159 actions.add('LanguageOptions_UiLanguageChange_%s' % language_code) |
166 actions.add('LanguageOptions_SpellCheckLanguageChange_%s' % language_code) | 160 actions.add('LanguageOptions_SpellCheckLanguageChange_%s' % language_code) |
167 | 161 |
168 def AddWebKitEditorActions(actions): | 162 def AddWebKitEditorActions(actions): |
169 """Add editor actions from editor_client_impl.cc. | 163 """Add editor actions from editor_client_impl.cc. |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 | 824 |
831 with open(actions_xml_path, 'wb') as f: | 825 with open(actions_xml_path, 'wb') as f: |
832 f.write(pretty) | 826 f.write(pretty) |
833 print ('Updated %s. Don\'t forget to add it to your changelist' % | 827 print ('Updated %s. Don\'t forget to add it to your changelist' % |
834 actions_xml_path) | 828 actions_xml_path) |
835 return 0 | 829 return 0 |
836 | 830 |
837 | 831 |
838 if '__main__' == __name__: | 832 if '__main__' == __name__: |
839 sys.exit(main(sys.argv)) | 833 sys.exit(main(sys.argv)) |
OLD | NEW |