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