[Password manager] Temporarily add some CHECKs to investigate a crash
[chromium-blink-merge.git] / chrome / browser / ui / BUILD.gn
blob1d15e1d62934575a384301abfa274df4574d2b5b
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:cert_logger_proto",
46     "//chrome/common",
47     "//chrome/common/net",
48     "//components/app_modal",
49     "//components/auto_login_parser",
50     "//components/dom_distiller/webui",
51     "//components/invalidation",
52     "//components/onc",
53     "//components/password_manager/core/browser",
54     "//components/resources",
55     "//components/strings",
56     "//components/update_client",
57     "//content/public/common",
58     "//crypto",
59     "//skia",
60     "//third_party/cacheinvalidation",
61     "//third_party/icu",
62     "//third_party/libxml",
63     "//third_party/zlib",
64     "//ui/accessibility",
65     "//ui/base",
66     "//ui/content_accelerators",
67     "//ui/events",
68     "//ui/events:gesture_detection",
69     "//ui/gfx",
70     "//ui/gfx/geometry",
71     "//ui/message_center",
72     "//ui/native_theme",
73     "//ui/resources",
74     "//ui/snapshot",
75     "//ui/strings",
76   ]
78   if (!is_ios) {
79     sources += rebase_path(gypi_values.chrome_browser_ui_non_ios_sources,
80                            ".",
81                            "//chrome")
82     sources += rebase_path(gypi_values.chrome_browser_ui_toolbar_model_sources,
83                            ".",
84                            "//chrome")
85     deps += [
86       "//chrome/browser/devtools",
87       "//chrome/browser/ui/views",
88       "//chrome/browser/ui/webui/omnibox:mojo_bindings",
89       "//chrome/installer/util",
90       "//components/autofill/content/browser:risk_proto",
91       "//components/power",
92       "//components/suggestions/proto",
93       "//device/nfc",
94       "//media",
95       "//net:net_with_v8",
96       "//storage/browser",
97       "//storage/common",
98       "//third_party/WebKit/public:resources",
99       "//third_party/adobe/flash:flapper_version_h",
100       "//third_party/expat",
101       "//third_party/leveldatabase",
102       "//third_party/mojo/src/mojo/edk/system",
103       "//third_party/npapi",
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" ]
201     if (!is_chromeos) {
202       sources +=
203           rebase_path(gypi_values.chrome_browser_ui_views_non_chromeos_sources,
204                       ".",
205                       "//chrome")
206     }
207     if (!is_mac) {
208       sources +=
209           rebase_path(gypi_values.chrome_browser_ui_views_non_mac_sources,
210                       ".",
211                       "//chrome")
212       deps += [ "//extensions/components/native_app_window" ]
213       if (is_chromeos) {
214         # TODO(GYP): crbug.com/481629. These files should probably not be
215         # a part of ui_views_non_mac_sources at all.
216         sources -= [
217           "views/frame/opaque_browser_frame_view.cc",
218           "views/frame/opaque_browser_frame_view.h",
219           "views/frame/opaque_browser_frame_view_linux.cc",
220           "views/frame/opaque_browser_frame_view_linux.h",
221         ]
222       }
223     }
224     if (use_ash) {
225       sources += rebase_path(gypi_values.chrome_browser_ui_ash_views_sources,
226                              ".",
227                              "//chrome")
228     }
229   }
230   if (use_aura && !use_ozone && is_desktop_linux) {
231     deps += [
232       "//build/config/linux:gio",
234       # gtk2 is the only component that can interact with gtk2 in our new
235       # world.
236       "//chrome/browser/ui/libgtk2ui",
237     ]
238   }
239   if (is_win || is_mac || is_desktop_linux) {
240     sources += rebase_path(gypi_values.chrome_browser_ui_desktop_sources,
241                            ".",
242                            "//chrome")
243   }
244   if (use_aura) {
245     sources +=
246         rebase_path(gypi_values.chrome_browser_ui_aura_sources, ".", "//chrome")
247     deps += [
248       # aura uses some of ash resources.
249       "//ash/resources",
250       "//ui/aura",
251       "//ui/keyboard",
252       "//ui/keyboard:resources",
253       "//ui/wm",
254     ]
255     if (!is_chromeos) {
256       sources += rebase_path(gypi_values.chrome_browser_ui_aura_non_chromeos,
257                              ".",
258                              "//chrome")
259     }
260   }
261   if (ui_compositor_image_transport) {
262     deps += [ "//ui/gl" ]
263   }
264   if (use_nss_certs) {
265     sources +=
266         rebase_path(gypi_values.chrome_browser_ui_nss_sources, ".", "//chrome")
267   }
268   if (!enable_themes) {
269     sources -= [ "webui/theme_source.cc" ]
270   }
271   if (enable_print_preview) {
272     sources += rebase_path(gypi_values.chrome_browser_ui_print_preview_sources,
273                            ".",
274                            "//chrome")
275   }
277   if (is_android) {
278     deps += [
279       "//chrome/browser:jni_headers",
280       "//crypto:platform",
281       "//components/web_contents_delegate_android",
282     ]
283     deps -= [
284       "//chrome/browser/ui/views",
285       "//ui/events",
286     ]
287     sources += rebase_path(gypi_values.chrome_browser_ui_android_sources,
288                            ".",
289                            "//chrome")
291     defines += [ "CHROME_BUILD_ID=" + android_chrome_build_id ]
292   }
294   if (is_mac) {
295     sources +=
296         rebase_path(gypi_values.chrome_browser_ui_mac_sources, ".", "//chrome")
297     deps += [
298       ":generate_localizer",
299       "//third_party/apple_sample_code",
300       "//third_party/google_toolbox_for_mac",
301       "//third_party/molokocacao",
302       "//third_party/mozilla",
303     ]
304     if (mac_views_browser) {
305       sources += rebase_path(
306               gypi_values.chrome_browser_ui_views_mac_experimental_sources,
307               ".",
308               "//chrome")
309       sources +=
310           rebase_path(gypi_values.chrome_browser_ui_views_non_mac_sources,
311                       ".",
312                       "//chrome")
313       deps += [ "//extensions/components/native_app_window" ]
314     } else {
315       sources += rebase_path(gypi_values.chrome_browser_ui_cocoa_sources,
316                              ".",
317                              "//chrome")
318     }
319     include_dirs = [ "$target_gen_dir" ]
320     libs += [ "Quartz.framework" ]
321     configs +=
322         [ "//third_party/google_toolbox_for_mac:google_toolbox_for_mac_config" ]
323   } else {  # non-Mac.
324     sources += rebase_path(gypi_values.chrome_browser_ui_non_mac_sources,
325                            ".",
326                            "//chrome")
327   }
329   if (is_win) {
330     sources +=
331         rebase_path(gypi_values.chrome_browser_ui_win_sources, ".", "//chrome")
332     sources -= [
333       "views/apps/keyboard_hook_handler.cc",
334       "views/frame/taskbar_decorator.cc",
335     ]
336     public_deps += [
337       "//ui/views",
338       "//ui/views/controls/webview",
339     ]
340     deps += [
341       "//chrome/browser/metro_utils",
342       "//chrome/installer/util:strings",
343       "//google_update",
344       "//third_party/wtl",
345       "//third_party/iaccessible2",
346       "//third_party/isimpledom",
347       "//ui/app_list",
348     ]
349   } else {  # 'OS!="win"
350     if (toolkit_views) {
351       public_deps += [
352         "//ui/views",
353         "//ui/views/controls/webview",
354       ]
355     }
356   }
357   if (is_desktop_linux) {
358     sources += rebase_path(gypi_values.chrome_browser_ui_desktop_linux_sources,
359                            ".",
360                            "//chrome")
361   }
362   if (is_linux) {  # Both desktop Linux and ChromeOS.
363     sources += rebase_path(gypi_values.chrome_browser_ui_linux_sources,
364                            ".",
365                            "//chrome")
366     deps += [ "//device/udev_linux" ]
367     if (use_aura) {
368       configs += [ "//build/config/linux:fontconfig" ]
369       deps += [ "//dbus" ]
370     }
371     if (use_x11) {
372       sources += rebase_path(gypi_values.chrome_browser_ui_x11_sources,
373                              ".",
374                              "//chrome")
375       configs += [ "//build/config/linux:x11" ]
376       deps += [ "//ui/events/devices" ]
377       if (is_chromeos) {
378         sources -= [ "views/tabs/window_finder_x11.cc" ]
379       }
380     }
381   }
383   if (enable_app_list) {
384     sources += rebase_path(gypi_values.chrome_browser_ui_app_list_sources,
385                            ".",
386                            "//chrome")
387     deps += [ "//ui/app_list" ]
388   } else {
389     sources += rebase_path(gypi_values.chrome_browser_ui_non_app_list_sources,
390                            ".",
391                            "//chrome")
392   }
393   if (enable_autofill_dialog) {
394     sources +=
395         rebase_path(gypi_values.chrome_browser_ui_autofill_dialog_sources,
396                     ".",
397                     "//chrome")
398     if (!is_android && !is_ios) {
399       sources += rebase_path(
400               gypi_values.chrome_browser_ui_autofill_dialog_non_mobile_sources,
401               ".",
402               "//chrome")
403       deps += [
404         "//third_party/libaddressinput",
405         "//third_party/libaddressinput:strings",
406       ]
407     }
408   }
409   if (enable_extensions) {
410     deps += [
411       "//chrome/browser/extensions",
412       "//chrome/common/extensions/api",
413       "//chrome/common/extensions/api:api_registration",
414     ]
415     sources += rebase_path(gypi_values.chrome_browser_ui_extensions_sources,
416                            ".",
417                            "//chrome")
418   }
419   if (enable_google_now && !is_android) {
420     sources += rebase_path(
421             gypi_values.chrome_browser_ui_google_now_non_android_sources,
422             ".",
423             "//chrome")
424   }
425   if (enable_media_router) {
426     sources += rebase_path(gypi_values.chrome_browser_ui_media_router_sources,
427                            ".",
428                            "//chrome")
429     deps += [ "//chrome/browser/media/router:router_core" ]
430     defines += [ "ENABLE_MEDIA_ROUTER=1" ]
431   }
432   if (enable_webrtc) {
433     sources += rebase_path(gypi_values.chrome_browser_ui_webrtc_sources,
434                            ".",
435                            "//chrome")
436   }
437   if (enable_service_discovery) {
438     sources +=
439         rebase_path(gypi_values.chrome_browser_ui_service_discovery_sources,
440                     ".",
441                     "//chrome")
442   }
445 if (is_mac) {
446   nib_gypi_values = exec_script("//build/gypi_to_gn.py",
447                                 [ rebase_path("../../chrome_nibs.gypi") ],
448                                 "scope",
449                                 [ "../../chrome_nibs.gypi" ])
451   action("generate_localizer") {
452     script = "//chrome/tools/build/mac/generate_localizer"
453     sources = []
454     table_path = "$target_gen_dir/ui_localizer_table.h"
455     outputs = [
456       table_path,
457     ]
458     args = [ rebase_path(table_path, root_build_dir) ] +
459            rebase_path(nib_gypi_values.mac_translated_xibs,
460                        root_build_dir,
461                        "//chrome")
462   }
465 # In GYP this is part of test_support_common.
466 source_set("test_support") {
467   testonly = true
469   sources = [
470     "browser.h",
471     "cocoa/extensions/browser_action_test_util_mac.mm",
472     "cocoa/find_bar/find_bar_host_unittest_util_cocoa.mm",
473     "cocoa/run_loop_testing.h",
474     "cocoa/run_loop_testing.mm",
475     "exclusive_access/fullscreen_controller_state_test.cc",
476     "exclusive_access/fullscreen_controller_state_test.h",
477     "exclusive_access/fullscreen_controller_state_tests.h",
478     "exclusive_access/fullscreen_controller_test.cc",
479     "exclusive_access/fullscreen_controller_test.h",
480     "find_bar/find_bar_host_unittest_util.h",
481     "login/login_prompt_test_utils.cc",
482     "login/login_prompt_test_utils.h",
483     "passwords/manage_passwords_ui_controller_mock.cc",
484     "passwords/manage_passwords_ui_controller_mock.h",
485     "test/test_confirm_bubble_model.cc",
486     "test/test_confirm_bubble_model.h",
487     "toolbar/test_toolbar_action_view_controller.cc",
488     "toolbar/test_toolbar_action_view_controller.h",
489     "website_settings/mock_permission_bubble_request.cc",
490     "website_settings/mock_permission_bubble_request.h",
491   ]
493   if (toolkit_views) {
494     sources += [ "views/find_bar_host_unittest_util_views.cc" ]
495     if (!is_mac) {
496       sources += [ "views/toolbar/browser_action_test_util_views.cc" ]
497     }
498   }
500   public_deps = [
501     ":ui",
502   ]
503   deps = [
504     "//chrome/app/theme:theme_resources",
505     "//chrome/browser",
506     "//content/public/browser",
507     "//content/public/common",
508     "//content/test:test_support",
509     "//net:test_support",
510     "//skia",
511     "//testing/gtest",
512     "//ui/base",
513   ]