[AiS] Mac AiS on two lines
[chromium-blink-merge.git] / chrome / browser / ui / BUILD.gn
blobb85d55bbb852734ab9e166bd058019714492e800
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/crypto.gni")
6 import("//build/config/features.gni")
7 import("//build/config/ui.gni")
9 gypi_values = exec_script("//build/gypi_to_gn.py",
10                           [ rebase_path("../../chrome_browser_ui.gypi") ],
11                           "scope",
12                           [ "../../chrome_browser_ui.gypi" ])
14 source_set("ui") {
15   output_name = "browser_ui"
17   sources = []
18   defines = []
19   libs = []
21   configs += [
22     "//build/config/compiler:wexit_time_destructors",
23     "//third_party/WebKit/public:debug_devtools",
24   ]
26   # Since browser and browser_ui actually depend on each other,
27   # we must omit the dependency from browser_ui to browser.
28   # However, this means browser_ui and browser should more or less
29   # have the same dependencies. Once browser_ui is untangled from
30   # browser, then we can clean up these dependencies.
31   public_deps = [
32     "//components/dom_distiller/core",
33     "//content/public/browser",
34     "//sync",
35   ]
36   deps = [
37     # NOTE: New dependencies should generally be added in the OS!="ios"
38     # dependencies block below, rather than here.
39     "//base/allocator",
40     "//chrome:extra_resources",
41     "//chrome:resources",
42     "//chrome:strings",
43     "//chrome/app/resources:platform_locale_settings",
44     "//chrome/app/theme:theme_resources",
45     "//chrome/browser/net:encrypted_cert_logger_proto",
46     "//chrome/browser/ssl:cert_logger_proto",
47     "//chrome/common",
48     "//chrome/common/net",
49     "//components/app_modal",
50     "//components/auto_login_parser",
51     "//components/dom_distiller/webui",
52     "//components/invalidation",
53     "//components/onc",
54     "//components/password_manager/core/browser",
55     "//components/resources",
56     "//components/strings",
57     "//components/update_client",
58     "//content/public/common",
59     "//crypto",
60     "//skia",
61     "//third_party/cacheinvalidation",
62     "//third_party/icu",
63     "//third_party/libxml",
64     "//third_party/zlib",
65     "//ui/accessibility",
66     "//ui/base",
67     "//ui/content_accelerators",
68     "//ui/events",
69     "//ui/events:gesture_detection",
70     "//ui/gfx",
71     "//ui/gfx/geometry",
72     "//ui/message_center",
73     "//ui/native_theme",
74     "//ui/resources",
75     "//ui/snapshot",
76     "//ui/strings",
77   ]
79   if (!is_ios) {
80     sources += rebase_path(gypi_values.chrome_browser_ui_non_ios_sources,
81                            ".",
82                            "//chrome")
83     sources += rebase_path(gypi_values.chrome_browser_ui_toolbar_model_sources,
84                            ".",
85                            "//chrome")
86     deps += [
87       "//chrome/browser/devtools",
88       "//chrome/browser/ui/views",
89       "//chrome/browser/ui/webui/omnibox:mojo_bindings",
90       "//chrome/installer/util",
91       "//components/autofill/content/browser:risk_proto",
92       "//components/power",
93       "//components/suggestions/proto",
94       "//device/nfc",
95       "//media",
96       "//net:net_with_v8",
97       "//storage/browser",
98       "//storage/common",
99       "//third_party/WebKit/public:resources",
100       "//third_party/adobe/flash:flapper_version_h",
101       "//third_party/expat",
102       "//third_party/leveldatabase",
103       "//third_party/mojo/src/mojo/edk/system",
104       "//third_party/libjingle",
105       "//third_party/re2",
106       "//ui/base/ime",
107       "//ui/compositor",
108       "//ui/surface",
109       "//ui/web_dialogs",
110       "//v8",
111     ]
112   } else {
113     # iOS.
114     sources +=
115         rebase_path(gypi_values.chrome_browser_ui_ios_sources, ".", "//chrome")
116     deps += [ "//net" ]
117   }
119   if (!is_android && !is_ios) {
120     sources += rebase_path(gypi_values.chrome_browser_ui_non_mobile_sources,
121                            ".",
122                            "//chrome")
123     sources +=
124         rebase_path(gypi_values.chrome_browser_ui_omnibox_non_mobile_sources,
125                     ".",
126                     "//chrome")
127     deps += [
128       "//components/copresence",
129       "//components/feedback/proto",
130       "//components/proximity_auth/webui",
131       "//device/bluetooth",
132       "//third_party/libusb",
133     ]
134   }
136   if (enable_basic_printing || enable_print_preview) {
137     deps += [ "//printing" ]
138   }
140   if (enable_nacl) {
141     sources +=
142         rebase_path(gypi_values.chrome_browser_ui_nacl_sources, ".", "//chrome")
143     deps += [ "//native_client/src/trusted/service_runtime:sel" ]
144   }
145   if (enable_configuration_policy) {
146     sources += rebase_path(gypi_values.chrome_browser_ui_policy_sources,
147                            ".",
148                            "//chrome")
149     deps += [ "//components/policy" ]
150   }
151   if (enable_plugins) {
152     sources += rebase_path(gypi_values.chrome_browser_ui_plugin_sources,
153                            ".",
154                            "//chrome")
155     deps += [ "//ppapi/proxy:ipc" ]
156   }
157   if (safe_browsing_mode == 1) {
158     deps += [
159       "//chrome/browser/safe_browsing:chunk_proto",
160       "//chrome/common/safe_browsing:proto",
161       "//chrome/browser/safe_browsing:report_proto",
162     ]
163   }
164   if (is_chromeos) {
165     sources += rebase_path(gypi_values.chrome_browser_ui_chromeos_sources,
166                            ".",
167                            "//chrome")
168     deps += [ "//chrome/browser/chromeos" ]
169   } else {
170     sources += rebase_path(gypi_values.chrome_browser_ui_non_chromeos_sources,
171                            ".",
172                            "//chrome")
173   }
174   if (use_cups) {
175     configs += [ "//printing:cups" ]
176   }
177   if (use_ash) {
178     sources +=
179         rebase_path(gypi_values.chrome_browser_ui_ash_sources, ".", "//chrome")
180     deps += [
181       "//ash",
182       "//ash:ash_with_content",
183       "//ash/strings",
184       "//components/user_manager",
185     ]
186     if (!is_chromeos) {
187       sources += rebase_path(gypi_values.chrome_browser_ui_ash_non_chromeos,
188                              ".",
189                              "//chrome")
190     }
191   } else {  # Not ash.
192     sources += rebase_path(gypi_values.chrome_browser_ui_non_ash_sources,
193                            ".",
194                            "//chrome")
195   }
196   if (toolkit_views) {
197     sources += rebase_path(gypi_values.chrome_browser_ui_views_sources,
198                            ".",
199                            "//chrome")
200     deps += [ "//components/constrained_window" ]
202     if (enable_extensions) {
203       deps += [ "//extensions/components/native_app_window" ]
204     }
206     if (!is_chromeos) {
207       sources +=
208           rebase_path(gypi_values.chrome_browser_ui_views_non_chromeos_sources,
209                       ".",
210                       "//chrome")
211     }
212     if (!is_mac) {
213       sources +=
214           rebase_path(gypi_values.chrome_browser_ui_views_non_mac_sources,
215                       ".",
216                       "//chrome")
217       if (enable_extensions) {
218         sources += rebase_path(
219                 gypi_values.chrome_browser_ui_views_extensions_non_mac_sources,
220                 ".",
221                 "//chrome")
222       }
223       if (is_chromeos) {
224         # TODO(GYP): crbug.com/481629. These files should probably not be
225         # a part of ui_views_non_mac_sources at all.
226         sources -= [
227           "views/frame/opaque_browser_frame_view.cc",
228           "views/frame/opaque_browser_frame_view.h",
229           "views/frame/opaque_browser_frame_view_linux.cc",
230           "views/frame/opaque_browser_frame_view_linux.h",
231         ]
232       }
233     }
234     if (use_ash) {
235       sources += rebase_path(gypi_values.chrome_browser_ui_ash_views_sources,
236                              ".",
237                              "//chrome")
238     }
239   }
240   if (use_aura && !use_ozone && is_desktop_linux) {
241     deps += [
242       "//build/config/linux:gio",
244       # gtk2 is the only component that can interact with gtk2 in our new
245       # world.
246       "//chrome/browser/ui/libgtk2ui",
247     ]
248   }
249   if (is_win || is_mac || is_desktop_linux) {
250     sources += rebase_path(gypi_values.chrome_browser_ui_desktop_sources,
251                            ".",
252                            "//chrome")
253   }
254   if (use_aura) {
255     sources +=
256         rebase_path(gypi_values.chrome_browser_ui_aura_sources, ".", "//chrome")
257     deps += [
258       # aura uses some of ash resources.
259       "//ash/resources",
260       "//ui/aura",
261       "//ui/keyboard",
262       "//ui/keyboard:resources",
263       "//ui/wm",
264     ]
265     if (!is_chromeos) {
266       sources += rebase_path(gypi_values.chrome_browser_ui_aura_non_chromeos,
267                              ".",
268                              "//chrome")
269     }
270   }
271   if (ui_compositor_image_transport) {
272     deps += [ "//ui/gl" ]
273   }
274   if (use_nss_certs) {
275     sources +=
276         rebase_path(gypi_values.chrome_browser_ui_nss_sources, ".", "//chrome")
277   }
278   if (!enable_themes) {
279     sources -= [ "webui/theme_source.cc" ]
280   }
281   if (enable_print_preview) {
282     sources += rebase_path(gypi_values.chrome_browser_ui_print_preview_sources,
283                            ".",
284                            "//chrome")
285   }
287   if (is_android) {
288     deps += [
289       "//chrome/browser:jni_headers",
290       "//crypto:platform",
291       "//components/web_contents_delegate_android",
292     ]
293     deps -= [
294       "//chrome/browser/ui/views",
295       "//ui/events",
296     ]
297     sources += rebase_path(gypi_values.chrome_browser_ui_android_sources,
298                            ".",
299                            "//chrome")
301     defines += [ "CHROME_BUILD_ID=" + android_chrome_build_id ]
302   }
304   if (is_mac) {
305     sources +=
306         rebase_path(gypi_values.chrome_browser_ui_mac_sources, ".", "//chrome")
307     deps += [
308       ":generate_localizer",
309       "//third_party/apple_sample_code",
310       "//third_party/google_toolbox_for_mac",
311       "//third_party/molokocacao",
312       "//third_party/mozilla",
313     ]
314     if (mac_views_browser) {
315       sources += rebase_path(
316               gypi_values.chrome_browser_ui_views_mac_experimental_sources,
317               ".",
318               "//chrome")
319       sources +=
320           rebase_path(gypi_values.chrome_browser_ui_views_non_mac_sources,
321                       ".",
322                       "//chrome")
323       sources += rebase_path(
324               gypi_values.chrome_browser_ui_views_extensions_non_mac_sources,
325               ".",
326               "//chrome")
327       deps += [ "//extensions/components/native_app_window" ]
328     } else {
329       sources += rebase_path(gypi_values.chrome_browser_ui_cocoa_sources,
330                              ".",
331                              "//chrome")
332     }
333     include_dirs = [ "$target_gen_dir" ]
334     libs += [ "Quartz.framework" ]
335     configs +=
336         [ "//third_party/google_toolbox_for_mac:google_toolbox_for_mac_config" ]
337   } else {  # non-Mac.
338     sources += rebase_path(gypi_values.chrome_browser_ui_non_mac_sources,
339                            ".",
340                            "//chrome")
341   }
343   if (is_win) {
344     sources +=
345         rebase_path(gypi_values.chrome_browser_ui_win_sources, ".", "//chrome")
346     sources -= [
347       "views/apps/keyboard_hook_handler.cc",
348       "views/frame/taskbar_decorator.cc",
349     ]
350     public_deps += [
351       "//ui/views",
352       "//ui/views/controls/webview",
353     ]
354     deps += [
355       "//chrome/browser/metro_utils",
356       "//chrome/installer/util:strings",
357       "//google_update",
358       "//third_party/wtl",
359       "//third_party/iaccessible2",
360       "//third_party/isimpledom",
361       "//ui/app_list",
362     ]
363     if (!is_chrome_branded) {
364       deps -= [ "//google_update" ]
365       sources -= [ "webui/help/version_updater_win.cc" ]
366       sources += [
367         "webui/help/version_updater_basic.cc",
368         "webui/help/version_updater_basic.h",
369       ]
370     }
371   } else {  # 'OS!="win"
372     if (toolkit_views) {
373       public_deps += [
374         "//ui/views",
375         "//ui/views/controls/webview",
376       ]
377     }
378   }
379   if (is_desktop_linux) {
380     sources += rebase_path(gypi_values.chrome_browser_ui_desktop_linux_sources,
381                            ".",
382                            "//chrome")
383   }
384   if (is_linux) {  # Both desktop Linux and ChromeOS.
385     sources += rebase_path(gypi_values.chrome_browser_ui_linux_sources,
386                            ".",
387                            "//chrome")
388     deps += [ "//device/udev_linux" ]
389     if (use_aura) {
390       configs += [ "//build/config/linux:fontconfig" ]
391       deps += [ "//dbus" ]
392     }
393     if (use_x11) {
394       sources += rebase_path(gypi_values.chrome_browser_ui_x11_sources,
395                              ".",
396                              "//chrome")
397       configs += [ "//build/config/linux:x11" ]
398       deps += [ "//ui/events/devices" ]
399       if (is_chromeos) {
400         sources -= [ "views/tabs/window_finder_x11.cc" ]
401       }
402     }
403   }
405   if (enable_app_list) {
406     sources += rebase_path(gypi_values.chrome_browser_ui_app_list_sources,
407                            ".",
408                            "//chrome")
409     deps += [ "//ui/app_list" ]
410   } else {
411     sources += rebase_path(gypi_values.chrome_browser_ui_non_app_list_sources,
412                            ".",
413                            "//chrome")
414   }
415   if (enable_autofill_dialog) {
416     sources +=
417         rebase_path(gypi_values.chrome_browser_ui_autofill_dialog_sources,
418                     ".",
419                     "//chrome")
420     if (!is_android && !is_ios) {
421       sources += rebase_path(
422               gypi_values.chrome_browser_ui_autofill_dialog_non_mobile_sources,
423               ".",
424               "//chrome")
425       deps += [
426         "//third_party/libaddressinput",
427         "//third_party/libaddressinput:strings",
428       ]
429     }
430   }
431   if (enable_extensions) {
432     deps += [
433       "//chrome/browser/extensions",
434       "//chrome/common/extensions/api",
435       "//chrome/common/extensions/api:api_registration",
436     ]
437     sources += rebase_path(gypi_values.chrome_browser_ui_extensions_sources,
438                            ".",
439                            "//chrome")
440   }
441   if (enable_google_now && !is_android) {
442     sources += rebase_path(
443             gypi_values.chrome_browser_ui_google_now_non_android_sources,
444             ".",
445             "//chrome")
446   }
447   if (enable_media_router) {
448     sources += rebase_path(gypi_values.chrome_browser_ui_media_router_sources,
449                            ".",
450                            "//chrome")
451     deps += [ "//chrome/browser/media/router" ]
452   }
453   if (enable_webrtc) {
454     sources += rebase_path(gypi_values.chrome_browser_ui_webrtc_sources,
455                            ".",
456                            "//chrome")
457   }
458   if (enable_service_discovery) {
459     sources +=
460         rebase_path(gypi_values.chrome_browser_ui_service_discovery_sources,
461                     ".",
462                     "//chrome")
463   }
466 if (is_mac) {
467   nib_gypi_values = exec_script("//build/gypi_to_gn.py",
468                                 [ rebase_path("../../chrome_nibs.gypi") ],
469                                 "scope",
470                                 [ "../../chrome_nibs.gypi" ])
472   action("generate_localizer") {
473     script = "//chrome/tools/build/mac/generate_localizer"
474     sources = []
475     table_path = "$target_gen_dir/ui_localizer_table.h"
476     outputs = [
477       table_path,
478     ]
479     args = [ rebase_path(table_path, root_build_dir) ] +
480            rebase_path(nib_gypi_values.mac_translated_xibs,
481                        root_build_dir,
482                        "//chrome")
483   }
486 # In GYP this is part of test_support_common.
487 source_set("test_support") {
488   testonly = true
490   sources = [
491     "browser.h",
492     "cocoa/extensions/browser_action_test_util_mac.mm",
493     "cocoa/find_bar/find_bar_host_unittest_util_cocoa.mm",
494     "cocoa/run_loop_testing.h",
495     "cocoa/run_loop_testing.mm",
496     "exclusive_access/fullscreen_controller_state_test.cc",
497     "exclusive_access/fullscreen_controller_state_test.h",
498     "exclusive_access/fullscreen_controller_state_tests.h",
499     "exclusive_access/fullscreen_controller_test.cc",
500     "exclusive_access/fullscreen_controller_test.h",
501     "find_bar/find_bar_host_unittest_util.h",
502     "login/login_prompt_test_utils.cc",
503     "login/login_prompt_test_utils.h",
504     "passwords/manage_passwords_ui_controller_mock.cc",
505     "passwords/manage_passwords_ui_controller_mock.h",
506     "test/test_confirm_bubble_model.cc",
507     "test/test_confirm_bubble_model.h",
508     "toolbar/test_toolbar_action_view_controller.cc",
509     "toolbar/test_toolbar_action_view_controller.h",
510     "website_settings/mock_permission_bubble_request.cc",
511     "website_settings/mock_permission_bubble_request.h",
512   ]
514   if (toolkit_views) {
515     sources += [ "views/find_bar_host_unittest_util_views.cc" ]
516     if (!is_mac) {
517       sources += [ "views/toolbar/browser_action_test_util_views.cc" ]
518     }
519   }
521   public_deps = [
522     ":ui",
523   ]
524   deps = [
525     "//chrome/app/theme:theme_resources",
526     "//chrome/browser",
527     "//content/public/browser",
528     "//content/public/common",
529     "//content/test:test_support",
530     "//net:test_support",
531     "//skia",
532     "//testing/gtest",
533     "//ui/base",
534   ]