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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 """ | 184 """ |
185 action_re = re.compile(r'''\{ [\w']+, +\w+, +"(.*)" +\},''') | 185 action_re = re.compile(r'''\{ [\w']+, +\w+, +"(.*)" +\},''') |
186 | 186 |
187 editor_file = os.path.join(REPOSITORY_ROOT, 'webkit', 'api', 'src', | 187 editor_file = os.path.join(REPOSITORY_ROOT, 'webkit', 'api', 'src', |
188 'EditorClientImpl.cc') | 188 'EditorClientImpl.cc') |
189 for line in open(editor_file): | 189 for line in open(editor_file): |
190 match = action_re.search(line) | 190 match = action_re.search(line) |
191 if match: # Plain call to RecordAction | 191 if match: # Plain call to RecordAction |
192 actions.add(match.group(1)) | 192 actions.add(match.group(1)) |
193 | 193 |
194 def AddClosedSourceActions(actions): | 194 def AddPDFPluginActions(actions): |
195 """Add actions that are in code which is not checked out by default | 195 """Add actions that are sent by the PDF plugin. |
196 | 196 |
197 Arguments | 197 Arguments |
198 actions: set of actions to add to. | 198 actions: set of actions to add to. |
199 """ | 199 """ |
200 actions.add('PDF.FitToHeightButton') | 200 actions.add('PDF.FitToHeightButton') |
201 actions.add('PDF.FitToWidthButton') | 201 actions.add('PDF.FitToWidthButton') |
202 actions.add('PDF.LoadFailure') | 202 actions.add('PDF.LoadFailure') |
203 actions.add('PDF.LoadSuccess') | 203 actions.add('PDF.LoadSuccess') |
204 actions.add('PDF.PreviewDocumentLoadFailure') | 204 actions.add('PDF.PreviewDocumentLoadFailure') |
205 actions.add('PDF.PrintButton') | 205 actions.add('PDF.PrintButton') |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 AddWebUIActions(actions) | 733 AddWebUIActions(actions) |
734 | 734 |
735 AddLiteralActions(actions) | 735 AddLiteralActions(actions) |
736 | 736 |
737 # print "Scanned {0} number of files".format(number_of_files_total) | 737 # print "Scanned {0} number of files".format(number_of_files_total) |
738 # print "Found {0} entries".format(len(actions)) | 738 # print "Found {0} entries".format(len(actions)) |
739 | 739 |
740 AddAutomaticResetBannerActions(actions) | 740 AddAutomaticResetBannerActions(actions) |
741 AddBookmarkManagerActions(actions) | 741 AddBookmarkManagerActions(actions) |
742 AddChromeOSActions(actions) | 742 AddChromeOSActions(actions) |
743 AddClosedSourceActions(actions) | |
744 AddExtensionActions(actions) | 743 AddExtensionActions(actions) |
745 AddHistoryPageActions(actions) | 744 AddHistoryPageActions(actions) |
| 745 AddPDFPluginActions(actions) |
746 | 746 |
747 return PrettyPrint(actions, actions_dict, comment_nodes) | 747 return PrettyPrint(actions, actions_dict, comment_nodes) |
748 | 748 |
749 | 749 |
750 def main(argv): | 750 def main(argv): |
751 presubmit_util.DoPresubmitMain(argv, 'actions.xml', 'actions.old.xml', | 751 presubmit_util.DoPresubmitMain(argv, 'actions.xml', 'actions.old.xml', |
752 'extract_actions.py', UpdateXml) | 752 'extract_actions.py', UpdateXml) |
753 | 753 |
754 if '__main__' == __name__: | 754 if '__main__' == __name__: |
755 sys.exit(main(sys.argv)) | 755 sys.exit(main(sys.argv)) |
OLD | NEW |