Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: tools/metrics/actions/extract_actions.py

Issue 1403833002: Material PDF: Add metrics to count usage of PDF title and bookmarks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/metrics/actions/actions.xml ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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.HasBookmarks')
203 actions.add('PDF.HasTitle')
202 actions.add('PDF.LoadFailure') 204 actions.add('PDF.LoadFailure')
203 actions.add('PDF.LoadSuccess') 205 actions.add('PDF.LoadSuccess')
204 actions.add('PDF.PreviewDocumentLoadFailure') 206 actions.add('PDF.PreviewDocumentLoadFailure')
205 actions.add('PDF.PrintButton') 207 actions.add('PDF.PrintButton')
206 actions.add('PDF.PrintPage') 208 actions.add('PDF.PrintPage')
207 actions.add('PDF.SaveButton') 209 actions.add('PDF.SaveButton')
208 actions.add('PDF.ZoomFromBrowser') 210 actions.add('PDF.ZoomFromBrowser')
209 actions.add('PDF.ZoomInButton') 211 actions.add('PDF.ZoomInButton')
210 actions.add('PDF.ZoomOutButton') 212 actions.add('PDF.ZoomOutButton')
211 actions.add('PDF_Unsupported_3D') 213 actions.add('PDF_Unsupported_3D')
212 actions.add('PDF_Unsupported_Attachment') 214 actions.add('PDF_Unsupported_Attachment')
213 actions.add('PDF_Unsupported_Bookmarks') 215 actions.add('PDF_Unsupported_Bookmarks')
214 actions.add('PDF_Unsupported_Digital_Signature') 216 actions.add('PDF_Unsupported_Digital_Signature')
215 actions.add('PDF_Unsupported_Movie') 217 actions.add('PDF_Unsupported_Movie')
216 actions.add('PDF_Unsupported_Portfolios_Packages') 218 actions.add('PDF_Unsupported_Portfolios_Packages')
217 actions.add('PDF_Unsupported_Rights_Management') 219 actions.add('PDF_Unsupported_Rights_Management')
218 actions.add('PDF_Unsupported_Screen') 220 actions.add('PDF_Unsupported_Screen')
219 actions.add('PDF_Unsupported_Shared_Form') 221 actions.add('PDF_Unsupported_Shared_Form')
220 actions.add('PDF_Unsupported_Shared_Review') 222 actions.add('PDF_Unsupported_Shared_Review')
221 actions.add('PDF_Unsupported_Sound') 223 actions.add('PDF_Unsupported_Sound')
222 actions.add('PDF_Unsupported_XFA') 224 actions.add('PDF_Unsupported_XFA')
raymes 2015/10/13 05:27:54 Hmm can we remove the ones that are now unused?
tsergeant 2015/10/14 02:28:48 isherman@, what is the procedure for removing acti
tsergeant 2015/10/14 02:36:50 Ah, whoops, that was a draft from yesterday. Same
Alexei Svitkine (slow) 2015/10/14 15:01:50 Feel free to remove obsolete entries from this lis
223 225
224 def AddAboutFlagsActions(actions): 226 def AddAboutFlagsActions(actions):
225 """This parses the experimental feature flags for UMA actions. 227 """This parses the experimental feature flags for UMA actions.
226 228
227 Arguments: 229 Arguments:
228 actions: set of actions to add to. 230 actions: set of actions to add to.
229 """ 231 """
230 about_flags = os.path.join(REPOSITORY_ROOT, 'chrome', 'browser', 232 about_flags = os.path.join(REPOSITORY_ROOT, 'chrome', 'browser',
231 'about_flags.cc') 233 'about_flags.cc')
232 flag_name_re = re.compile(r'\s*"([0-9a-zA-Z\-_]+)",\s*// FLAGS:RECORD_UMA') 234 flag_name_re = re.compile(r'\s*"([0-9a-zA-Z\-_]+)",\s*// FLAGS:RECORD_UMA')
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 AddWebUIActions(actions) 735 AddWebUIActions(actions)
734 736
735 AddLiteralActions(actions) 737 AddLiteralActions(actions)
736 738
737 # print "Scanned {0} number of files".format(number_of_files_total) 739 # print "Scanned {0} number of files".format(number_of_files_total)
738 # print "Found {0} entries".format(len(actions)) 740 # print "Found {0} entries".format(len(actions))
739 741
740 AddAutomaticResetBannerActions(actions) 742 AddAutomaticResetBannerActions(actions)
741 AddBookmarkManagerActions(actions) 743 AddBookmarkManagerActions(actions)
742 AddChromeOSActions(actions) 744 AddChromeOSActions(actions)
743 AddClosedSourceActions(actions)
744 AddExtensionActions(actions) 745 AddExtensionActions(actions)
745 AddHistoryPageActions(actions) 746 AddHistoryPageActions(actions)
747 AddPDFPluginActions(actions)
746 748
747 return PrettyPrint(actions, actions_dict, comment_nodes) 749 return PrettyPrint(actions, actions_dict, comment_nodes)
748 750
749 751
750 def main(argv): 752 def main(argv):
751 presubmit_util.DoPresubmitMain(argv, 'actions.xml', 'actions.old.xml', 753 presubmit_util.DoPresubmitMain(argv, 'actions.xml', 'actions.old.xml',
752 'extract_actions.py', UpdateXml) 754 'extract_actions.py', UpdateXml)
753 755
754 if '__main__' == __name__: 756 if '__main__' == __name__:
755 sys.exit(main(sys.argv)) 757 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « tools/metrics/actions/actions.xml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698