OLD | NEW |
(Empty) | |
| 1 # Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 """Check to see if the ShouldAllowOpenURLFailureScheme enum in histograms.xml |
| 6 needs to be updated. This can be called from a chromium PRESUBMIT.py to ensure |
| 7 updates to the enum in chrome_content_browser_client_extensions_part.cc also |
| 8 include the generated changes to histograms.xml. |
| 9 """ |
| 10 |
| 11 import update_histogram_enum |
| 12 |
| 13 def PrecheckShouldAllowOpenURLEnums(input_api, output_api): |
| 14 source_file = 'chrome/browser/extensions/' \ |
| 15 'chrome_content_browser_client_extensions_part.cc' |
| 16 |
| 17 affected_files = (f.LocalPath() for f in input_api.AffectedFiles()) |
| 18 if source_file not in affected_files: |
| 19 return [] |
| 20 |
| 21 if update_histogram_enum.HistogramNeedsUpdate( |
| 22 histogram_enum_name='ShouldAllowOpenURLFailureScheme', |
| 23 source_enum_path=source_file, |
| 24 start_marker='^enum ShouldAllowOpenURLFailureScheme {', |
| 25 end_marker='^SCHEME_LAST'): |
| 26 return [output_api.PresubmitPromptWarning( |
| 27 'ShouldAllowOpenURLFailureScheme has been updated but histogram.xml ' |
| 28 'does not appear to be updated.\nPlease run:\n' |
| 29 ' python tools/metrics/histograms/' |
| 30 'update_should_allow_open_url_histograms.py\n')] |
| 31 return [] |
OLD | NEW |