Make USB permissions work in the new permission message system
[chromium-blink-merge.git] / content / shell / BUILD.gn
blob91e8d283db86c925446c6f5f18fcc2cbe1a71cd2
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_browser_context.cc",
52     "browser/layout_test/layout_test_browser_context.h",
53     "browser/layout_test/layout_test_browser_main.cc",
54     "browser/layout_test/layout_test_browser_main.h",
55     "browser/layout_test/layout_test_browser_main_parts.cc",
56     "browser/layout_test/layout_test_browser_main_parts.h",
57     "browser/layout_test/layout_test_content_browser_client.cc",
58     "browser/layout_test/layout_test_content_browser_client.h",
59     "browser/layout_test/layout_test_devtools_frontend.cc",
60     "browser/layout_test/layout_test_devtools_frontend.h",
61     "browser/layout_test/layout_test_download_manager_delegate.cc",
62     "browser/layout_test/layout_test_download_manager_delegate.h",
63     "browser/layout_test/layout_test_javascript_dialog_manager.cc",
64     "browser/layout_test/layout_test_javascript_dialog_manager.h",
65     "browser/layout_test/layout_test_message_filter.cc",
66     "browser/layout_test/layout_test_message_filter.h",
67     "browser/layout_test/layout_test_navigator_connect_service_factory.cc",
68     "browser/layout_test/layout_test_navigator_connect_service_factory.h",
69     "browser/layout_test/layout_test_notification_manager.cc",
70     "browser/layout_test/layout_test_notification_manager.h",
71     "browser/layout_test/layout_test_permission_manager.cc",
72     "browser/layout_test/layout_test_permission_manager.h",
73     "browser/layout_test/layout_test_push_messaging_service.cc",
74     "browser/layout_test/layout_test_push_messaging_service.h",
75     "browser/layout_test/layout_test_resource_dispatcher_host_delegate.cc",
76     "browser/layout_test/layout_test_resource_dispatcher_host_delegate.h",
77     "browser/layout_test/layout_test_url_request_context_getter.cc",
78     "browser/layout_test/layout_test_url_request_context_getter.h",
79     "browser/notify_done_forwarder.cc",
80     "browser/notify_done_forwarder.h",
81     "browser/shell.cc",
82     "browser/shell.h",
83     "browser/shell_access_token_store.cc",
84     "browser/shell_access_token_store.h",
85     "browser/shell_android.cc",
86     "browser/shell_application_mac.h",
87     "browser/shell_application_mac.mm",
88     "browser/shell_browser_context.cc",
89     "browser/shell_browser_context.h",
90     "browser/shell_browser_main.cc",
91     "browser/shell_browser_main.h",
92     "browser/shell_browser_main_parts.cc",
93     "browser/shell_browser_main_parts.h",
94     "browser/shell_browser_main_parts_mac.mm",
95     "browser/shell_content_browser_client.cc",
96     "browser/shell_content_browser_client.h",
97     "browser/shell_devtools_frontend.cc",
98     "browser/shell_devtools_frontend.h",
99     "browser/shell_devtools_manager_delegate.cc",
100     "browser/shell_devtools_manager_delegate.h",
101     "browser/shell_download_manager_delegate.cc",
102     "browser/shell_download_manager_delegate.h",
103     "browser/shell_javascript_dialog.h",
104     "browser/shell_javascript_dialog_mac.mm",
105     "browser/shell_javascript_dialog_manager.cc",
106     "browser/shell_javascript_dialog_manager.h",
107     "browser/shell_javascript_dialog_win.cc",
108     "browser/shell_login_dialog.cc",
109     "browser/shell_login_dialog.h",
110     "browser/shell_login_dialog_mac.mm",
111     "browser/shell_mac.mm",
112     "browser/shell_mojo_test_utils_android.cc",
113     "browser/shell_mojo_test_utils_android.h",
114     "browser/shell_net_log.cc",
115     "browser/shell_net_log.h",
116     "browser/shell_network_delegate.cc",
117     "browser/shell_network_delegate.h",
118     "browser/shell_permission_manager.cc",
119     "browser/shell_permission_manager.h",
120     "browser/shell_platform_data_aura.cc",
121     "browser/shell_platform_data_aura.h",
122     "browser/shell_plugin_service_filter.cc",
123     "browser/shell_plugin_service_filter.h",
124     "browser/shell_quota_permission_context.cc",
125     "browser/shell_quota_permission_context.h",
126     "browser/shell_resource_dispatcher_host_delegate.cc",
127     "browser/shell_resource_dispatcher_host_delegate.h",
128     "browser/shell_speech_recognition_manager_delegate.cc",
129     "browser/shell_speech_recognition_manager_delegate.h",
130     "browser/shell_url_request_context_getter.cc",
131     "browser/shell_url_request_context_getter.h",
132     "browser/shell_web_contents_view_delegate.h",
133     "browser/shell_web_contents_view_delegate_android.cc",
134     "browser/shell_web_contents_view_delegate_creator.h",
135     "browser/shell_web_contents_view_delegate_mac.mm",
136     "browser/shell_web_contents_view_delegate_win.cc",
137     "common/layout_test/layout_test_messages.cc",
138     "common/layout_test/layout_test_messages.h",
139     "common/leak_detection_result.h",
140     "common/shell_content_client.cc",
141     "common/shell_content_client.h",
142     "common/shell_messages.cc",
143     "common/shell_messages.h",
144     "common/shell_switches.cc",
145     "common/shell_switches.h",
146     "common/shell_test_configuration.cc",
147     "common/shell_test_configuration.h",
148     "renderer/ipc_echo.cc",
149     "renderer/ipc_echo.h",
150     "renderer/layout_test/blink_test_helpers.cc",
151     "renderer/layout_test/blink_test_helpers.h",
152     "renderer/layout_test/blink_test_runner.cc",
153     "renderer/layout_test/blink_test_runner.h",
154     "renderer/layout_test/gc_controller.cc",
155     "renderer/layout_test/gc_controller.h",
156     "renderer/layout_test/layout_test_content_renderer_client.cc",
157     "renderer/layout_test/layout_test_content_renderer_client.h",
158     "renderer/layout_test/layout_test_render_frame_observer.cc",
159     "renderer/layout_test/layout_test_render_frame_observer.h",
160     "renderer/layout_test/layout_test_render_process_observer.cc",
161     "renderer/layout_test/layout_test_render_process_observer.h",
162     "renderer/layout_test/leak_detector.cc",
163     "renderer/layout_test/leak_detector.h",
164     "renderer/layout_test/test_media_stream_renderer_factory.cc",
165     "renderer/layout_test/test_media_stream_renderer_factory.h",
166     "renderer/layout_test/test_video_frame_provider.cc",
167     "renderer/layout_test/test_video_frame_provider.h",
168     "renderer/shell_content_renderer_client.cc",
169     "renderer/shell_content_renderer_client.h",
170     "renderer/shell_render_view_observer.cc",
171     "renderer/shell_render_view_observer.h",
172     "utility/shell_content_utility_client.cc",
173     "utility/shell_content_utility_client.h",
174   ]
176   configs += [
177     "//build/config:precompiled_headers",
179     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
180     "//build/config/compiler:no_size_t_to_int_warning",
181   ]
183   defines = [ "CONTENT_SHELL_VERSION=\"$content_shell_version\"" ]
185   public_deps = [
186     # This exposes all public content APIs.
187     "//content/public/app:both",
188     "//content/public/browser",
189     "//content/public/common",
190     "//content/public/plugin",
191     "//content/public/renderer",
192     "//content/public/utility",
193   ]
194   deps = [
195     ":resources",
196     "//base",
197     "//base:base_static",
198     "//base/allocator",
199     "//base/third_party/dynamic_annotations",
200     "//cc",
201     "//components/crash/app",
202     "//components/devtools_discovery",
203     "//components/devtools_http_handler",
204     "//components/plugins/renderer",
205     "//components/test_runner:test_runner",
206     "//components/url_formatter",
207     "//components/web_cache/renderer",
208     "//content:resources",
209     "//content/app/resources",
210     "//content/app/strings",
211     "//content/gpu",
212     "//content/test:layouttest_support",
213     "//device/bluetooth",
214     "//device/bluetooth:mocks",
215     "//gin",
216     "//gpu",
217     "//ipc",
218     "//media",
219     "//net",
220     "//net:net_resources",
221     "//skia",
222     "//storage/browser",
223     "//testing/gmock",
224     "//testing/gtest",
225     "//third_party/WebKit/public:blink",
226     "//third_party/WebKit/public:image_resources",
227     "//third_party/WebKit/public:resources",
228     "//third_party/WebKit/public:test_support",
229     "//third_party/icu",
230     "//ui/base",
231     "//ui/base/ime",
232     "//ui/events:events_base",
233     "//ui/gfx",
234     "//ui/gfx/geometry",
235     "//ui/gfx/ipc",
236     "//ui/gl",
237     "//url",
238     "//v8",
240     #'copy_test_netscape_plugin',  TODO(GYP)
241   ]
242   if (enable_plugins) {
243     deps += [ "//content/ppapi_plugin" ]
244   }
246   if (is_win) {
247     #'LinkIncremental': '<(msvs_large_module_debug_link_mode)',  TODO(GYP)
248     sources += [
249       "common/v8_breakpad_support_win.cc",
250       "common/v8_breakpad_support_win.h",
251     ]
252   }
254   if (is_linux) {
255     configs += [ "//build/config/linux:fontconfig" ]
256   }
258   if (use_x11) {
259     # Some tests rely on this tool at runtime. Note: it might be better if
260     # the tests that needed it had this as a dep instead of adding it here.
261     datadeps = [
262       "//tools/xdisplaycheck",
263     ]
265     deps += [ "//ui/events/devices" ]
266   }
268   if (is_android) {
269     deps += [ "//content/shell/android:content_shell_jni_headers" ]
270     #deps -= [ "copy_test_netscape_plugin" ]  TODO(GYP)
271   }
273   if (is_posix && !is_mac) {
274     deps += [ "//components/crash/browser" ]
275   }
277   if (use_aura) {
278     deps += [
279       "//ui/aura",
280       "//ui/aura:test_support",
281       "//ui/events",
282       "//ui/strings",
283       "//ui/wm",
284     ]
286     if (toolkit_views) {
287       sources += [ "browser/shell_views.cc" ]
288       deps += [
289         "//ui/resources",
290         "//ui/views/controls/webview",
291         "//ui/views",
292         "//ui/views:test_support",
293       ]
294     } else {
295       sources += [ "browser/shell_aura.cc" ]
296     }
297   } else {
298     sources -= [
299       "browser/shell_platform_data_aura.cc",
300       "browser/shell_platform_data_aura.h",
301     ]
302   }
304   # The test plugin relies on X11.
305   if (is_linux && !use_x11) {
306     #deps -= [ 'copy_test_netscape_plugin' ]  TODO(GYP)
307   }
309   if (is_chromeos) {
310     deps += [
311       "//chromeos",
312       "//ui/wm:test_support",
313     ]
314   }
316   if (is_linux) {
317     deps += [ "//third_party/freetype2" ]
318   }
320   if (!enable_plugins) {
321     sources -= [
322       "browser/shell_plugin_service_filter.cc",
323       "browser/shell_plugin_service_filter.h",
324     ]
325   }
328 grit("content_shell_resources_grit") {
329   visibility = [ ":*" ]
330   source = "shell_resources.grd"
331   outputs = [
332     "grit/shell_resources.h",
333     "shell_resources.pak",
334   ]
337 copy("copy_shell_resources") {
338   sources = [
339     "$target_gen_dir/shell_resources.pak",
340   ]
341   outputs = [
342     "$root_out_dir/shell_resources.pak",
343   ]
345   public_deps = [
346     ":content_shell_resources_grit",
347   ]
350 group("resources") {
351   public_deps = [
352     ":copy_shell_resources",
353   ]
354   deps = [
355     "//components/test_runner:resources",
356   ]
359 repack("pak") {
360   sources = [
361     "$root_gen_dir/blink/public/resources/blink_image_resources_100_percent.pak",
362     "$root_gen_dir/blink/public/resources/blink_resources.pak",
363     "$root_gen_dir/content/app/resources/content_resources_100_percent.pak",
364     "$root_gen_dir/content/app/strings/content_strings_en-US.pak",
365     "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
366     "$root_gen_dir/content/content_resources.pak",
367     "$root_gen_dir/content/shell/shell_resources.pak",
368     "$root_gen_dir/net/net_resources.pak",
369     "$root_gen_dir/ui/resources/ui_resources_100_percent.pak",
370     "$root_gen_dir/ui/resources/webui_resources.pak",
371     "$root_gen_dir/ui/strings/app_locale_settings_en-US.pak",
372     "$root_gen_dir/ui/strings/ui_strings_en-US.pak",
373   ]
375   deps = [
376     ":resources",
377     "//content:resources",
378     "//content/app/resources",
379     "//content/app/strings",
380     "//content/browser/tracing:resources",
381     "//net:net_resources",
382     "//third_party/WebKit/public:image_resources",
383     "//third_party/WebKit/public:resources",
384     "//ui/resources",
385     "//ui/strings",
386   ]
388   if (toolkit_views) {
389     deps += [ "//ui/views/resources" ]
390     sources +=
391         [ "$root_gen_dir/ui/views/resources/views_resources_100_percent.pak" ]
392   }
394   sources += [ "$root_gen_dir/blink/devtools_resources.pak" ]
395   deps += [ "//content/browser/devtools:resources" ]
396   output = "$root_out_dir/content_shell.pak"
399 # TODO(GYP): Figure out what this should be on android
400 # and make linking this work on the Mac.
401 if (!is_android && !is_mac) {
402   # TODO(brettw) when GYP is no longer necessary, delete
403   # content/shell/app/shell.exe.manifest. This file is not used in GN.
404   executable("content_shell") {
405     testonly = true
407     # TODO(GYP) mac resource bundle stuff for this target.
408     # TODO(GYP) Windows content shell settings:
409     #  - RC file.
410     #  - 'LinkIncremental': '<(msvs_large_module_debug_link_mode)',
411     sources = [
412       "app/shell_main.cc",
413     ]
415     deps = [
416       ":content_shell_lib",
417       ":pak",
418       "//base/allocator",
419       "//build/win:default_exe_manifest",
420     ]
422     if (is_win) {
423       deps += [ "//sandbox" ]
424       if (!is_asan) {
425         configs -= [ "//build/config/win:console" ]
426         configs += [ "//build/config/win:windowed" ]
427       }
428     }
430     if (is_mac) {
431       # TODO(GYP) lots of stuff from GYP file here.
432     }
434     if (is_android) {
435       # Some tests rely on this tool. It might be nicer if these tests relied on
436       # image diff rather than having content shell depend on it.
437       datadeps = [
438         "//tools/imagediff($host_toolchain)",
439       ]
440     }
441   }
442 } else {
443   group("content_shell") {
444     testonly = true
445     deps = [
446       ":content_shell_lib",
447     ]
448   }
451 if (is_win) {
452   # GYP version: content/content_shell_and_tests.gyp:content_shell_crash_service
453   executable("crash_service") {
454     sources = [
455       "tools/content_shell_crash_service.cc",
456     ]
458     deps = [
459       "//base",
460       "//components/crash/tools:crash_service",
461     ]
463     configs -= [ "//build/config/win:console" ]
464     configs += [ "//build/config/win:windowed" ]
465   }