Refactor WebsiteSettings to operate on a SecurityInfo
[chromium-blink-merge.git] / chrome / browser / ui / BUILD.gn
blobb3ad7434c5a467f53221e768f0e912d52ba1450f
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/power",
96       "//components/suggestions/proto",
97       "//components/url_formatter",
98       "//device/nfc",
99       "//media",
100       "//net:net_with_v8",
101       "//storage/browser",
102       "//storage/common",
103       "//third_party/WebKit/public:resources",
104       "//third_party/adobe/flash:flapper_version_h",
105       "//third_party/leveldatabase",
106       "//third_party/mojo/src/mojo/edk/system",
107       "//third_party/libjingle",
108       "//third_party/re2",
109       "//ui/base/ime",
110       "//ui/compositor",
111       "//ui/surface",
112       "//ui/web_dialogs",
113       "//v8",
114     ]
115   } else {
116     # iOS.
117     sources +=
118         rebase_path(gypi_values.chrome_browser_ui_ios_sources, ".", "//chrome")
119     deps += [ "//net" ]
120   }
122   if (!is_android && !is_ios) {
123     sources += rebase_path(gypi_values.chrome_browser_ui_non_mobile_sources,
124                            ".",
125                            "//chrome")
126     sources +=
127         rebase_path(gypi_values.chrome_browser_ui_omnibox_non_mobile_sources,
128                     ".",
129                     "//chrome")
130     deps += [
131       "//components/copresence",
132       "//components/feedback/proto",
133       "//components/proximity_auth/webui",
134       "//device/bluetooth",
135       "//third_party/libusb",
136     ]
137   }
139   if (enable_basic_printing || enable_print_preview) {
140     deps += [ "//printing" ]
141   }
143   if (enable_nacl) {
144     sources +=
145         rebase_path(gypi_values.chrome_browser_ui_nacl_sources, ".", "//chrome")
146     deps += [ "//native_client/src/trusted/service_runtime:sel" ]
147   }
148   if (enable_configuration_policy) {
149     sources += rebase_path(gypi_values.chrome_browser_ui_policy_sources,
150                            ".",
151                            "//chrome")
152     deps += [ "//components/policy" ]
153   }
154   if (enable_plugins) {
155     sources += rebase_path(gypi_values.chrome_browser_ui_plugin_sources,
156                            ".",
157                            "//chrome")
158     deps += [ "//ppapi/proxy:ipc" ]
159   }
160   if (safe_browsing_mode == 1) {
161     deps += [
162       "//chrome/browser/safe_browsing:chunk_proto",
163       "//chrome/common/safe_browsing:proto",
164       "//chrome/browser/safe_browsing:report_proto",
165     ]
166   }
168   if (is_chromeos && !is_official_build) {
169     sources +=
170         rebase_path(gypi_values.chrome_browser_ui_chromeos_non_official_sources,
171                     ".",
172                     "//chrome")
173   }
175   if (is_chromeos) {
176     sources += rebase_path(gypi_values.chrome_browser_ui_chromeos_sources,
177                            ".",
178                            "//chrome")
179     deps += [ "//chrome/browser/chromeos" ]
180   } else {
181     sources += rebase_path(gypi_values.chrome_browser_ui_non_chromeos_sources,
182                            ".",
183                            "//chrome")
184     defines += [ "FRAME_AVATAR_BUTTON=1" ]
185   }
186   if (use_cups) {
187     configs += [ "//printing:cups" ]
188   }
189   if (use_ash) {
190     sources +=
191         rebase_path(gypi_values.chrome_browser_ui_ash_sources, ".", "//chrome")
192     deps += [
193       "//ash",
194       "//ash:ash_with_content",
195       "//ash/strings",
196       "//components/user_manager",
197     ]
198     if (!is_chromeos) {
199       sources += rebase_path(gypi_values.chrome_browser_ui_ash_non_chromeos,
200                              ".",
201                              "//chrome")
202     }
203   } else {  # Not ash.
204     sources += rebase_path(gypi_values.chrome_browser_ui_non_ash_sources,
205                            ".",
206                            "//chrome")
207   }
208   if (toolkit_views) {
209     sources += rebase_path(gypi_values.chrome_browser_ui_views_sources,
210                            ".",
211                            "//chrome")
212     deps += [ "//components/constrained_window" ]
214     if (enable_extensions) {
215       deps += [ "//extensions/components/native_app_window" ]
216     }
218     if (!is_chromeos && (!is_mac || mac_views_browser)) {
219       sources +=
220           rebase_path(gypi_values.chrome_browser_ui_views_non_chromeos_sources,
221                       ".",
222                       "//chrome")
223     }
224     if (!is_mac) {
225       sources +=
226           rebase_path(gypi_values.chrome_browser_ui_views_non_mac_sources,
227                       ".",
228                       "//chrome")
229       if (enable_extensions) {
230         sources += rebase_path(
231                 gypi_values.chrome_browser_ui_views_extensions_non_mac_sources,
232                 ".",
233                 "//chrome")
234       }
235     }
236     if (use_ash) {
237       sources += rebase_path(gypi_values.chrome_browser_ui_ash_views_sources,
238                              ".",
239                              "//chrome")
240     }
241   }
242   if (use_aura && !use_ozone && is_desktop_linux) {
243     deps += [
244       "//build/linux:gio",
246       # gtk2 is the only component that can interact with gtk2 in our new
247       # world.
248       "//chrome/browser/ui/libgtk2ui",
249     ]
250   }
251   if (is_win || is_mac || is_desktop_linux) {
252     sources += rebase_path(gypi_values.chrome_browser_ui_desktop_sources,
253                            ".",
254                            "//chrome")
255   }
256   if (use_aura) {
257     sources +=
258         rebase_path(gypi_values.chrome_browser_ui_aura_sources, ".", "//chrome")
259     deps += [
260       # aura uses some of ash resources.
261       "//ash/resources",
262       "//ui/aura",
263       "//ui/keyboard",
264       "//ui/keyboard:resources",
265       "//ui/wm",
266     ]
267     if (!is_chromeos) {
268       sources += rebase_path(gypi_values.chrome_browser_ui_aura_non_chromeos,
269                              ".",
270                              "//chrome")
271     }
272   }
273   if (ui_compositor_image_transport) {
274     deps += [ "//ui/gl" ]
275   }
276   if (use_nss_certs) {
277     sources +=
278         rebase_path(gypi_values.chrome_browser_ui_nss_sources, ".", "//chrome")
279   }
280   if (!enable_themes) {
281     sources -= [ "webui/theme_source.cc" ]
282   }
283   if (enable_print_preview) {
284     sources += rebase_path(gypi_values.chrome_browser_ui_print_preview_sources,
285                            ".",
286                            "//chrome")
287   }
289   if (is_android) {
290     deps += [
291       "//chrome/browser:jni_headers",
292       "//crypto:platform",
293       "//components/web_contents_delegate_android",
294     ]
295     deps -= [
296       "//chrome/browser/ui/views",
297       "//ui/events",
298     ]
299     sources += rebase_path(gypi_values.chrome_browser_ui_android_sources,
300                            ".",
301                            "//chrome")
303     defines += [ "CHROME_BUILD_ID=" + android_chrome_build_id ]
304   }
306   if (is_mac) {
307     sources +=
308         rebase_path(gypi_values.chrome_browser_ui_mac_sources, ".", "//chrome")
309     deps += [
310       ":generate_localizer",
311       "//third_party/apple_sample_code",
312       "//third_party/google_toolbox_for_mac",
313       "//third_party/molokocacao",
314       "//third_party/mozilla",
315     ]
316     if (mac_views_browser) {
317       sources += rebase_path(
318               gypi_values.chrome_browser_ui_views_mac_experimental_sources,
319               ".",
320               "//chrome")
321       sources +=
322           rebase_path(gypi_values.chrome_browser_ui_views_non_mac_sources,
323                       ".",
324                       "//chrome")
325       sources += rebase_path(
326               gypi_values.chrome_browser_ui_views_extensions_non_mac_sources,
327               ".",
328               "//chrome")
329       deps += [ "//extensions/components/native_app_window" ]
330     } else {
331       sources += rebase_path(gypi_values.chrome_browser_ui_cocoa_sources,
332                              ".",
333                              "//chrome")
334     }
335     include_dirs = [ "$target_gen_dir" ]
336     libs += [ "Quartz.framework" ]
337     configs +=
338         [ "//third_party/google_toolbox_for_mac:google_toolbox_for_mac_config" ]
339   } else {  # non-Mac.
340     sources += rebase_path(gypi_values.chrome_browser_ui_non_mac_sources,
341                            ".",
342                            "//chrome")
343   }
345   if (is_win) {
346     sources +=
347         rebase_path(gypi_values.chrome_browser_ui_win_sources, ".", "//chrome")
348     sources -= [
349       "views/frame/taskbar_decorator.cc",
350     ]
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   ]