Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / BUILD.gn
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.
4
5 import("//build/config/crypto.gni")
6 import("//build/config/features.gni")
7 import("//build/config/ui.gni")
8
9 gypi_values = exec_script(
10     "//build/gypi_to_gn.py",
11     [ rebase_path("../../chrome_browser_ui.gypi") ],
12     "scope",
13     [ "../../chrome_browser_ui.gypi" ])
14
15 static_library("ui") {
16   output_name = "browser_ui"
17
18   sources = []
19   defines = []
20   libs = []
21
22   configs += [
23     "//build/config/compiler:wexit_time_destructors",
24     "//third_party/WebKit/public:debug_devtools",
25   ]
26
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     "//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/history:in_memory_url_index_cache_proto",
46     "//chrome/browser/net:cert_logger_proto",
47     "//chrome/common",
48     "//chrome/common/net",
49     "//components/app_modal_dialogs",
50     "//components/auto_login_parser",
51     "//components/dom_distiller/webui",
52     "//components/feedback/proto",
53     "//components/invalidation",
54     "//components/omaha_query_params",
55     "//components/onc",
56     "//components/password_manager/core/browser",
57     "//components/resources",
58     "//components/strings",
59     "//content/public/browser",
60     "//content/public/common",
61     "//crypto",
62     "//skia",
63     "//third_party/cacheinvalidation",
64     "//third_party/icu",
65     "//third_party/libusb",
66     "//third_party/libxml",
67     "//third_party/zlib",
68     "//ui/accessibility",
69     "//ui/base",
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   ]
80
81   if (!is_ios) {
82     sources += rebase_path(gypi_values.chrome_browser_ui_non_ios_sources,
83                            ".", "//chrome")
84     deps += [
85       "//chrome/browser/devtools",
86       "//chrome/browser/ui/views",
87       "//chrome/browser/ui/webui/omnibox:mojo_bindings",
88       "//chrome/installer/util",
89       "//components/autofill/content/browser:risk_proto",
90       "//components/power",
91       "//device/nfc",
92       "//media",
93       "//mojo/edk/system",
94       "//net:net_with_v8",
95       "//storage/browser",
96       "//storage/common",
97       "//third_party/WebKit/public:resources",
98       "//third_party/adobe/flash:flapper_version_h",
99       "//third_party/expat",
100       "//third_party/hunspell",
101       "//third_party/leveldatabase",
102       "//third_party/npapi",
103       "//third_party/libjingle",
104       "//third_party/re2",
105       "//ui/compositor",
106       "//ui/surface",
107       "//ui/web_dialogs",
108       "//v8",
109     ]
110     # TODO(GYP)
111     #'defines': [
112     #  '<@(nacl_defines)',
113     #],
114     #'direct_dependent_settings': {
115     #  'defines': [
116     #    '<@(nacl_defines)',
117     #  ],
118     #  },
119   } else {
120     # iOS.
121     sources += rebase_path(gypi_values.chrome_browser_ui_ios_sources,
122                            ".", "//chrome")
123     deps += [ "//net" ]
124   }
125
126   if (!is_android && !is_ios) {
127     sources += rebase_path(gypi_values.chrome_browser_ui_non_mobile_sources,
128                            ".", "//chrome")
129     deps += [ "//device/bluetooth" ]
130   }
131
132   if (enable_basic_printing || enable_print_preview) {
133     deps += [ "//printing" ]
134   }
135
136   if (enable_one_click_signin) {
137     sources += rebase_path(
138         gypi_values.chrome_browser_ui_one_click_signin_sources,
139         ".", "//chrome")
140   }
141   if (enable_task_manager) {
142     sources += rebase_path(gypi_values.chrome_browser_ui_task_manager_sources,
143                            ".", "//chrome")
144     if (!toolkit_views || is_mac) {
145       sources -= [ "views/task_manager_view.cc" ]
146     }
147   }
148   if (!enable_nacl) {
149     sources += rebase_path(gypi_values.chrome_browser_ui_nacl_sources,
150                            ".", "//chrome")
151     deps += [
152       #"//native_client/src/trusted/service_runtime/service_runtime.gyp:sel",  TODO(GYP)
153     ]
154   }
155   if (enable_configuration_policy) {
156     sources += rebase_path(gypi_values.chrome_browser_ui_policy_sources,
157                            ".", "//chrome")
158     deps += [ "//components/policy" ]
159   }
160   if (enable_plugins) {
161     sources += rebase_path(gypi_values.chrome_browser_ui_plugin_sources,
162                            ".", "//chrome")
163     deps += [ "//ppapi:ppapi_ipc" ]
164   }
165   if (safe_browsing_mode == 1) {
166     defines += [ "FULL_SAFE_BROWSING" ]
167     deps += [
168       "//chrome/browser/safe_browsing:chunk_proto",
169       "//chrome/common/safe_browsing:proto",
170       "//chrome/browser/safe_browsing:report_proto",
171     ]
172   }
173   if (is_chromeos) {
174     sources += rebase_path(gypi_values.chrome_browser_ui_chromeos_sources,
175                            ".", "//chrome")
176     deps += [
177       "//chrome/browser/chromeos",
178     ]
179   } else {
180     sources += rebase_path(gypi_values.chrome_browser_ui_non_chromeos_sources,
181                            ".", "//chrome")
182   }
183   if (use_cups) {
184     configs += [ "//printing:cups" ]
185   }
186   if (use_ash) {
187     sources += rebase_path(gypi_values.chrome_browser_ui_ash_sources,
188                            ".", "//chrome")
189     deps += [
190       "//ash",
191       "//ash:ash_with_content",
192       "//ash/strings",
193       "//components/user_manager",
194     ]
195     if (!is_chromeos) {
196       sources += rebase_path(gypi_values.chrome_browser_ui_ash_non_chromeos,
197                              ".", "//chrome")
198     }
199   } else {  # Not ash.
200     sources += rebase_path(gypi_values.chrome_browser_ui_non_ash_sources,
201                            ".", "//chrome")
202   }
203   if (use_athena) {
204     sources += rebase_path(gypi_values.chrome_browser_ui_athena_sources,
205                            ".", "//chrome")
206   } else {  # Not athena.
207     if (!is_android) {
208       sources += rebase_path(
209           gypi_values.chrome_browser_ui_non_athena_non_android_sources,
210           ".", "//chrome")
211     }
212     if (use_ash) {
213       sources += rebase_path(
214           gypi_values.chrome_browser_ui_ash_non_athena_sources,
215           ".", "//chrome")
216     }
217   }
218   if (toolkit_views) {
219     sources += rebase_path(gypi_values.chrome_browser_ui_views_sources,
220                            ".", "//chrome")
221     deps += [ "//components/constrained_window" ]
222     if (!is_chromeos) {
223       sources += rebase_path(
224           gypi_values.chrome_browser_ui_views_non_chromeos_sources,
225           ".", "//chrome")
226     }
227     if (!is_mac) {
228       sources += rebase_path(
229           gypi_values.chrome_browser_ui_views_non_mac_sources,
230           ".", "//chrome")
231       deps += [
232         "//extensions/components/native_app_window",
233       ]
234     }
235     if (use_ash) {
236       sources += rebase_path(gypi_values.chrome_browser_ui_ash_views_sources,
237                              ".", "//chrome")
238     }
239   }
240   if (use_aura && !use_ozone && is_desktop_linux) {
241     deps += [
242       "//build/config/linux:gio",
243       # gtk2 is the only component that can interact with gtk2 in our new
244       # world.
245       "//chrome/browser/ui/libgtk2ui",
246     ]
247   }
248   if (is_win || is_mac || is_desktop_linux) {
249     sources += rebase_path(gypi_values.chrome_browser_ui_desktop_sources,
250                            ".", "//chrome")
251   }
252   if (use_aura) {
253     sources += rebase_path(gypi_values.chrome_browser_ui_aura_sources,
254                            ".", "//chrome")
255     deps += [
256       # aura uses some of ash resources.
257       "//ash/resources",
258       "//ui/aura",
259       "//ui/keyboard",
260       "//ui/keyboard:resources",
261       "//ui/wm",
262     ]
263     if (!is_chromeos) {
264       sources += rebase_path(gypi_values.chrome_browser_ui_aura_non_chromeos,
265                              ".", "//chrome")
266     }
267   }
268   if (ui_compositor_image_transport) {
269     deps += [ "//ui/gl" ]
270   }
271   if (use_nss_certs) {
272     sources += rebase_path(gypi_values.chrome_browser_ui_nss_sources,
273                            ".", "//chrome")
274   }
275   if (!enable_themes) {
276     sources -= [ "webui/theme_source.cc" ]
277   }
278   if (enable_print_preview) {
279     sources += rebase_path(gypi_values.chrome_browser_ui_print_preview_sources,
280                            ".", "//chrome")
281   }
282   if (is_linux || is_android) {
283     sources += rebase_path(gypi_values.chrome_browser_ui_android_linux_sources,
284                            ".", "//chrome")
285   }
286
287   if (is_android) {
288     deps += [
289       "//chrome/browser:jni_headers",
290       "//crypto:platform",
291       #'../components/components.gyp:web_contents_delegate_android',  TODO(GYP)
292     ]
293     deps -= [
294       "//chrome/browser/ui/views",
295       "//components/feedback/proto",
296       "//third_party/libusb",
297       "//ui/events",
298     ]
299     sources += rebase_path(gypi_values.chrome_browser_ui_android_sources,
300                            ".", "//chrome")
301
302     defines += [ "CHROME_BUILD_ID=" + android_chrome_build_id ]
303   } else {  # Non-Android.
304     sources += rebase_path(gypi_values.chrome_browser_ui_non_android_sources,
305                            ".", "//chrome")
306   }
307
308   if (is_mac) {
309     sources += rebase_path(gypi_values.chrome_browser_ui_mac_sources,
310                            ".", "//chrome")
311     sources -= [
312       # Mac has its own way of drawing tabs.
313       "tabs/tab_resources.cc",
314       "tabs/tab_resources.h",
315     ]
316     deps += [
317       "//third_party/google_toolbox_for_mac",
318       ":generate_localizer",
319       #'../third_party/apple_sample_code/apple_sample_code.gyp:apple_sample_code',  TODO(GYP)
320       #'../third_party/molokocacao/molokocacao.gyp:molokocacao',  TODO(GYP)
321       #'../third_party/mozilla/mozilla.gyp:mozilla',  TODO(GYP)
322     ]
323     include_dirs = [ "$target_gen_dir" ]
324     libs += [ "Quartz.framework" ]
325     configs += [
326       "//third_party/google_toolbox_for_mac:google_toolbox_for_mac_config",
327     ]
328   } else {  # non-Mac.
329     sources += rebase_path(gypi_values.chrome_browser_ui_non_mac_sources,
330                            ".", "//chrome")
331   }
332
333   if (is_win) {
334     sources += rebase_path(gypi_values.chrome_browser_ui_win_sources,
335                            ".", "//chrome")
336     public_deps += [
337       "//ui/views",
338       "//ui/views/controls/webview",
339     ]
340     deps += [
341       "//chrome/installer/util:strings",
342       "//third_party/wtl",
343       "//third_party/iaccessible2",
344       "//third_party/isimpledom",
345       "//ui/app_list",
346       #'metro_utils',  TODO(GYP)
347       #'../google_update/google_update.gyp:google_update',  TODO(GYP)
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                            ".", "//chrome")
360   }
361   if (is_linux) {  # Both desktop Linux and ChromeOS.
362     sources += rebase_path(gypi_values.chrome_browser_ui_linux_sources,
363                            ".", "//chrome")
364     configs += [ "//build/config/linux:udev" ]
365     if (use_aura) {
366       configs += [ "//build/config/linux:fontconfig" ]
367       deps += [ "//dbus" ]
368     }
369     if (use_x11) {
370       sources += rebase_path(gypi_values.chrome_browser_ui_x11_sources,
371                              ".", "//chrome")
372       configs += [ "//build/config/linux:x11" ]
373       deps += [ "//ui/events/devices" ]
374       if (is_chromeos) {
375         sources -= [ "views/tabs/window_finder_x11.cc" ]
376       }
377     }
378   }
379
380   if (enable_app_list) {
381     sources += rebase_path(gypi_values.chrome_browser_ui_app_list_sources,
382                            ".", "//chrome")
383     deps += [ "//ui/app_list" ]
384   } else {
385     sources += rebase_path(gypi_values.chrome_browser_ui_non_app_list_sources,
386                            ".", "//chrome")
387   }
388   if (enable_autofill_dialog) {
389     sources += rebase_path(
390         gypi_values.chrome_browser_ui_autofill_dialog_sources,
391         ".", "//chrome")
392     if (!is_android && !is_ios) {
393       sources += rebase_path(
394           gypi_values.chrome_browser_ui_autofill_dialog_non_mobile_sources,
395           ".", "//chrome")
396       deps += [
397         "//third_party/libaddressinput",
398         "//third_party/libaddressinput:strings",
399       ]
400     }
401   }
402   if (enable_extensions) {
403     deps += [
404       "//chrome/browser/extensions",
405       "//chrome/common/extensions/api",
406       "//chrome/common/extensions/api:api_registration",
407     ]
408     sources += rebase_path(gypi_values.chrome_browser_ui_extensions_sources,
409                            ".", "//chrome")
410   }
411   if (enable_google_now && !is_android) {
412     sources += rebase_path(
413         gypi_values.chrome_browser_ui_google_now_non_android_sources,
414         ".", "//chrome")
415   }
416   if (enable_webrtc) {
417     sources += rebase_path(gypi_values.chrome_browser_ui_webrtc_sources,
418                            ".", "//chrome")
419   }
420   if (enable_service_discovery) {
421     sources += rebase_path(
422         gypi_values.chrome_browser_ui_service_discovery_sources,
423         ".", "//chrome")
424   }
425   if (enable_spellcheck) {
426     deps += [ "//third_party/hunspell" ]
427   }
428 }
429
430 if (is_mac) {
431   nib_gypi_values = exec_script(
432       "//build/gypi_to_gn.py",
433       [ rebase_path("../../chrome_nibs.gypi") ],
434       "scope",
435       [ "../../chrome_nibs.gypi" ])
436
437   action("generate_localizer") {
438     script = "//chrome/tools/build/mac/generate_localizer"
439     sources = [ ]
440     table_path = "$target_gen_dir/ui_localizer_table.h"
441     outputs = [ table_path ]
442     args = [ rebase_path(table_path, root_build_dir) ] +
443              rebase_path(nib_gypi_values.mac_translated_xibs,
444                          root_build_dir,
445                          "//chrome")
446   }
447 }
448
449 # In GYP this is part of test_support_common.
450 source_set("test_support") {
451   testonly = true
452
453   sources = [
454     "browser.h",
455     "cocoa/find_bar/find_bar_host_unittest_util_cocoa.mm",
456     "cocoa/run_loop_testing.h",
457     "cocoa/run_loop_testing.mm",
458     "find_bar/find_bar_host_unittest_util.h",
459     "fullscreen/fullscreen_controller_state_test.cc",
460     "fullscreen/fullscreen_controller_state_test.h",
461     "fullscreen/fullscreen_controller_state_tests.h",
462     "fullscreen/fullscreen_controller_test.cc",
463     "fullscreen/fullscreen_controller_test.h",
464     "login/login_prompt_test_utils.cc",
465     "login/login_prompt_test_utils.h",
466     "passwords/manage_passwords_ui_controller_mock.cc",
467     "passwords/manage_passwords_ui_controller_mock.h",
468     "pdf/pdf_browsertest_base.cc",
469     "pdf/pdf_browsertest_base.h",
470     "test/test_confirm_bubble_model.cc",
471     "test/test_confirm_bubble_model.h",
472     "website_settings/mock_permission_bubble_request.cc",
473     "website_settings/mock_permission_bubble_request.h",
474   ]
475
476   if (toolkit_views) {
477     sources += [
478       "views/find_bar_host_unittest_util_views.cc",
479     ]
480   }
481
482   public_deps = [
483     ":ui",
484   ]
485   deps = [
486     "//chrome/app/theme:theme_resources",
487     "//chrome/browser",
488     "//content/public/browser",
489     "//content/public/common",
490     "//content/test:test_support",
491     "//net:test_support",
492     "//skia",
493     "//testing/gtest",
494     "//ui/base",
495   ]
496 }