Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / app / PRESUBMIT.py
blob519eac77cb195366afca403dcc2e2ad200b7361b
1 # Copyright 2013 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.
5 """Presubmit script for changes affecting chrome/app/
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
8 for more details about the presubmit API built into depot_tools.
9 """
11 import os
13 def _CheckNoProductNameInGeneratedResources(input_api, output_api):
14 """Check that no PRODUCT_NAME placeholders are found in resources files.
16 These kinds of strings prevent proper localization in some languages. For
17 more information, see the following chromium-dev thread:
18 https://groups.google.com/a/chromium.org/forum/#!msg/chromium-dev/PBs5JfR0Aoc/NOcIHII9u14J
19 """
21 problems = []
22 filename_filter = lambda x: x.LocalPath().endswith('.grd')
24 for f, line_num, line in input_api.RightHandSideLines(filename_filter):
25 if 'PRODUCT_NAME' in line:
26 problems.append('%s:%d' % (f.LocalPath(), line_num))
28 if problems:
29 return [output_api.PresubmitPromptWarning(
30 "Don't use PRODUCT_NAME placeholders in string resources. Instead, add "
31 "separate strings to google_chrome_strings.grd and "
32 "chromium_strings.grd. See http://goo.gl/6614MQ for more information."
33 "Problems with this check? Contact dubroy@chromium.org.",
34 items=problems)]
35 return []
37 def _CommonChecks(input_api, output_api):
38 """Checks common to both upload and commit."""
39 results = []
40 results.extend(_CheckNoProductNameInGeneratedResources(input_api, output_api))
41 return results
43 def CheckChangeOnUpload(input_api, output_api):
44 return _CommonChecks(input_api, output_api)
46 def CheckChangeOnCommit(input_api, output_api):
47 return _CommonChecks(input_api, output_api)