Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """Without any args, this simply loads the IDs out of a bunch of the Chrome GRD | 6 """Without any args, this simply loads the IDs out of a bunch of the Chrome GRD |
| 7 files, and then checks the subset of the code that loads the strings to try | 7 files, and then checks the subset of the code that loads the strings to try |
| 8 and figure out what isn't in use any more. | 8 and figure out what isn't in use any more. |
| 9 You can give paths to GRD files and source directories to control what is | 9 You can give paths to GRD files and source directories to control what is |
| 10 check instead. | 10 check instead. |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 grd_files.append(arg) | 123 grd_files.append(arg) |
| 124 else: | 124 else: |
| 125 src_dirs.append(arg) | 125 src_dirs.append(arg) |
| 126 | 126 |
| 127 # If no GRD files were given, default them: | 127 # If no GRD files were given, default them: |
| 128 if len(grd_files) == 0: | 128 if len(grd_files) == 0: |
| 129 ash_base_dir = os.path.join(src_dir, 'ash') | 129 ash_base_dir = os.path.join(src_dir, 'ash') |
| 130 chrome_dir = os.path.join(src_dir, 'chrome') | 130 chrome_dir = os.path.join(src_dir, 'chrome') |
| 131 chrome_app_dir = os.path.join(chrome_dir, 'app') | 131 chrome_app_dir = os.path.join(chrome_dir, 'app') |
| 132 chrome_app_res_dir = os.path.join(chrome_app_dir, 'resources') | 132 chrome_app_res_dir = os.path.join(chrome_app_dir, 'resources') |
| 133 ui_base_dir = os.path.join(src_dir, 'ui', 'base', 'strings') | 133 ui_base_dir = os.path.join(src_dir, 'ui', 'base',) |
| 134 ui_base_strings_dir = os.path.join(ui_base_dir, 'strings') | |
| 135 ui_base_native_theme_dir = os.path.join(ui_base_dir, 'native_theme') | |
| 134 grd_files = [ | 136 grd_files = [ |
| 135 os.path.join(ash_base_dir, 'ash_strings.grd'), | 137 os.path.join(ash_base_dir, 'ash_strings.grd'), |
| 136 os.path.join(chrome_app_dir, 'chromium_strings.grd'), | 138 os.path.join(chrome_app_dir, 'chromium_strings.grd'), |
| 137 os.path.join(chrome_app_dir, 'generated_resources.grd'), | 139 os.path.join(chrome_app_dir, 'generated_resources.grd'), |
| 138 os.path.join(chrome_app_dir, 'google_chrome_strings.grd'), | 140 os.path.join(chrome_app_dir, 'google_chrome_strings.grd'), |
| 139 os.path.join(chrome_app_res_dir, 'locale_settings.grd'), | 141 os.path.join(chrome_app_res_dir, 'locale_settings.grd'), |
| 140 os.path.join(chrome_app_res_dir, 'locale_settings_cros.grd'), | 142 os.path.join(chrome_app_res_dir, 'locale_settings_cros.grd'), |
| 141 os.path.join(chrome_app_res_dir, 'locale_settings_linux.grd'), | 143 os.path.join(chrome_app_res_dir, 'locale_settings_linux.grd'), |
| 142 os.path.join(chrome_app_res_dir, 'locale_settings_mac.grd'), | 144 os.path.join(chrome_app_res_dir, 'locale_settings_mac.grd'), |
| 143 os.path.join(chrome_app_res_dir, 'locale_settings_win.grd'), | 145 os.path.join(chrome_app_res_dir, 'locale_settings_win.grd'), |
| 144 os.path.join(chrome_app_dir, 'theme', 'theme_resources.grd'), | 146 os.path.join(chrome_app_dir, 'theme', 'theme_resources.grd'), |
| 145 os.path.join(chrome_dir, 'browser', 'browser_resources.grd'), | 147 os.path.join(chrome_dir, 'browser', 'browser_resources.grd'), |
| 146 os.path.join(chrome_dir, 'browser', 'resources', 'shared_resources.grd'), | 148 os.path.join(chrome_dir, 'browser', 'resources', 'shared_resources.grd'), |
| 147 os.path.join(chrome_dir, 'common', 'common_resources.grd'), | 149 os.path.join(chrome_dir, 'common', 'common_resources.grd'), |
| 148 os.path.join(chrome_dir, 'renderer', 'renderer_resources.grd'), | 150 os.path.join(chrome_dir, 'renderer', 'renderer_resources.grd'), |
| 149 os.path.join(src_dir, 'ui', 'gfx', 'gfx_resources.grd'), | |
| 150 os.path.join(src_dir, 'ui', 'resources', 'ui_resources.grd'), | 151 os.path.join(src_dir, 'ui', 'resources', 'ui_resources.grd'), |
| 151 os.path.join(ui_base_dir, 'app_locale_settings.grd'), | 152 os.path.join(ui_base_native_theme_dir, 'resources', |
|
TVL
2012/05/15 23:48:36
since ui_base_native_theme_dir is only used this o
oshima
2012/05/16 00:02:46
Done.
| |
| 152 os.path.join(ui_base_dir, 'ui_strings.grd'), | 153 'native_theme_resources.grd'), |
| 154 os.path.join(ui_base_strings_dir, 'app_locale_settings.grd'), | |
| 155 os.path.join(ui_base_strings_dir, 'ui_strings.grd'), | |
| 153 ] | 156 ] |
| 154 | 157 |
| 155 # If no source directories were given, default them: | 158 # If no source directories were given, default them: |
| 156 if len(src_dirs) == 0: | 159 if len(src_dirs) == 0: |
| 157 src_dirs = [ | 160 src_dirs = [ |
| 158 os.path.join(src_dir, 'app'), | 161 os.path.join(src_dir, 'app'), |
| 159 os.path.join(src_dir, 'chrome'), | 162 os.path.join(src_dir, 'chrome'), |
| 160 os.path.join(src_dir, 'chrome_frame'), | 163 os.path.join(src_dir, 'chrome_frame'), |
| 161 os.path.join(src_dir, 'content'), | 164 os.path.join(src_dir, 'content'), |
| 162 os.path.join(src_dir, 'ui'), | 165 os.path.join(src_dir, 'ui'), |
| 163 os.path.join(src_dir, 'views'), | 166 os.path.join(src_dir, 'views'), |
| 164 # nsNSSCertHelper.cpp has a bunch of ids | 167 # nsNSSCertHelper.cpp has a bunch of ids |
| 165 os.path.join(src_dir, 'third_party', 'mozilla_security_manager'), | 168 os.path.join(src_dir, 'third_party', 'mozilla_security_manager'), |
| 166 os.path.join(chrome_dir, 'installer'), | 169 os.path.join(chrome_dir, 'installer'), |
| 167 ] | 170 ] |
| 168 | 171 |
| 169 return CheckForUnusedGrdIDsInSources(grd_files, src_dirs) | 172 return CheckForUnusedGrdIDsInSources(grd_files, src_dirs) |
| 170 | 173 |
| 171 | 174 |
| 172 if __name__ == '__main__': | 175 if __name__ == '__main__': |
| 173 sys.exit(main()) | 176 sys.exit(main()) |
| OLD | NEW |