Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / chrome / browser / ui / BUILD.gn
blob02e05b72887ef96b5c6b2cb66f6e8a77c5beb2af
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/npapi",
105       "//third_party/libjingle",
106       "//third_party/re2",
107       "//ui/base/ime",
108       "//ui/compositor",
109       "//ui/surface",
110       "//ui/web_dialogs",
111       "//v8",
112     ]
113   } else {
114     # iOS.
115     sources +=
116         rebase_path(gypi_values.chrome_browser_ui_ios_sources, ".", "//chrome")
117     deps += [ "//net" ]
118   }
120   if (!is_android && !is_ios) {
121     sources += rebase_path(gypi_values.chrome_browser_ui_non_mobile_sources,
122                            ".",
123                            "//chrome")
124     sources +=
125         rebase_path(gypi_values.chrome_browser_ui_omnibox_non_mobile_sources,
126                     ".",
127                     "//chrome")
128     deps += [
129       "//components/copresence",
130       "//components/feedback/proto",
131       "//components/proximity_auth/webui",
132       "//device/bluetooth",
133       "//third_party/libusb",
134     ]
135   }
137   if (enable_basic_printing || enable_print_preview) {
138     deps += [ "//printing" ]
139   }
141   if (enable_nacl) {
142     sources +=
143         rebase_path(gypi_values.chrome_browser_ui_nacl_sources, ".", "//chrome")
144     deps += [ "//native_client/src/trusted/service_runtime:sel" ]
145   }
146   if (enable_configuration_policy) {
147     sources += rebase_path(gypi_values.chrome_browser_ui_policy_sources,
148                            ".",
149                            "//chrome")
150     deps += [ "//components/policy" ]
151   }
152   if (enable_plugins) {
153     sources += rebase_path(gypi_values.chrome_browser_ui_plugin_sources,
154                            ".",
155                            "//chrome")
156     deps += [ "//ppapi/proxy:ipc" ]
157   }
158   if (safe_browsing_mode == 1) {
159     deps += [
160       "//chrome/browser/safe_browsing:chunk_proto",
161       "//chrome/common/safe_browsing:proto",
162       "//chrome/browser/safe_browsing:report_proto",
163     ]
164   }
165   if (is_chromeos) {
166     sources += rebase_path(gypi_values.chrome_browser_ui_chromeos_sources,
167                            ".",
168                            "//chrome")
169     deps += [ "//chrome/browser/chromeos" ]
170   } else {
171     sources += rebase_path(gypi_values.chrome_browser_ui_non_chromeos_sources,
172                            ".",
173                            "//chrome")
174   }
175   if (use_cups) {
176     configs += [ "//printing:cups" ]
177   }
178   if (use_ash) {
179     sources +=
180         rebase_path(gypi_values.chrome_browser_ui_ash_sources, ".", "//chrome")
181     deps += [
182       "//ash",
183       "//ash:ash_with_content",
184       "//ash/strings",
185       "//components/user_manager",
186     ]
187     if (!is_chromeos) {
188       sources += rebase_path(gypi_values.chrome_browser_ui_ash_non_chromeos,
189                              ".",
190                              "//chrome")
191     }
192   } else {  # Not ash.
193     sources += rebase_path(gypi_values.chrome_browser_ui_non_ash_sources,
194                            ".",
195                            "//chrome")
196   }
197   if (toolkit_views) {
198     sources += rebase_path(gypi_values.chrome_browser_ui_views_sources,
199                            ".",
200                            "//chrome")
201     deps += [ "//components/constrained_window" ]
202     if (!is_chromeos) {
203       sources +=
204           rebase_path(gypi_values.chrome_browser_ui_views_non_chromeos_sources,
205                       ".",
206                       "//chrome")
207     }
208     if (!is_mac) {
209       sources +=
210           rebase_path(gypi_values.chrome_browser_ui_views_non_mac_sources,
211                       ".",
212                       "//chrome")
213       deps += [ "//extensions/components/native_app_window" ]
214       if (is_chromeos) {
215         # TODO(GYP): crbug.com/481629. These files should probably not be
216         # a part of ui_views_non_mac_sources at all.
217         sources -= [
218           "views/frame/opaque_browser_frame_view.cc",
219           "views/frame/opaque_browser_frame_view.h",
220           "views/frame/opaque_browser_frame_view_linux.cc",
221           "views/frame/opaque_browser_frame_view_linux.h",
222         ]
223       }
224     }
225     if (use_ash) {
226       sources += rebase_path(gypi_values.chrome_browser_ui_ash_views_sources,
227                              ".",
228                              "//chrome")
229     }
230   }
231   if (use_aura && !use_ozone && is_desktop_linux) {
232     deps += [
233       "//build/config/linux:gio",
235       # gtk2 is the only component that can interact with gtk2 in our new
236       # world.
237       "//chrome/browser/ui/libgtk2ui",
238     ]
239   }
240   if (is_win || is_mac || is_desktop_linux) {
241     sources += rebase_path(gypi_values.chrome_browser_ui_desktop_sources,
242                            ".",
243                            "//chrome")
244   }
245   if (use_aura) {
246     sources +=
247         rebase_path(gypi_values.chrome_browser_ui_aura_sources, ".", "//chrome")
248     deps += [
249       # aura uses some of ash resources.
250       "//ash/resources",
251       "//ui/aura",
252       "//ui/keyboard",
253       "//ui/keyboard:resources",
254       "//ui/wm",
255     ]
256     if (!is_chromeos) {
257       sources += rebase_path(gypi_values.chrome_browser_ui_aura_non_chromeos,
258                              ".",
259                              "//chrome")
260     }
261   }
262   if (ui_compositor_image_transport) {
263     deps += [ "//ui/gl" ]
264   }
265   if (use_nss_certs) {
266     sources +=
267         rebase_path(gypi_values.chrome_browser_ui_nss_sources, ".", "//chrome")
268   }
269   if (!enable_themes) {
270     sources -= [ "webui/theme_source.cc" ]
271   }
272   if (enable_print_preview) {
273     sources += rebase_path(gypi_values.chrome_browser_ui_print_preview_sources,
274                            ".",
275                            "//chrome")
276   }
278   if (is_android) {
279     deps += [
280       "//chrome/browser:jni_headers",
281       "//crypto:platform",
282       "//components/web_contents_delegate_android",
283     ]
284     deps -= [
285       "//chrome/browser/ui/views",
286       "//ui/events",
287     ]
288     sources += rebase_path(gypi_values.chrome_browser_ui_android_sources,
289                            ".",
290                            "//chrome")
292     defines += [ "CHROME_BUILD_ID=" + android_chrome_build_id ]
293   }
295   if (is_mac) {
296     sources +=
297         rebase_path(gypi_values.chrome_browser_ui_mac_sources, ".", "//chrome")
298     deps += [
299       ":generate_localizer",
300       "//third_party/apple_sample_code",
301       "//third_party/google_toolbox_for_mac",
302       "//third_party/molokocacao",
303       "//third_party/mozilla",
304     ]
305     if (mac_views_browser) {
306       sources += rebase_path(
307               gypi_values.chrome_browser_ui_views_mac_experimental_sources,
308               ".",
309               "//chrome")
310       sources +=
311           rebase_path(gypi_values.chrome_browser_ui_views_non_mac_sources,
312                       ".",
313                       "//chrome")
314       deps += [ "//extensions/components/native_app_window" ]
315     } else {
316       sources += rebase_path(gypi_values.chrome_browser_ui_cocoa_sources,
317                              ".",
318                              "//chrome")
319     }
320     include_dirs = [ "$target_gen_dir" ]
321     libs += [ "Quartz.framework" ]
322     configs +=
323         [ "//third_party/google_toolbox_for_mac:google_toolbox_for_mac_config" ]
324   } else {  # non-Mac.
325     sources += rebase_path(gypi_values.chrome_browser_ui_non_mac_sources,
326                            ".",
327                            "//chrome")
328   }
330   if (is_win) {
331     sources +=
332         rebase_path(gypi_values.chrome_browser_ui_win_sources, ".", "//chrome")
333     sources -= [
334       "views/apps/keyboard_hook_handler.cc",
335       "views/frame/taskbar_decorator.cc",
336     ]
337     public_deps += [
338       "//ui/views",
339       "//ui/views/controls/webview",
340     ]
341     deps += [
342       "//chrome/browser/metro_utils",
343       "//chrome/installer/util:strings",
344       "//google_update",
345       "//third_party/wtl",
346       "//third_party/iaccessible2",
347       "//third_party/isimpledom",
348       "//ui/app_list",
349     ]
350     if (!is_chrome_branded) {
351       deps -= [ "//google_update" ]
352       sources -= [ "webui/help/version_updater_win.cc" ]
353       sources += [
354         "webui/help/version_updater_basic.cc",
355         "webui/help/version_updater_basic.h",
356       ]
357     }
358   } else {  # 'OS!="win"
359     if (toolkit_views) {
360       public_deps += [
361         "//ui/views",
362         "//ui/views/controls/webview",
363       ]
364     }
365   }
366   if (is_desktop_linux) {
367     sources += rebase_path(gypi_values.chrome_browser_ui_desktop_linux_sources,
368                            ".",
369                            "//chrome")
370   }
371   if (is_linux) {  # Both desktop Linux and ChromeOS.
372     sources += rebase_path(gypi_values.chrome_browser_ui_linux_sources,
373                            ".",
374                            "//chrome")
375     deps += [ "//device/udev_linux" ]
376     if (use_aura) {
377       configs += [ "//build/config/linux:fontconfig" ]
378       deps += [ "//dbus" ]
379     }
380     if (use_x11) {
381       sources += rebase_path(gypi_values.chrome_browser_ui_x11_sources,
382                              ".",
383                              "//chrome")
384       configs += [ "//build/config/linux:x11" ]
385       deps += [ "//ui/events/devices" ]
386       if (is_chromeos) {
387         sources -= [ "views/tabs/window_finder_x11.cc" ]
388       }
389     }
390   }
392   if (enable_app_list) {
393     sources += rebase_path(gypi_values.chrome_browser_ui_app_list_sources,
394                            ".",
395                            "//chrome")
396     deps += [ "//ui/app_list" ]
397   } else {
398     sources += rebase_path(gypi_values.chrome_browser_ui_non_app_list_sources,
399                            ".",
400                            "//chrome")
401   }
402   if (enable_autofill_dialog) {
403     sources +=
404         rebase_path(gypi_values.chrome_browser_ui_autofill_dialog_sources,
405                     ".",
406                     "//chrome")
407     if (!is_android && !is_ios) {
408       sources += rebase_path(
409               gypi_values.chrome_browser_ui_autofill_dialog_non_mobile_sources,
410               ".",
411               "//chrome")
412       deps += [
413         "//third_party/libaddressinput",
414         "//third_party/libaddressinput:strings",
415       ]
416     }
417   }
418   if (enable_extensions) {
419     deps += [
420       "//chrome/browser/extensions",
421       "//chrome/common/extensions/api",
422       "//chrome/common/extensions/api:api_registration",
423     ]
424     sources += rebase_path(gypi_values.chrome_browser_ui_extensions_sources,
425                            ".",
426                            "//chrome")
427   }
428   if (enable_google_now && !is_android) {
429     sources += rebase_path(
430             gypi_values.chrome_browser_ui_google_now_non_android_sources,
431             ".",
432             "//chrome")
433   }
434   if (enable_media_router) {
435     sources += rebase_path(gypi_values.chrome_browser_ui_media_router_sources,
436                            ".",
437                            "//chrome")
438     deps += [ "//chrome/browser/media/router" ]
439   }
440   if (enable_webrtc) {
441     sources += rebase_path(gypi_values.chrome_browser_ui_webrtc_sources,
442                            ".",
443                            "//chrome")
444   }
445   if (enable_service_discovery) {
446     sources +=
447         rebase_path(gypi_values.chrome_browser_ui_service_discovery_sources,
448                     ".",
449                     "//chrome")
450   }
453 if (is_mac) {
454   nib_gypi_values = exec_script("//build/gypi_to_gn.py",
455                                 [ rebase_path("../../chrome_nibs.gypi") ],
456                                 "scope",
457                                 [ "../../chrome_nibs.gypi" ])
459   action("generate_localizer") {
460     script = "//chrome/tools/build/mac/generate_localizer"
461     sources = []
462     table_path = "$target_gen_dir/ui_localizer_table.h"
463     outputs = [
464       table_path,
465     ]
466     args = [ rebase_path(table_path, root_build_dir) ] +
467            rebase_path(nib_gypi_values.mac_translated_xibs,
468                        root_build_dir,
469                        "//chrome")
470   }
473 # In GYP this is part of test_support_common.
474 source_set("test_support") {
475   testonly = true
477   sources = [
478     "browser.h",
479     "cocoa/extensions/browser_action_test_util_mac.mm",
480     "cocoa/find_bar/find_bar_host_unittest_util_cocoa.mm",
481     "cocoa/run_loop_testing.h",
482     "cocoa/run_loop_testing.mm",
483     "exclusive_access/fullscreen_controller_state_test.cc",
484     "exclusive_access/fullscreen_controller_state_test.h",
485     "exclusive_access/fullscreen_controller_state_tests.h",
486     "exclusive_access/fullscreen_controller_test.cc",
487     "exclusive_access/fullscreen_controller_test.h",
488     "find_bar/find_bar_host_unittest_util.h",
489     "login/login_prompt_test_utils.cc",
490     "login/login_prompt_test_utils.h",
491     "passwords/manage_passwords_ui_controller_mock.cc",
492     "passwords/manage_passwords_ui_controller_mock.h",
493     "test/test_confirm_bubble_model.cc",
494     "test/test_confirm_bubble_model.h",
495     "toolbar/test_toolbar_action_view_controller.cc",
496     "toolbar/test_toolbar_action_view_controller.h",
497     "website_settings/mock_permission_bubble_request.cc",
498     "website_settings/mock_permission_bubble_request.h",
499   ]
501   if (toolkit_views) {
502     sources += [ "views/find_bar_host_unittest_util_views.cc" ]
503     if (!is_mac) {
504       sources += [ "views/toolbar/browser_action_test_util_views.cc" ]
505     }
506   }
508   public_deps = [
509     ":ui",
510   ]
511   deps = [
512     "//chrome/app/theme:theme_resources",
513     "//chrome/browser",
514     "//content/public/browser",
515     "//content/public/common",
516     "//content/test:test_support",
517     "//net:test_support",
518     "//skia",
519     "//testing/gtest",
520     "//ui/base",
521   ]