OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 126 |
127 # Actions for language_options_handler.cc (Chrome OS specific). | 127 # Actions for language_options_handler.cc (Chrome OS specific). |
128 for input_method_id in INPUT_METHOD_IDS: | 128 for input_method_id in INPUT_METHOD_IDS: |
129 actions.add('LanguageOptions_DisableInputMethod_%s' % input_method_id) | 129 actions.add('LanguageOptions_DisableInputMethod_%s' % input_method_id) |
130 actions.add('LanguageOptions_EnableInputMethod_%s' % input_method_id) | 130 actions.add('LanguageOptions_EnableInputMethod_%s' % input_method_id) |
131 actions.add('InputMethodOptions_Open_%s' % input_method_id) | 131 actions.add('InputMethodOptions_Open_%s' % input_method_id) |
132 for language_code in LANGUAGE_CODES: | 132 for language_code in LANGUAGE_CODES: |
133 actions.add('LanguageOptions_UiLanguageChange_%s' % language_code) | 133 actions.add('LanguageOptions_UiLanguageChange_%s' % language_code) |
134 actions.add('LanguageOptions_SpellCheckLanguageChange_%s' % language_code) | 134 actions.add('LanguageOptions_SpellCheckLanguageChange_%s' % language_code) |
135 | 135 |
| 136 # Actions sent by the Chrome OS window manager. |
| 137 actions.add('Accel_NextWindow_Tab') |
| 138 actions.add('Accel_PrevWindow_Tab') |
| 139 actions.add('Accel_NextWindow_F5') |
| 140 actions.add('Accel_PrevWindow_F5') |
| 141 |
| 142 # Actions sent by the Chrome OS power manager. |
| 143 actions.add('Accel_BrightnessDown_F6') |
| 144 actions.add('Accel_BrightnessUp_F7') |
| 145 |
136 def AddWebKitEditorActions(actions): | 146 def AddWebKitEditorActions(actions): |
137 """Add editor actions from editor_client_impl.cc. | 147 """Add editor actions from editor_client_impl.cc. |
138 | 148 |
139 Arguments: | 149 Arguments: |
140 actions: set of actions to add to. | 150 actions: set of actions to add to. |
141 """ | 151 """ |
142 action_re = re.compile(r'''\{ [\w']+, +\w+, +"(.*)" +\},''') | 152 action_re = re.compile(r'''\{ [\w']+, +\w+, +"(.*)" +\},''') |
143 | 153 |
144 editor_file = os.path.join(path_utils.ScriptDir(), '..', '..', 'webkit', | 154 editor_file = os.path.join(path_utils.ScriptDir(), '..', '..', 'webkit', |
145 'api', 'src','EditorClientImpl.cc') | 155 'api', 'src','EditorClientImpl.cc') |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 hash.update(action) | 276 hash.update(action) |
267 print >>f, '0x%s\t%s' % (hash.hexdigest()[:16], action) | 277 print >>f, '0x%s\t%s' % (hash.hexdigest()[:16], action) |
268 else: | 278 else: |
269 print action | 279 print action |
270 | 280 |
271 if hash_output: | 281 if hash_output: |
272 print "Done. Do not forget to add chromeactions.txt to your changelist" | 282 print "Done. Do not forget to add chromeactions.txt to your changelist" |
273 | 283 |
274 if '__main__' == __name__: | 284 if '__main__' == __name__: |
275 main(sys.argv) | 285 main(sys.argv) |
OLD | NEW |