Allows webview to access extension resources.
[chromium-blink-merge.git] / ash / BUILD.gn
blobcddfbfac9ae357b0968549ee0344f99a6307b0e9
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")
8 gypi_values = exec_script(
9     "//build/gypi_to_gn.py",
10     [ rebase_path("ash.gyp") ],
11     "scope",
12     [ "ash.gyp" ])
14 component("ash") {
15   sources = gypi_values.ash_sources
17   defines = [ "ASH_IMPLEMENTATION" ]
19   deps = [
20     "//ash/resources",
21     "//ash/strings",
22     "//base",
23     "//base:i18n",
24     "//base/third_party/dynamic_annotations",
25     "//cc",
26     "//components/user_manager",
27     "//content/public/browser",
28     "//media",
29     "//net",
30     "//skia",
31     "//third_party/icu",
32     "//ui/accelerometer",
33     "//ui/accessibility",
34     "//ui/app_list",
35     "//ui/aura",
36     "//ui/base",
37     "//ui/compositor",
38     "//ui/events",
39     "//ui/events:events_base",
40     "//ui/gfx",
41     "//ui/gfx/geometry",
42     "//ui/keyboard",
43     "//ui/message_center",
44     "//ui/resources",
45     "//ui/strings",
46     "//ui/views",
47     "//ui/views/controls/webview",
48     "//ui/web_dialogs",
49     "//ui/wm",
50     "//url",
51   ]
53   forward_dependent_configs_from = [
54     "//ash/resources",
55     "//ash/strings",
56   ]
58   if (is_win) {
59     sources -= [
60       "sticky_keys/sticky_keys_controller.cc",
61       "sticky_keys/sticky_keys_controller.h",
62     ]
63     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
64     cflags = [ "/wd4267" ]
65   }
67   if (use_x11) {
68     configs += [
69       "//build/config/linux:xfixes",
70     ]
71   } else {
72     sources -= [
73       "accelerators/key_hold_detector.cc",
74       "accelerators/key_hold_detector.h",
75       "accelerators/magnifier_key_scroller.cc",
76       "accelerators/magnifier_key_scroller.h",
77       "accelerators/spoken_feedback_toggler.cc",
78       "accelerators/spoken_feedback_toggler.h",
79     ]
80   }
82   if (is_chromeos) {
83     deps += [
84       "//device/bluetooth",
85       "//ui/display",
86       "//ui/display/util",
87       #'../chromeos/chromeos.gyp:chromeos',  TODO(GYP)
88       # Ash #includes power_supply_properties.pb.h directly.
89       #'../chromeos/chromeos.gyp:power_manager_proto',  TODO(GYP)
90       #'../ui/chromeos/ui_chromeos.gyp:ui_chromeos_resources',  TODO(GYP)
91       #'../ui/chromeos/ui_chromeos.gyp:ui_chromeos_strings',  TODO(GYP)
92       #'../ui/chromeos/ui_chromeos.gyp:ui_chromeos',  TODO(GYP)
93     ]
94   } else {
95     sources -= [
96       "display/display_configurator_animation.cc",
97       "display/display_configurator_animation.h",
98       "display/resolution_notification_controller.cc",
99       "display/resolution_notification_controller.h",
100       "system/tray/media_security/media_capture_observer.h",
101       "system/tray/media_security/multi_profile_media_tray_item.cc",
102       "system/tray/media_security/multi_profile_media_tray_item.h",
103     ]
104   }
106   if (!use_x11 || !is_chromeos) {
107     sources -= [
108       "touch/touch_transformer_controller.cc",
109       "touch/touch_transformer_controller.h",
110       "touch/touchscreen_util.cc",
111       "touch/touchscreen_util.h",
112     ]
113   }
115   if (!use_ozone) {
116     sources -= [
117       "display/mouse_cursor_event_filter_ozone.cc",
118     ]
119   }
121   if (!use_ozone) {
122     sources -= [
123       "host/ash_window_tree_host_ozone.cc",
124     ]
125   }
128 component("ash_with_content") {
129   sources = [
130     "content_support/ash_with_content_export.h",
131     "content_support/gpu_support_impl.cc",
132     "content_support/gpu_support_impl.h",
133     "screensaver/screensaver_view.cc",
134     "screensaver/screensaver_view.h",
135     "keyboard_overlay/keyboard_overlay_delegate.cc",
136     "keyboard_overlay/keyboard_overlay_delegate.h",
137     "keyboard_overlay/keyboard_overlay_view.cc",
138     "keyboard_overlay/keyboard_overlay_view.h",
139   ]
141   defines = [ "ASH_WITH_CONTENT_IMPLEMENTATION" ]
143   deps = [
144     ":ash",
145     "//base",
146     "//base/third_party/dynamic_annotations",
147     "//content/public/browser",
148     "//ipc",
149     "//skia",
150     "//ui/aura",
151     "//ui/base",
152     "//ui/compositor",
153     "//ui/events",
154     "//ui/gfx",
155     "//ui/gfx/geometry",
156     "//ui/resources",
157     "//ui/strings",
158     "//ui/views",
159     "//ui/views/controls/webview",
160     "//ui/web_dialogs",
161     "//url",
162   ]
164   forward_dependent_configs_from = [
165     ":ash",
166   ]
169 static_library("test_support") {
170   testonly = true
171   sources = gypi_values.ash_test_support_sources
173   deps = [
174     ":ash",
175     "//ash/resources",
176     "//content/test:test_support",
177     "//skia",
178     "//testing/gtest",
179     "//ui/accessibility",
180     "//ui/app_list",
181     "//ui/app_list:test_support",
182     "//ui/events:events_base",
183     "//ui/gl",
184     "//ui/views",
185     "//ui/views:test_support",
186   ]
188   forward_dependent_configs_from = [ ":ash" ]
190   if (is_win) {
191     sources += [
192       "test/test_metro_viewer_process_host.cc",
193       "test/test_metro_viewer_process_host.h",
194     ]
195     deps += [
196       "//ipc",
197       #'../ui/metro_viewer/metro_viewer.gyp:metro_viewer_messages',  TODO(GYP)
198       #'../win8/win8.gyp:metro_viewer',  TODO(GYP)
199       #'../win8/win8.gyp:test_support_win8',  TODO(GYP)
200       #'../win8/win8_tests.gyp:test_registrar',  TODO(GYP)
201     ]
202   }
205 static_library("ash_shell_lib") {
206   testonly = true
207   sources = gypi_values.ash_shell_lib_sources
209   deps = [
210     ":ash",
211     ":ash_with_content",
212     ":test_support",
213     "//ash/resources",
214     "//ash/strings",
215     "//base",
216     "//base:i18n",
217     #"//chrome:packed_resources",  TODO(GYP)
218     "//content",
219     "//content/shell:content_shell_lib",
220     "//net",
221     "//skia",
222     "//third_party/icu",
223     "//ui/app_list",
224     "//ui/aura",
225     "//ui/base",
226     "//ui/compositor",
227     "//ui/events",
228     "//ui/events:events_base",
229     "//ui/gfx",
230     "//ui/gfx/geometry",
231     "//ui/keyboard",
232     "//ui/message_center",
233     "//ui/resources",
234     "//ui/views",
235     "//ui/views:test_support",
236     "//ui/views/examples:views_examples_lib",
237     "//ui/views/examples:views_examples_with_content_lib",
238   ]
241 test("ash_unittests") {
242   sources = gypi_values.ash_unittests_sources
244   deps = [
245     ":ash",
246     ":ash_with_content",
247     ":test_support",
248     "//ash/resources",
249     "//ash/strings",
250     "//base",
251     "//base/allocator",
252     "//base/test:test_support",
253     "//components/user_manager",
254     "//content/public/browser",
255     "//content/test:test_support",
256     "//skia",
257     "//testing/gtest",
258     "//third_party/icu",
259     "//ui/accelerometer",
260     "//ui/accessibility",
261     "//ui/aura",
262     "//ui/aura:test_support",
263     "//ui/base",
264     "//ui/base:test_support",
265     "//ui/compositor",
266     "//ui/compositor:test_support",
267     "//ui/events",
268     "//ui/events:test_support",
269     "//ui/events:gesture_detection",
270     "//ui/gfx",
271     "//ui/gfx/geometry",
272     "//ui/keyboard",
273     "//ui/message_center",
274     "//ui/message_center:test_support",
275     "//ui/resources",
276     "//ui/views",
277     "//ui/views:test_support",
278     "//ui/views/controls/webview:test_support",
279     "//ui/web_dialogs:test_support",
280     "//ui/wm",
281     "//url",
282   ]
284   if (!is_chromeos) {
285     sources -= [
286       # TODO(zork): fix this test to build on Windows. See: crosbug.com/26906
287       "focus_cycler_unittest.cc",
288       # All tests for multiple displays: not supported on Windows Ash.
289       "wm/drag_window_resizer_unittest.cc",
290       # Can't resize on Windows Ash. http://crbug.com/165962
291       "magnifier/magnification_controller_unittest.cc",
292       "wm/workspace/workspace_window_resizer_unittest.cc",
293       "sticky_keys/sticky_keys_overlay_unittest.cc",
294       "sticky_keys/sticky_keys_unittest.cc",
295       "system/tray/media_security/multi_profile_media_tray_item_unittest.cc",
296       "autoclick/autoclick_unittest.cc",
297     ]
298     sources += [
299       #'<(SHARED_INTERMEDIATE_DIR)/ui/resources/ui_unscaled_resources.rc',  TODO(GYP)
300     ]
301   }
303   if (is_win) {
304     cflags = [ "/wd4267" ]
305   }
307   if (!use_x11) {
308     sources -= [
309       "accelerators/magnifier_key_scroller_unittest.cc",
310       "accelerators/spoken_feedback_toggler_unittest.cc",
311       "touch/touch_transformer_controller_unittest.cc",
312     ]
313   }
314   if (is_chromeos) {
315     sources += [ "first_run/first_run_helper_unittest.cc" ]
316     deps += [
317       "//device/bluetooth",
318       "//ui/display",
319       "//ui/display:test_util",
320       "//ui/display/types",
321       #'../chromeos/chromeos.gyp:chromeos_test_support_without_gmock',  TODO(GYP)
322       #'../chromeos/chromeos.gyp:power_manager_proto',  TODO(GYP)
323     ]
324   } else {
325     sources -= [
326       "display/resolution_notification_controller_unittest.cc",
327       "touch/touch_transformer_controller_unittest.cc",
328       "touch/touchscreen_util_unittest.cc",
329     ]
330   }
332   # TODO(GYP) is this necessary?
333   #['OS=="linux" and component=="shared_library" and use_allocator!="none"', {
334   # ldflags = "-rdynamic"
336   if (use_ozone) {
337     sources -= [
338       "sticky_keys/sticky_keys_unittest.cc",  # crbug.com/354035
339     ]
340   }
343 executable("ash_shell") {
344   testonly = true
345   sources = [
346     "shell/shell_main.cc",
347   ]
349   deps = [
350     ":ash_shell_lib",
351     "//components/user_manager",
352   ]
354   if (is_win) {
355     configs -= [ "//build/config/win:console" ]
356     configs += [ "//build/config/win:windowed" ]
357     deps += [
358       "//sandbox",
359     ]
360   }
362   if (is_chromeos) {
363     deps += [
364       "../device/bluetooth/bluetooth.gyp:device_bluetooth",
365     ]
366   }
369 test("ash_shell_unittests") {
370   sources = [
371     "shell/window_watcher_unittest.cc",
372     "test/ash_unittests.cc",
373   ]
375   deps = [
376     ":ash_shell_lib",
377     ":test_support",
378     "//base/test:test_support",
379     "//components/user_manager",
380     "//content/test:test_support",
381     "//skia",
382     "//testing/gtest",
383     "//ui/accessibility",
384   ]
386   if (is_chromeos) {
387     deps += [ "//ui/display" ]
388   }