TabStripModel::GetActiveWebContents() might return NULL, and will cause a crash if...
[chromium-blink-merge.git] / chrome / chrome_resources.gyp
blob69917826231f74e624fb6e19b02496f7ae39c259
1 # Copyright (c) 2012 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   'variables': {
6     'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/chrome',
7     'about_credits_file': '<(SHARED_INTERMEDIATE_DIR)/about_credits.html',
8     'additional_modules_list_file': '<(SHARED_INTERMEDIATE_DIR)/chrome/browser/internal/additional_modules_list.txt',
9     'omnibox_mojom_file': '<(SHARED_INTERMEDIATE_DIR)/chrome/browser/ui/webui/omnibox/omnibox.mojom.js',
10   },
11   'targets': [
12     {
13       'target_name': 'chrome_extra_resources',
14       'type': 'none',
15       # These resources end up in resources.pak because they are resources
16       # used by internal pages.  Putting them in a separate pak file makes
17       # it easier for us to reference them internally.
18       'actions': [
19         {
20           'action_name': 'generate_memory_internals_resources',
21           'variables': {
22             'grit_grd_file': 'browser/resources/memory_internals_resources.grd',
23           },
24           'includes': [ '../build/grit_action.gypi' ],
25         },
26         {
27           'action_name': 'generate_net_internals_resources',
28           'variables': {
29             'grit_grd_file': 'browser/resources/net_internals_resources.grd',
30           },
31           'includes': [ '../build/grit_action.gypi' ],
32         },
33         {
34           'action_name': 'generate_invalidations_resources',
35           'variables': {
36             'grit_grd_file': 'browser/resources/invalidations_resources.grd',
37             },
38           'includes': ['../build/grit_action.gypi' ],
39         },
40         {
41           'action_name': 'generate_password_manager_internals_resources',
42           'variables': {
43             'grit_grd_file': 'browser/resources/password_manager_internals_resources.grd',
44           },
45           'includes': [ '../build/grit_action.gypi' ],
46         },
47         {
48           'action_name': 'generate_signin_internals_resources',
49           'variables': {
50             'grit_grd_file': 'browser/resources/signin_internals_resources.grd',
51             },
52           'includes': ['../build/grit_action.gypi' ],
53         },
54         {
55           'action_name': 'generate_sync_internals_resources',
56           'variables': {
57             'grit_grd_file': 'browser/resources/sync_internals_resources.grd',
58           },
59           'includes': [ '../build/grit_action.gypi' ],
60         },
61         {
62           'action_name': 'generate_translate_internals_resources',
63           'variables': {
64             'grit_grd_file': 'browser/resources/translate_internals_resources.grd',
65           },
66           'includes': [ '../build/grit_action.gypi' ],
67         },
68       ],
69       'includes': [ '../build/grit_target.gypi' ],
70       'conditions': [
71         ['OS != "ios"', {
72           'dependencies': [
73             '../components/components_resources.gyp:components_resources',
74             '../content/browser/devtools/devtools_resources.gyp:devtools_resources',
75             '../content/browser/tracing/tracing_resources.gyp:tracing_resources',
76           ],
77           'actions': [
78             {
79               'action_name': 'generate_component_extension_resources',
80               'variables': {
81                 'grit_grd_file': 'browser/resources/component_extension_resources.grd',
82               },
83               'includes': [ '../build/grit_action.gypi' ],
84             },
85             {
86               'action_name': 'generate_options_resources',
87               'variables': {
88                 'grit_grd_file': 'browser/resources/options_resources.grd',
89               },
90               'includes': [ '../build/grit_action.gypi' ],
91             },
92             {
93               'action_name': 'generate_quota_internals_resources',
94               'variables': {
95                 'grit_grd_file': 'browser/resources/quota_internals_resources.grd',
96               },
97               'includes': [ '../build/grit_action.gypi' ],
98             },
99             {
100               'action_name': 'generate_sync_file_system_internals_resources',
101               'variables': {
102                 'grit_grd_file': 'browser/resources/sync_file_system_internals_resources.grd',
103               },
104               'includes': [ '../build/grit_action.gypi' ],
105             },
106           ],
107           'copies': [
108             {
109               'destination': '<(PRODUCT_DIR)/resources/extension/demo',
110               'files': [
111                 'browser/resources/extension_resource/demo/library.js',
112               ],
113             },
114           ],
115         }],
116         ['chromeos==1 and disable_nacl==0 and disable_nacl_untrusted==0', {
117           'conditions': [
118             # TODO(dtseng): Remove use_chromevox_next once ChromeVox Next is ready for testing.
119             ['use_chromevox_next==1', {
120               'dependencies': [
121                 'browser/resources/chromeos/chromevox2/chromevox.gyp:chromevox2',
122               ],
123             }, { # else use_chromevox_next == 0
124               'dependencies': [
125                 'browser/resources/chromeos/chromevox/chromevox.gyp:chromevox',
126               ],
127             }],
128           ],
129         }],
130       ],
131     },
132     {
133       # GN version: //chrome/browser:chrome_internal_resources_gen
134       'target_name': 'chrome_internal_resources_gen',
135       'type': 'none',
136       'conditions': [
137         ['branding=="Chrome"', {
138           'actions': [
139             {
140               'action_name': 'generate_transform_additional_modules_list',
141               'variables': {
142                 'additional_modules_input_path':
143                   'browser/internal/resources/additional_modules_list.input',
144                 'additional_modules_py_path':
145                   'browser/internal/transform_additional_modules_list.py',
146               },
147               'inputs': [
148                 '<(additional_modules_input_path)',
149               ],
150               'outputs': [
151                 '<(additional_modules_list_file)',
152               ],
153               'action': [
154                 'python',
155                 '<(additional_modules_py_path)',
156                 '<(additional_modules_input_path)',
157                 '<@(_outputs)',
158               ],
159               'message': 'Transforming additional modules list',
160             }
161           ],
162         }],
163       ],
164     },
165     {
166       # TODO(mark): It would be better if each static library that needed
167       # to run grit would list its own .grd files, but unfortunately some
168       # of the static libraries currently have circular dependencies among
169       # generated headers.
171       # GN version: //chrome:resources
172       'target_name': 'chrome_resources',
173       'type': 'none',
174       'dependencies': [
175         'about_credits',
176         'chrome_internal_resources_gen',
177         'chrome_web_ui_mojo_bindings.gyp:web_ui_mojo_bindings',
178       ],
179       'actions': [
180         {
181           # GN version: //chrome/browser:resources
182           'action_name': 'generate_browser_resources',
183           'variables': {
184             'grit_grd_file': 'browser/browser_resources.grd',
185             'grit_additional_defines': [
186               '-E', 'about_credits_file=<(about_credits_file)',
187               '-E', 'additional_modules_list_file=<(additional_modules_list_file)',
188               '-E', 'omnibox_mojom_file=<(omnibox_mojom_file)',
189             ],
190           },
191           'includes': [ '../build/grit_action.gypi' ],
192         },
193         {
194           # GN version: //chrome/common:resources
195           'action_name': 'generate_common_resources',
196           'variables': {
197             'grit_grd_file': 'common/common_resources.grd',
198           },
199           'includes': [ '../build/grit_action.gypi' ],
200         },
201         {
202           # GN version: //chrome/renderer:resources
203           'action_name': 'generate_renderer_resources',
204           'variables': {
205             'grit_grd_file': 'renderer/resources/renderer_resources.grd',
206           },
207           'includes': [ '../build/grit_action.gypi' ],
208         },
209       ],
210       'conditions': [
211         ['enable_extensions==1', {
212           'actions': [
213             {
214               # GN version: //chrome/common:extensions_api_resources
215               'action_name': 'generate_extensions_api_resources',
216               'variables': {
217                 'grit_grd_file': 'common/extensions_api_resources.grd',
218               },
219               'includes': [ '../build/grit_action.gypi' ],
220             }
221           ],
222         }],
223       ],
224       'includes': [ '../build/grit_target.gypi' ],
225     },
226     {
227       # TODO(mark): It would be better if each static library that needed
228       # to run grit would list its own .grd files, but unfortunately some
229       # of the static libraries currently have circular dependencies among
230       # generated headers.
231       'target_name': 'chrome_strings',
232       'type': 'none',
233       'actions': [
234         {
235           'action_name': 'generate_locale_settings',
236           'variables': {
237             'grit_grd_file': 'app/resources/locale_settings.grd',
238           },
239           'includes': [ '../build/grit_action.gypi' ],
240         },
241         {
242           'action_name': 'generate_chromium_strings',
243           'variables': {
244             'grit_grd_file': 'app/chromium_strings.grd',
245           },
246           'includes': [ '../build/grit_action.gypi' ],
247         },
248         {
249           'action_name': 'generate_generated_resources',
250           'variables': {
251             'grit_grd_file': 'app/generated_resources.grd',
252           },
253           'includes': [ '../build/grit_action.gypi' ],
254         },
255         {
256           'action_name': 'generate_google_chrome_strings',
257           'variables': {
258             'grit_grd_file': 'app/google_chrome_strings.grd',
259           },
260           'includes': [ '../build/grit_action.gypi' ],
261         },
262       ],
263       'includes': [ '../build/grit_target.gypi' ],
264     },
265     {
266       'target_name': 'chrome_strings_map',
267       'type': 'none',
268       'dependencies': [ 'chrome_strings', ],
269       'actions': [
270         {
271           'action_name': 'generate_resources_map',
272           'inputs': [
273             '<(grit_out_dir)/grit/generated_resources.h'
274           ],
275           'outputs': [
276             '<(SHARED_INTERMEDIATE_DIR)/chrome/browser/metrics/variations/generated_resources_map.cc',
277           ],
278           'action': [
279             'python',
280             'browser/metrics/variations/generate_resources_map.py',
281             '<(grit_out_dir)/grit/generated_resources.h',
282             '<(SHARED_INTERMEDIATE_DIR)/chrome/browser/metrics/variations/generated_resources_map.cc'
283           ],
284           'message': 'Generating generated resources map.',
285         }
286       ],
287     },
288     {
289       'target_name': 'platform_locale_settings',
290       'type': 'none',
291       'variables': {
292         'conditions': [
293           ['OS=="win"', {
294             'platform_locale_settings_grd':
295                 'app/resources/locale_settings_win.grd',
296           },],
297           ['OS=="linux"', {
298             'conditions': [
299               ['chromeos==1', {
300                 'conditions': [
301                   ['branding=="Chrome"', {
302                     'platform_locale_settings_grd':
303                         'app/resources/locale_settings_google_chromeos.grd',
304                   }, {  # branding!=Chrome
305                     'platform_locale_settings_grd':
306                         'app/resources/locale_settings_chromiumos.grd',
307                   }],
308                 ]
309               }, {  # chromeos==0
310                 'platform_locale_settings_grd':
311                     'app/resources/locale_settings_linux.grd',
312               }],
313             ],
314           },],
315           ['os_posix == 1 and OS != "mac" and OS != "ios" and OS != "linux"', {
316             'platform_locale_settings_grd':
317                 'app/resources/locale_settings_linux.grd',
318           },],
319           ['OS == "mac" or OS == "ios"', {
320             'platform_locale_settings_grd':
321                 'app/resources/locale_settings_mac.grd',
322           }],
323         ],  # conditions
324       },  # variables
325       'actions': [
326         {
327           'action_name': 'generate_platform_locale_settings',
328           'variables': {
329             'grit_grd_file': '<(platform_locale_settings_grd)',
330           },
331           'includes': [ '../build/grit_action.gypi' ],
332         },
333       ],
334       'includes': [ '../build/grit_target.gypi' ],
335     },
336     {
337       'target_name': 'theme_resources',
338       'type': 'none',
339       'dependencies': [
340         '../ui/resources/ui_resources.gyp:ui_resources',
341         'chrome_unscaled_resources',
342       ],
343       'actions': [
344         {
345           'action_name': 'generate_theme_resources',
346           'variables': {
347             'grit_grd_file': 'app/theme/theme_resources.grd',
348           },
349           'includes': [ '../build/grit_action.gypi' ],
350         },
351       ],
352       'includes': [ '../build/grit_target.gypi' ],
353     },
354     {
355       'target_name': 'packed_extra_resources',
356       'type': 'none',
357       'dependencies': [
358         'chrome_extra_resources',
359         'packed_resources',
360       ],
361       'actions': [
362         {
363           'includes': ['chrome_repack_resources.gypi']
364         },
365       ],
366       'conditions': [
367         ['OS != "mac" and OS != "ios"', {
368           # We'll install the resource files to the product directory.  The Mac
369           # copies the results over as bundle resources in its own special way.
370           'copies': [
371             {
372               'destination': '<(PRODUCT_DIR)',
373               'files': [
374                 '<(SHARED_INTERMEDIATE_DIR)/repack/resources.pak'
375               ],
376             },
377           ],
378         }],
379       ],
380     },
381     {
382       'target_name': 'packed_resources',
383       'type': 'none',
384       'dependencies': [
385         # MSVS needs the dependencies explictly named, Make is able to
386         # derive the dependencies from the output files.
387         'chrome_resources',
388         'chrome_strings',
389         'platform_locale_settings',
390         'theme_resources',
391         '<(DEPTH)/components/components_strings.gyp:components_strings',
392         '<(DEPTH)/net/net.gyp:net_resources',
393         '<(DEPTH)/ui/resources/ui_resources.gyp:ui_resources',
394         '<(DEPTH)/ui/strings/ui_strings.gyp:ui_strings',
395       ],
396       'actions': [
397         {
398           'action_name': 'repack_locales_pack',
399           'variables': {
400             'pak_locales': '<(locales)',
401           },
402           'includes': ['chrome_repack_locales.gypi']
403         },
404         {
405           'action_name': 'repack_pseudo_locales_pack',
406           'variables': {
407             'pak_locales': '<(pseudo_locales)',
408           },
409           'includes': ['chrome_repack_locales.gypi']
410         },
411         {
412           'includes': ['chrome_repack_chrome_100_percent.gypi']
413         },
414         {
415           'includes': ['chrome_repack_chrome_200_percent.gypi']
416         },
417       ],
418       'conditions': [
419         ['OS != "ios"', {
420           'dependencies': [
421             '<(DEPTH)/content/content_resources.gyp:content_resources',
422             '<(DEPTH)/device/bluetooth/bluetooth_strings.gyp:device_bluetooth_strings',
423             '<(DEPTH)/extensions/extensions_strings.gyp:extensions_strings',
424             '<(DEPTH)/webkit/webkit_resources.gyp:webkit_resources',
425             '<(DEPTH)/webkit/webkit_resources.gyp:webkit_strings',
426           ],
427         }],
428         ['use_ash==1', {
429           'dependencies': [
430              '<(DEPTH)/ash/ash_resources.gyp:ash_resources',
431              '<(DEPTH)/ash/ash_strings.gyp:ash_strings',
432           ],
433         }],
434         ['enable_autofill_dialog==1 and OS!="android"', {
435           'dependencies': [
436             '<(DEPTH)/third_party/libaddressinput/libaddressinput.gyp:libaddressinput_strings',
437           ],
438         }],
439         ['OS != "mac" and OS != "ios"', {
440           # Copy pak files to the product directory. These files will be picked
441           # up by the following installer scripts:
442           #   - Windows: chrome/installer/mini_installer/chrome.release
443           #   - Linux: chrome/installer/linux/internal/common/installer.include
444           # Ensure that the above scripts are updated when adding or removing
445           # pak files.
446           # Copying files to the product directory is not needed on the Mac
447           # since the framework build phase will copy them into the framework
448           # bundle directly.
449           'copies': [
450             {
451               'destination': '<(PRODUCT_DIR)',
452               'files': [
453                 '<(SHARED_INTERMEDIATE_DIR)/repack/chrome_100_percent.pak'
454               ],
455             },
456             {
457               'destination': '<(PRODUCT_DIR)/locales',
458               'files': [
459                 '<!@pymod_do_main(repack_locales -o -p <(OS) -g <(grit_out_dir) -s <(SHARED_INTERMEDIATE_DIR) -x <(SHARED_INTERMEDIATE_DIR) <(locales))'
460               ],
461             },
462             {
463               'destination': '<(PRODUCT_DIR)/pseudo_locales',
464               'files': [
465                 '<!@pymod_do_main(repack_locales -o -p <(OS) -g <(grit_out_dir) -s <(SHARED_INTERMEDIATE_DIR) -x <(SHARED_INTERMEDIATE_DIR) <(pseudo_locales))'
466               ],
467             },
468           ],
469           'conditions': [
470             ['branding=="Chrome"', {
471               'copies': [
472                 {
473                   # This location is for the Windows and Linux builds. For
474                   # Windows, the chrome.release file ensures that these files
475                   # are copied into the installer. Note that we have a separate
476                   # section in chrome_dll.gyp to copy these files for Mac, as it
477                   # needs to be dropped inside the framework.
478                   'destination': '<(PRODUCT_DIR)/default_apps',
479                   'files': ['<@(default_apps_list)']
480                 },
481               ],
482             }],
483             ['enable_hidpi == 1', {
484               'copies': [
485                 {
486                   'destination': '<(PRODUCT_DIR)',
487                   'files': [
488                     '<(SHARED_INTERMEDIATE_DIR)/repack/chrome_200_percent.pak',
489                   ],
490                 },
491               ],
492             }],
493           ], # conditions
494         }], # end OS != "mac" and OS != "ios"
495       ], # conditions
496     },
497     {
498       'target_name': 'chrome_unscaled_resources',
499       'type': 'none',
500       'actions': [
501         {
502           'action_name': 'generate_chrome_unscaled_resources',
503           'variables': {
504             'grit_grd_file': 'app/theme/chrome_unscaled_resources.grd',
505           },
506           'includes': [ '../build/grit_action.gypi' ],
507         },
508       ],
509       'includes': [ '../build/grit_target.gypi' ],
510     },
511     {
512       # GN version: //chrome/browser:about_credits
513       'target_name': 'about_credits',
514       'type': 'none',
515       'actions': [
516         {
517           'variables': {
518             'generator_path': '../tools/licenses.py',
519           },
520           'action_name': 'generate_about_credits',
521           'inputs': [
522             # TODO(phajdan.jr): make licenses.py print inputs too.
523             '<(generator_path)',
524           ],
525           'outputs': [
526             '<(about_credits_file)',
527           ],
528           'hard_dependency': 1,
529           'action': ['python',
530                      '<(generator_path)',
531                      'credits',
532                      '<(about_credits_file)',
533           ],
534           'message': 'Generating about:credits',
535         },
536       ],
537     },
538   ], # targets