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