| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/env 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, |
| 11 as well as generating the lists of possible actions in situations where | 11 as well as generating the lists of possible actions in situations where |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 for action in sorted(actions): | 432 for action in sorted(actions): |
| 433 if hash_output: | 433 if hash_output: |
| 434 hash = hashlib.md5() | 434 hash = hashlib.md5() |
| 435 hash.update(action) | 435 hash.update(action) |
| 436 print >>f, '0x%s\t%s' % (hash.hexdigest()[:16], action) | 436 print >>f, '0x%s\t%s' % (hash.hexdigest()[:16], action) |
| 437 else: | 437 else: |
| 438 print action | 438 print action |
| 439 | 439 |
| 440 if hash_output: | 440 if hash_output: |
| 441 print "Done. Do not forget to add chromeactions.txt to your changelist" | 441 print "Done. Do not forget to add chromeactions.txt to your changelist" |
| 442 return 0 |
| 443 |
| 442 | 444 |
| 443 if '__main__' == __name__: | 445 if '__main__' == __name__: |
| 444 main(sys.argv) | 446 sys.exit(main(sys.argv)) |
| OLD | NEW |