| 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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 """ | 522 """ |
| 523 EXTENSIONS = ('.cc', '.mm', '.c', '.m') | 523 EXTENSIONS = ('.cc', '.mm', '.c', '.m') |
| 524 | 524 |
| 525 # Walk the source tree to process all .cc files. | 525 # Walk the source tree to process all .cc files. |
| 526 ash_root = os.path.normpath(os.path.join(REPOSITORY_ROOT, 'ash')) | 526 ash_root = os.path.normpath(os.path.join(REPOSITORY_ROOT, 'ash')) |
| 527 WalkDirectory(ash_root, actions, EXTENSIONS, GrepForActions) | 527 WalkDirectory(ash_root, actions, EXTENSIONS, GrepForActions) |
| 528 chrome_root = os.path.normpath(os.path.join(REPOSITORY_ROOT, 'chrome')) | 528 chrome_root = os.path.normpath(os.path.join(REPOSITORY_ROOT, 'chrome')) |
| 529 WalkDirectory(chrome_root, actions, EXTENSIONS, GrepForActions) | 529 WalkDirectory(chrome_root, actions, EXTENSIONS, GrepForActions) |
| 530 content_root = os.path.normpath(os.path.join(REPOSITORY_ROOT, 'content')) | 530 content_root = os.path.normpath(os.path.join(REPOSITORY_ROOT, 'content')) |
| 531 WalkDirectory(content_root, actions, EXTENSIONS, GrepForActions) | 531 WalkDirectory(content_root, actions, EXTENSIONS, GrepForActions) |
| 532 components_root = os.path.normpath(os.path.join(REPOSITORY_ROOT, |
| 533 'components')) |
| 534 WalkDirectory(components_root, actions, EXTENSIONS, GrepForActions) |
| 532 net_root = os.path.normpath(os.path.join(REPOSITORY_ROOT, 'net')) | 535 net_root = os.path.normpath(os.path.join(REPOSITORY_ROOT, 'net')) |
| 533 WalkDirectory(net_root, actions, EXTENSIONS, GrepForActions) | 536 WalkDirectory(net_root, actions, EXTENSIONS, GrepForActions) |
| 534 webkit_root = os.path.normpath(os.path.join(REPOSITORY_ROOT, 'webkit')) | 537 webkit_root = os.path.normpath(os.path.join(REPOSITORY_ROOT, 'webkit')) |
| 535 WalkDirectory(os.path.join(webkit_root, 'glue'), actions, EXTENSIONS, | 538 WalkDirectory(os.path.join(webkit_root, 'glue'), actions, EXTENSIONS, |
| 536 GrepForActions) | 539 GrepForActions) |
| 537 WalkDirectory(os.path.join(webkit_root, 'port'), actions, EXTENSIONS, | 540 WalkDirectory(os.path.join(webkit_root, 'port'), actions, EXTENSIONS, |
| 538 GrepForActions) | 541 GrepForActions) |
| 539 | 542 |
| 540 def AddWebUIActions(actions): | 543 def AddWebUIActions(actions): |
| 541 """Add user actions defined in WebUI files. | 544 """Add user actions defined in WebUI files. |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 | 829 |
| 827 with open(actions_xml_path, 'wb') as f: | 830 with open(actions_xml_path, 'wb') as f: |
| 828 f.write(pretty) | 831 f.write(pretty) |
| 829 print ('Updated %s. Don\'t forget to add it to your changelist' % | 832 print ('Updated %s. Don\'t forget to add it to your changelist' % |
| 830 actions_xml_path) | 833 actions_xml_path) |
| 831 return 0 | 834 return 0 |
| 832 | 835 |
| 833 | 836 |
| 834 if '__main__' == __name__: | 837 if '__main__' == __name__: |
| 835 sys.exit(main(sys.argv)) | 838 sys.exit(main(sys.argv)) |
| OLD | NEW |