Split ui/base/ime into a new component
[chromium-blink-merge.git] / chrome / browser / ui / BUILD.gn
blobabfe280e5e5948ed1ffe9ea20b7eec89076c4d24
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 static_library("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     "//sync",
34   ]
35   deps = [
36     # NOTE: New dependencies should generally be added in the OS!="ios"
37     # dependencies block below, rather than here.
38     "//base/allocator",
39     "//chrome:extra_resources",
40     "//chrome:resources",
41     "//chrome:strings",
42     "//chrome/app/resources:platform_locale_settings",
43     "//chrome/app/theme:theme_resources",
44     "//chrome/browser/net:cert_logger_proto",
45     "//chrome/common",
46     "//chrome/common/net",
47     "//components/app_modal",
48     "//components/auto_login_parser",
49     "//components/dom_distiller/webui",
50     "//components/feedback/proto",
51     "//components/history/core/browser:proto",
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/browser",
59     "//content/public/common",
60     "//crypto",
61     "//skia",
62     "//third_party/cacheinvalidation",
63     "//third_party/icu",
64     "//third_party/libusb",
65     "//third_party/libxml",
66     "//third_party/zlib",
67     "//ui/accessibility",
68     "//ui/base",
69     "//ui/content_accelerators",
70     "//ui/events",
71     "//ui/events:gesture_detection",
72     "//ui/gfx",
73     "//ui/gfx/geometry",
74     "//ui/message_center",
75     "//ui/native_theme",
76     "//ui/resources",
77     "//ui/snapshot",
78     "//ui/strings",
79   ]
81   if (!is_ios) {
82     sources += rebase_path(gypi_values.chrome_browser_ui_non_ios_sources,
83                            ".",
84                            "//chrome")
85     sources += rebase_path(gypi_values.chrome_browser_ui_global_error_sources,
86                            ".",
87                            "//chrome")
88     sources += rebase_path(gypi_values.chrome_browser_ui_omnibox_sources,
89                            ".",
90                            "//chrome")
91     sources += rebase_path(gypi_values.chrome_browser_ui_toolbar_model_sources,
92                            ".",
93                            "//chrome")
94     deps += [
95       "//chrome/browser/devtools",
96       "//chrome/browser/ui/views",
97       "//chrome/browser/ui/webui/omnibox:mojo_bindings",
98       "//chrome/installer/util",
99       "//components/autofill/content/browser:risk_proto",
100       "//components/power",
101       "//components/suggestions/proto",
102       "//device/nfc",
103       "//media",
104       "//net:net_with_v8",
105       "//storage/browser",
106       "//storage/common",
107       "//third_party/WebKit/public:resources",
108       "//third_party/adobe/flash:flapper_version_h",
109       "//third_party/expat",
110       "//third_party/hunspell",
111       "//third_party/leveldatabase",
112       "//third_party/mojo/src/mojo/edk/system",
113       "//third_party/npapi",
114       "//third_party/libjingle",
115       "//third_party/re2",
116       "//ui/base/ime",
117       "//ui/compositor",
118       "//ui/surface",
119       "//ui/web_dialogs",
120       "//v8",
121     ]
123     # TODO(GYP)
124     #'defines': [
125     #  '<@(nacl_defines)',
126     #],
127     #'direct_dependent_settings': {
128     #  'defines': [
129     #    '<@(nacl_defines)',
130     #  ],
131     #  },
132   } else {
133     # iOS.
134     sources +=
135         rebase_path(gypi_values.chrome_browser_ui_ios_sources, ".", "//chrome")
136     deps += [ "//net" ]
137   }
139   if (!is_android && !is_ios) {
140     sources += rebase_path(gypi_values.chrome_browser_ui_non_mobile_sources,
141                            ".",
142                            "//chrome")
143     sources +=
144         rebase_path(gypi_values.chrome_browser_ui_omnibox_non_mobile_sources,
145                     ".",
146                     "//chrome")
147     deps += [
148       "//device/bluetooth",
149       "//components/copresence",
150     ]
151   }
153   if (enable_basic_printing || enable_print_preview) {
154     deps += [ "//printing" ]
155   }
157   if (enable_one_click_signin) {
158     sources +=
159         rebase_path(gypi_values.chrome_browser_ui_one_click_signin_sources,
160                     ".",
161                     "//chrome")
162   }
163   if (enable_task_manager) {
164     sources += rebase_path(gypi_values.chrome_browser_ui_task_manager_sources,
165                            ".",
166                            "//chrome")
167     if (!toolkit_views || is_mac) {
168       sources -= [ "views/task_manager_view.cc" ]
169     }
170   }
171   if (!enable_nacl) {
172     sources +=
173         rebase_path(gypi_values.chrome_browser_ui_nacl_sources, ".", "//chrome")
174     deps += [
175       #"//native_client/src/trusted/service_runtime/service_runtime.gyp:sel",  TODO(GYP)
176     ]
177   }
178   if (enable_configuration_policy) {
179     sources += rebase_path(gypi_values.chrome_browser_ui_policy_sources,
180                            ".",
181                            "//chrome")
182     deps += [ "//components/policy" ]
183   }
184   if (enable_plugins) {
185     sources += rebase_path(gypi_values.chrome_browser_ui_plugin_sources,
186                            ".",
187                            "//chrome")
188     deps += [ "//ppapi:ppapi_ipc" ]
189   }
190   if (safe_browsing_mode == 1) {
191     defines += [ "FULL_SAFE_BROWSING" ]
192     deps += [
193       "//chrome/browser/safe_browsing:chunk_proto",
194       "//chrome/common/safe_browsing:proto",
195       "//chrome/browser/safe_browsing:report_proto",
196     ]
197   }
198   if (is_chromeos) {
199     sources += rebase_path(gypi_values.chrome_browser_ui_chromeos_sources,
200                            ".",
201                            "//chrome")
202     deps += [ "//chrome/browser/chromeos" ]
203   } else {
204     sources += rebase_path(gypi_values.chrome_browser_ui_non_chromeos_sources,
205                            ".",
206                            "//chrome")
207   }
208   if (use_cups) {
209     configs += [ "//printing:cups" ]
210   }
211   if (use_ash) {
212     sources +=
213         rebase_path(gypi_values.chrome_browser_ui_ash_sources, ".", "//chrome")
214     deps += [
215       "//ash",
216       "//ash:ash_with_content",
217       "//ash/strings",
218       "//components/user_manager",
219     ]
220     if (!is_chromeos) {
221       sources += rebase_path(gypi_values.chrome_browser_ui_ash_non_chromeos,
222                              ".",
223                              "//chrome")
224     }
225   } else {  # Not ash.
226     sources += rebase_path(gypi_values.chrome_browser_ui_non_ash_sources,
227                            ".",
228                            "//chrome")
229   }
230   if (toolkit_views) {
231     sources += rebase_path(gypi_values.chrome_browser_ui_views_sources,
232                            ".",
233                            "//chrome")
234     deps += [ "//components/constrained_window" ]
235     if (!is_chromeos) {
236       sources +=
237           rebase_path(gypi_values.chrome_browser_ui_views_non_chromeos_sources,
238                       ".",
239                       "//chrome")
240     }
241     if (is_mac) {
242       if (mac_views_browser) {
243         sources -= [
244           "cocoa/bookmarks/bookmark_drag_drop_cocoa.mm",
245           "cocoa/browser_window_factory_cocoa.mm",
246           "cocoa/tab_dialogs_cocoa.mm",
247         ]
248       } else {
249         sources -= [
250           "views/bookmarks/bookmark_drag_drop_views.cc",
251           "views/frame/browser_window_factory.cc",
252           "views/tab_dialogs_views.cc",
253         ]
254       }
255     } else {
256       sources +=
257           rebase_path(gypi_values.chrome_browser_ui_views_non_mac_sources,
258                       ".",
259                       "//chrome")
260       deps += [ "//extensions/components/native_app_window" ]
261     }
262     if (use_ash) {
263       sources += rebase_path(gypi_values.chrome_browser_ui_ash_views_sources,
264                              ".",
265                              "//chrome")
266     }
267   }
268   if (use_aura && !use_ozone && is_desktop_linux) {
269     deps += [
270       "//build/config/linux:gio",
272       # gtk2 is the only component that can interact with gtk2 in our new
273       # world.
274       "//chrome/browser/ui/libgtk2ui",
275     ]
276   }
277   if (is_win || is_mac || is_desktop_linux) {
278     sources += rebase_path(gypi_values.chrome_browser_ui_desktop_sources,
279                            ".",
280                            "//chrome")
281   }
282   if (use_aura) {
283     sources +=
284         rebase_path(gypi_values.chrome_browser_ui_aura_sources, ".", "//chrome")
285     deps += [
286       # aura uses some of ash resources.
287       "//ash/resources",
288       "//ui/aura",
289       "//ui/keyboard",
290       "//ui/keyboard:resources",
291       "//ui/wm",
292     ]
293     if (!is_chromeos) {
294       sources += rebase_path(gypi_values.chrome_browser_ui_aura_non_chromeos,
295                              ".",
296                              "//chrome")
297     }
298   }
299   if (ui_compositor_image_transport) {
300     deps += [ "//ui/gl" ]
301   }
302   if (use_nss_certs) {
303     sources +=
304         rebase_path(gypi_values.chrome_browser_ui_nss_sources, ".", "//chrome")
305   }
306   if (!enable_themes) {
307     sources -= [ "webui/theme_source.cc" ]
308   }
309   if (enable_print_preview) {
310     sources += rebase_path(gypi_values.chrome_browser_ui_print_preview_sources,
311                            ".",
312                            "//chrome")
313   }
314   if (is_linux || is_android) {
315     sources += rebase_path(gypi_values.chrome_browser_ui_android_linux_sources,
316                            ".",
317                            "//chrome")
318   }
320   if (is_android) {
321     deps += [
322       "//chrome/browser:jni_headers",
323       "//crypto:platform",
325       #'../components/components.gyp:web_contents_delegate_android',  TODO(GYP)
326     ]
327     deps -= [
328       "//chrome/browser/ui/views",
329       "//components/feedback/proto",
330       "//third_party/libusb",
331       "//ui/events",
332     ]
333     sources += rebase_path(gypi_values.chrome_browser_ui_android_sources,
334                            ".",
335                            "//chrome")
337     defines += [ "CHROME_BUILD_ID=" + android_chrome_build_id ]
338   }
340   if (is_mac) {
341     sources +=
342         rebase_path(gypi_values.chrome_browser_ui_mac_sources, ".", "//chrome")
343     deps += [
344       "//third_party/google_toolbox_for_mac",
345       ":generate_localizer",
347       #'../third_party/apple_sample_code/apple_sample_code.gyp:apple_sample_code',  TODO(GYP)
348       #'../third_party/molokocacao/molokocacao.gyp:molokocacao',  TODO(GYP)
349       #'../third_party/mozilla/mozilla.gyp:mozilla',  TODO(GYP)
350     ]
351     include_dirs = [ "$target_gen_dir" ]
352     libs += [ "Quartz.framework" ]
353     configs +=
354         [ "//third_party/google_toolbox_for_mac:google_toolbox_for_mac_config" ]
355   } else {  # non-Mac.
356     sources += rebase_path(gypi_values.chrome_browser_ui_non_mac_sources,
357                            ".",
358                            "//chrome")
359   }
361   if (is_win) {
362     sources +=
363         rebase_path(gypi_values.chrome_browser_ui_win_sources, ".", "//chrome")
364     sources -= [ "views/frame/taskbar_decorator.cc" ]
365     public_deps += [
366       "//ui/views",
367       "//ui/views/controls/webview",
368     ]
369     deps += [
370       "//chrome/browser/metro_utils",
371       "//chrome/installer/util:strings",
372       "//google_update",
373       "//third_party/wtl",
374       "//third_party/iaccessible2",
375       "//third_party/isimpledom",
376       "//ui/app_list",
377     ]
378   } else {  # 'OS!="win"
379     if (toolkit_views) {
380       public_deps += [
381         "//ui/views",
382         "//ui/views/controls/webview",
383       ]
384     }
385   }
386   if (is_desktop_linux) {
387     sources += rebase_path(gypi_values.chrome_browser_ui_desktop_linux_sources,
388                            ".",
389                            "//chrome")
390   }
391   if (is_linux) {  # Both desktop Linux and ChromeOS.
392     sources += rebase_path(gypi_values.chrome_browser_ui_linux_sources,
393                            ".",
394                            "//chrome")
395     deps += [ "//device/udev_linux" ]
396     if (use_aura) {
397       configs += [ "//build/config/linux:fontconfig" ]
398       deps += [ "//dbus" ]
399     }
400     if (use_x11) {
401       sources += rebase_path(gypi_values.chrome_browser_ui_x11_sources,
402                              ".",
403                              "//chrome")
404       configs += [ "//build/config/linux:x11" ]
405       deps += [ "//ui/events/devices" ]
406       if (is_chromeos) {
407         sources -= [ "views/tabs/window_finder_x11.cc" ]
408       }
409     }
410   }
412   if (enable_app_list) {
413     sources += rebase_path(gypi_values.chrome_browser_ui_app_list_sources,
414                            ".",
415                            "//chrome")
416     deps += [ "//ui/app_list" ]
417   } else {
418     sources += rebase_path(gypi_values.chrome_browser_ui_non_app_list_sources,
419                            ".",
420                            "//chrome")
421   }
422   if (enable_autofill_dialog) {
423     sources +=
424         rebase_path(gypi_values.chrome_browser_ui_autofill_dialog_sources,
425                     ".",
426                     "//chrome")
427     if (!is_android && !is_ios) {
428       sources += rebase_path(
429               gypi_values.chrome_browser_ui_autofill_dialog_non_mobile_sources,
430               ".",
431               "//chrome")
432       deps += [
433         "//third_party/libaddressinput",
434         "//third_party/libaddressinput:strings",
435       ]
436     }
437   }
438   if (enable_extensions) {
439     deps += [
440       "//chrome/browser/extensions",
441       "//chrome/common/extensions/api",
442       "//chrome/common/extensions/api:api_registration",
443     ]
444     sources += rebase_path(gypi_values.chrome_browser_ui_extensions_sources,
445                            ".",
446                            "//chrome")
447   }
448   if (enable_google_now && !is_android) {
449     sources += rebase_path(
450             gypi_values.chrome_browser_ui_google_now_non_android_sources,
451             ".",
452             "//chrome")
453   }
454   if (enable_webrtc) {
455     sources += rebase_path(gypi_values.chrome_browser_ui_webrtc_sources,
456                            ".",
457                            "//chrome")
458   }
459   if (enable_service_discovery) {
460     sources +=
461         rebase_path(gypi_values.chrome_browser_ui_service_discovery_sources,
462                     ".",
463                     "//chrome")
464   }
465   if (enable_spellcheck) {
466     deps += [ "//third_party/hunspell" ]
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/find_bar/find_bar_host_unittest_util_cocoa.mm",
497     "cocoa/run_loop_testing.h",
498     "cocoa/run_loop_testing.mm",
499     "exclusive_access/fullscreen_controller_state_test.cc",
500     "exclusive_access/fullscreen_controller_state_test.h",
501     "exclusive_access/fullscreen_controller_state_tests.h",
502     "exclusive_access/fullscreen_controller_test.cc",
503     "exclusive_access/fullscreen_controller_test.h",
504     "find_bar/find_bar_host_unittest_util.h",
505     "login/login_prompt_test_utils.cc",
506     "login/login_prompt_test_utils.h",
507     "passwords/manage_passwords_ui_controller_mock.cc",
508     "passwords/manage_passwords_ui_controller_mock.h",
509     "pdf/pdf_browsertest_base.cc",
510     "pdf/pdf_browsertest_base.h",
511     "test/test_confirm_bubble_model.cc",
512     "test/test_confirm_bubble_model.h",
513     "website_settings/mock_permission_bubble_request.cc",
514     "website_settings/mock_permission_bubble_request.h",
515   ]
517   if (toolkit_views) {
518     sources += [ "views/find_bar_host_unittest_util_views.cc" ]
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   ]