Content settings: remove some plugin-related code/resources when... there are no...
[chromium-blink-merge.git] / content / shell / BUILD.gn
blobe90f2817b2579c244cc9ca660bd376778da186e4
1 # Copyright 2014 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 import("//build/config/features.gni")
6 import("//build/config/ui.gni")
7 import("//build/config/win/manifest.gni")
8 import("//tools/grit/repack.gni")
9 import("//tools/grit/grit_rule.gni")
10 if (is_android) {
11   import("//build/config/android/config.gni")
14 declare_args() {
15   content_shell_product_name = "Content Shell"
17   # The "19" is so that sites that sniff for version think that this is
18   # something reasonably current; the "77.34.5" is a hint that this isn't a
19   # standard Chrome.
20   content_shell_version = "19.77.34.5"
23 static_library("content_shell_lib") {
24   testonly = true
25   sources = [
26     "android/shell_jni_registrar.cc",
27     "android/shell_jni_registrar.h",
28     "android/shell_manager.cc",
29     "android/shell_manager.h",
30     "app/blink_test_platform_support.h",
31     "app/blink_test_platform_support_android.cc",
32     "app/blink_test_platform_support_linux.cc",
33     "app/blink_test_platform_support_mac.mm",
34     "app/blink_test_platform_support_win.cc",
35     "app/paths_mac.h",
36     "app/paths_mac.mm",
37     "app/shell_crash_reporter_client.cc",
38     "app/shell_crash_reporter_client.h",
39     "app/shell_main_delegate.cc",
40     "app/shell_main_delegate.h",
41     "app/shell_main_delegate_mac.h",
42     "app/shell_main_delegate_mac.mm",
43     "browser/blink_test_controller.cc",
44     "browser/blink_test_controller.h",
45     "browser/ipc_echo_message_filter.cc",
46     "browser/ipc_echo_message_filter.h",
47     "browser/layout_test/layout_test_android.cc",
48     "browser/layout_test/layout_test_android.h",
49     "browser/layout_test/layout_test_bluetooth_adapter_provider.cc",
50     "browser/layout_test/layout_test_bluetooth_adapter_provider.h",
51     "browser/layout_test/layout_test_bluetooth_chooser_factory.cc",
52     "browser/layout_test/layout_test_bluetooth_chooser_factory.h",
53     "browser/layout_test/layout_test_browser_context.cc",
54     "browser/layout_test/layout_test_browser_context.h",
55     "browser/layout_test/layout_test_browser_main.cc",
56     "browser/layout_test/layout_test_browser_main.h",
57     "browser/layout_test/layout_test_browser_main_parts.cc",
58     "browser/layout_test/layout_test_browser_main_parts.h",
59     "browser/layout_test/layout_test_content_browser_client.cc",
60     "browser/layout_test/layout_test_content_browser_client.h",
61     "browser/layout_test/layout_test_devtools_frontend.cc",
62     "browser/layout_test/layout_test_devtools_frontend.h",
63     "browser/layout_test/layout_test_download_manager_delegate.cc",
64     "browser/layout_test/layout_test_download_manager_delegate.h",
65     "browser/layout_test/layout_test_javascript_dialog_manager.cc",
66     "browser/layout_test/layout_test_javascript_dialog_manager.h",
67     "browser/layout_test/layout_test_message_filter.cc",
68     "browser/layout_test/layout_test_message_filter.h",
69     "browser/layout_test/layout_test_navigator_connect_service_factory.cc",
70     "browser/layout_test/layout_test_navigator_connect_service_factory.h",
71     "browser/layout_test/layout_test_notification_manager.cc",
72     "browser/layout_test/layout_test_notification_manager.h",
73     "browser/layout_test/layout_test_permission_manager.cc",
74     "browser/layout_test/layout_test_permission_manager.h",
75     "browser/layout_test/layout_test_push_messaging_service.cc",
76     "browser/layout_test/layout_test_push_messaging_service.h",
77     "browser/layout_test/layout_test_resource_dispatcher_host_delegate.cc",
78     "browser/layout_test/layout_test_resource_dispatcher_host_delegate.h",
79     "browser/layout_test/layout_test_url_request_context_getter.cc",
80     "browser/layout_test/layout_test_url_request_context_getter.h",
81     "browser/notify_done_forwarder.cc",
82     "browser/notify_done_forwarder.h",
83     "browser/shell.cc",
84     "browser/shell.h",
85     "browser/shell_access_token_store.cc",
86     "browser/shell_access_token_store.h",
87     "browser/shell_android.cc",
88     "browser/shell_application_mac.h",
89     "browser/shell_application_mac.mm",
90     "browser/shell_browser_context.cc",
91     "browser/shell_browser_context.h",
92     "browser/shell_browser_main.cc",
93     "browser/shell_browser_main.h",
94     "browser/shell_browser_main_parts.cc",
95     "browser/shell_browser_main_parts.h",
96     "browser/shell_browser_main_parts_mac.mm",
97     "browser/shell_content_browser_client.cc",
98     "browser/shell_content_browser_client.h",
99     "browser/shell_devtools_frontend.cc",
100     "browser/shell_devtools_frontend.h",
101     "browser/shell_devtools_manager_delegate.cc",
102     "browser/shell_devtools_manager_delegate.h",
103     "browser/shell_download_manager_delegate.cc",
104     "browser/shell_download_manager_delegate.h",
105     "browser/shell_javascript_dialog.h",
106     "browser/shell_javascript_dialog_mac.mm",
107     "browser/shell_javascript_dialog_manager.cc",
108     "browser/shell_javascript_dialog_manager.h",
109     "browser/shell_javascript_dialog_win.cc",
110     "browser/shell_login_dialog.cc",
111     "browser/shell_login_dialog.h",
112     "browser/shell_login_dialog_mac.mm",
113     "browser/shell_mac.mm",
114     "browser/shell_mojo_test_utils_android.cc",
115     "browser/shell_mojo_test_utils_android.h",
116     "browser/shell_net_log.cc",
117     "browser/shell_net_log.h",
118     "browser/shell_network_delegate.cc",
119     "browser/shell_network_delegate.h",
120     "browser/shell_permission_manager.cc",
121     "browser/shell_permission_manager.h",
122     "browser/shell_platform_data_aura.cc",
123     "browser/shell_platform_data_aura.h",
124     "browser/shell_plugin_service_filter.cc",
125     "browser/shell_plugin_service_filter.h",
126     "browser/shell_quota_permission_context.cc",
127     "browser/shell_quota_permission_context.h",
128     "browser/shell_resource_dispatcher_host_delegate.cc",
129     "browser/shell_resource_dispatcher_host_delegate.h",
130     "browser/shell_speech_recognition_manager_delegate.cc",
131     "browser/shell_speech_recognition_manager_delegate.h",
132     "browser/shell_url_request_context_getter.cc",
133     "browser/shell_url_request_context_getter.h",
134     "browser/shell_web_contents_view_delegate.h",
135     "browser/shell_web_contents_view_delegate_android.cc",
136     "browser/shell_web_contents_view_delegate_creator.h",
137     "browser/shell_web_contents_view_delegate_mac.mm",
138     "browser/shell_web_contents_view_delegate_win.cc",
139     "common/layout_test/layout_test_messages.cc",
140     "common/layout_test/layout_test_messages.h",
141     "common/leak_detection_result.h",
142     "common/shell_content_client.cc",
143     "common/shell_content_client.h",
144     "common/shell_messages.cc",
145     "common/shell_messages.h",
146     "common/shell_switches.cc",
147     "common/shell_switches.h",
148     "common/shell_test_configuration.cc",
149     "common/shell_test_configuration.h",
150     "renderer/ipc_echo.cc",
151     "renderer/ipc_echo.h",
152     "renderer/layout_test/blink_test_helpers.cc",
153     "renderer/layout_test/blink_test_helpers.h",
154     "renderer/layout_test/blink_test_runner.cc",
155     "renderer/layout_test/blink_test_runner.h",
156     "renderer/layout_test/gc_controller.cc",
157     "renderer/layout_test/gc_controller.h",
158     "renderer/layout_test/layout_test_content_renderer_client.cc",
159     "renderer/layout_test/layout_test_content_renderer_client.h",
160     "renderer/layout_test/layout_test_render_frame_observer.cc",
161     "renderer/layout_test/layout_test_render_frame_observer.h",
162     "renderer/layout_test/layout_test_render_process_observer.cc",
163     "renderer/layout_test/layout_test_render_process_observer.h",
164     "renderer/layout_test/leak_detector.cc",
165     "renderer/layout_test/leak_detector.h",
166     "renderer/layout_test/test_media_stream_renderer_factory.cc",
167     "renderer/layout_test/test_media_stream_renderer_factory.h",
168     "renderer/layout_test/test_video_frame_provider.cc",
169     "renderer/layout_test/test_video_frame_provider.h",
170     "renderer/shell_content_renderer_client.cc",
171     "renderer/shell_content_renderer_client.h",
172     "renderer/shell_render_view_observer.cc",
173     "renderer/shell_render_view_observer.h",
174     "utility/shell_content_utility_client.cc",
175     "utility/shell_content_utility_client.h",
176   ]
178   configs += [
179     "//build/config:precompiled_headers",
181     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
182     "//build/config/compiler:no_size_t_to_int_warning",
183   ]
185   defines = [ "CONTENT_SHELL_VERSION=\"$content_shell_version\"" ]
187   public_deps = [
188     # This exposes all public content APIs.
189     "//content/public/app:both",
190     "//content/public/browser",
191     "//content/public/common",
192     "//content/public/plugin",
193     "//content/public/renderer",
194     "//content/public/utility",
195   ]
196   deps = [
197     ":resources",
198     "//base",
199     "//base:base_static",
200     "//base/allocator",
201     "//base/third_party/dynamic_annotations",
202     "//cc",
203     "//components/crash/app",
204     "//components/devtools_discovery",
205     "//components/devtools_http_handler",
206     "//components/plugins/renderer",
207     "//components/test_runner:test_runner",
208     "//components/url_formatter",
209     "//components/web_cache/renderer",
210     "//content:resources",
211     "//content/app/resources",
212     "//content/app/strings",
213     "//content/gpu",
214     "//content/test:layouttest_support",
215     "//device/bluetooth",
216     "//device/bluetooth:mocks",
217     "//gin",
218     "//gpu",
219     "//ipc",
220     "//media",
221     "//net",
222     "//net:net_resources",
223     "//skia",
224     "//storage/browser",
225     "//testing/gmock",
226     "//testing/gtest",
227     "//third_party/WebKit/public:blink",
228     "//third_party/WebKit/public:image_resources",
229     "//third_party/WebKit/public:resources",
230     "//third_party/WebKit/public:test_support",
231     "//third_party/icu",
232     "//ui/base",
233     "//ui/base/ime",
234     "//ui/events:events_base",
235     "//ui/gfx",
236     "//ui/gfx/geometry",
237     "//ui/gfx/ipc",
238     "//ui/gl",
239     "//url",
240     "//v8",
242     #'copy_test_netscape_plugin',  TODO(GYP)
243   ]
244   if (enable_plugins) {
245     deps += [ "//content/ppapi_plugin" ]
246   }
248   if (is_win) {
249     #'LinkIncremental': '<(msvs_large_module_debug_link_mode)',  TODO(GYP)
250     sources += [
251       "common/v8_breakpad_support_win.cc",
252       "common/v8_breakpad_support_win.h",
253     ]
254   }
256   if (is_linux) {
257     configs += [ "//build/config/linux:fontconfig" ]
258   }
260   if (use_x11) {
261     # Some tests rely on this tool at runtime. Note: it might be better if
262     # the tests that needed it had this as a dep instead of adding it here.
263     datadeps = [
264       "//tools/xdisplaycheck",
265     ]
267     deps += [ "//ui/events/devices" ]
268   }
270   if (is_android) {
271     deps += [ "//content/shell/android:content_shell_jni_headers" ]
272     #deps -= [ "copy_test_netscape_plugin" ]  TODO(GYP)
273   }
275   if (is_posix && !is_mac) {
276     deps += [ "//components/crash/browser" ]
277   }
279   if (use_aura) {
280     deps += [
281       "//ui/aura",
282       "//ui/aura:test_support",
283       "//ui/events",
284       "//ui/strings",
285       "//ui/wm",
286     ]
288     if (toolkit_views) {
289       sources += [ "browser/shell_views.cc" ]
290       deps += [
291         "//ui/resources",
292         "//ui/views/controls/webview",
293         "//ui/views",
294         "//ui/views:test_support",
295       ]
296     } else {
297       sources += [ "browser/shell_aura.cc" ]
298     }
299   } else {
300     sources -= [
301       "browser/shell_platform_data_aura.cc",
302       "browser/shell_platform_data_aura.h",
303     ]
304   }
306   # The test plugin relies on X11.
307   if (is_linux && !use_x11) {
308     #deps -= [ 'copy_test_netscape_plugin' ]  TODO(GYP)
309   }
311   if (is_chromeos) {
312     deps += [
313       "//chromeos",
314       "//ui/wm:test_support",
315     ]
316   }
318   if (is_linux) {
319     deps += [ "//third_party/freetype2" ]
320   }
322   if (!enable_plugins) {
323     sources -= [
324       "browser/shell_plugin_service_filter.cc",
325       "browser/shell_plugin_service_filter.h",
326     ]
327   }
330 grit("content_shell_resources_grit") {
331   visibility = [ ":*" ]
332   source = "shell_resources.grd"
333   outputs = [
334     "grit/shell_resources.h",
335     "shell_resources.pak",
336   ]
339 copy("copy_shell_resources") {
340   sources = [
341     "$target_gen_dir/shell_resources.pak",
342   ]
343   outputs = [
344     "$root_out_dir/shell_resources.pak",
345   ]
347   public_deps = [
348     ":content_shell_resources_grit",
349   ]
352 group("resources") {
353   public_deps = [
354     ":copy_shell_resources",
355   ]
356   deps = [
357     "//components/test_runner:resources",
358   ]
361 repack("pak") {
362   sources = [
363     "$root_gen_dir/blink/public/resources/blink_image_resources_100_percent.pak",
364     "$root_gen_dir/blink/public/resources/blink_resources.pak",
365     "$root_gen_dir/content/app/resources/content_resources_100_percent.pak",
366     "$root_gen_dir/content/app/strings/content_strings_en-US.pak",
367     "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
368     "$root_gen_dir/content/content_resources.pak",
369     "$root_gen_dir/content/shell/shell_resources.pak",
370     "$root_gen_dir/net/net_resources.pak",
371     "$root_gen_dir/ui/resources/ui_resources_100_percent.pak",
372     "$root_gen_dir/ui/resources/webui_resources.pak",
373     "$root_gen_dir/ui/strings/app_locale_settings_en-US.pak",
374     "$root_gen_dir/ui/strings/ui_strings_en-US.pak",
375   ]
377   deps = [
378     ":resources",
379     "//content:resources",
380     "//content/app/resources",
381     "//content/app/strings",
382     "//content/browser/tracing:resources",
383     "//net:net_resources",
384     "//third_party/WebKit/public:image_resources",
385     "//third_party/WebKit/public:resources",
386     "//ui/resources",
387     "//ui/strings",
388   ]
390   if (toolkit_views) {
391     deps += [ "//ui/views/resources" ]
392     sources +=
393         [ "$root_gen_dir/ui/views/resources/views_resources_100_percent.pak" ]
394   }
396   sources += [ "$root_gen_dir/blink/devtools_resources.pak" ]
397   deps += [ "//content/browser/devtools:resources" ]
398   output = "$root_out_dir/content_shell.pak"
401 # TODO(GYP): Figure out what this should be on android
402 # and make linking this work on the Mac.
403 if (!is_android && !is_mac) {
404   # TODO(brettw) when GYP is no longer necessary, delete
405   # content/shell/app/shell.exe.manifest. This file is not used in GN.
406   executable("content_shell") {
407     testonly = true
409     # TODO(GYP) mac resource bundle stuff for this target.
410     # TODO(GYP) Windows content shell settings:
411     #  - RC file.
412     #  - 'LinkIncremental': '<(msvs_large_module_debug_link_mode)',
413     sources = [
414       "app/shell_main.cc",
415     ]
417     deps = [
418       ":content_shell_lib",
419       ":pak",
420       "//base/allocator",
421       "//build/config/sanitizers:deps",
422       "//build/win:default_exe_manifest",
423     ]
425     if (is_win) {
426       deps += [ "//sandbox" ]
427       if (!is_asan) {
428         configs -= [ "//build/config/win:console" ]
429         configs += [ "//build/config/win:windowed" ]
430       }
431     }
433     if (is_mac) {
434       # TODO(GYP) lots of stuff from GYP file here.
435     }
437     if (is_android) {
438       # Some tests rely on this tool. It might be nicer if these tests relied on
439       # image diff rather than having content shell depend on it.
440       datadeps = [
441         "//tools/imagediff($host_toolchain)",
442       ]
443     }
444   }
445 } else {
446   group("content_shell") {
447     testonly = true
448     deps = [
449       ":content_shell_lib",
450     ]
451   }
454 if (is_win) {
455   # GYP version: content/content_shell_and_tests.gyp:content_shell_crash_service
456   executable("crash_service") {
457     sources = [
458       "tools/content_shell_crash_service.cc",
459     ]
461     deps = [
462       "//base",
463       "//build/config/sanitizers:deps",
464       "//components/crash/tools:crash_service",
465     ]
467     configs -= [ "//build/config/win:console" ]
468     configs += [ "//build/config/win:windowed" ]
469   }