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