BUILD.gn revision cedac228d2dd51db4b79ea1e72c7f249408ee061
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 5import("//build/config/ui.gni") 6 7if (is_android) { 8 import("//build/config/android/config.gni") 9 import("//build/config/android/rules.gni") 10} 11 12component("base") { 13 output_name = "ui_base" 14 sources = [ 15 "accelerators/accelerator.cc", 16 "accelerators/accelerator.h", 17 "accelerators/accelerator_manager.cc", 18 "accelerators/accelerator_manager.h", 19 "accelerators/menu_label_accelerator_util_linux.cc", 20 "accelerators/menu_label_accelerator_util_linux.h", 21 "accelerators/platform_accelerator.h", 22 "accelerators/platform_accelerator_cocoa.h", 23 "accelerators/platform_accelerator_cocoa.mm", 24 "android/ui_base_jni_registrar.cc", 25 "android/ui_base_jni_registrar.h", 26 "android/view_android.cc", 27 "android/view_android.h", 28 "android/window_android.cc", 29 "android/window_android.h", 30 "android/window_android_compositor.h", 31 "android/window_android_observer.h", 32 "base_window.cc", 33 "base_window.h", 34 "clipboard/clipboard.cc", 35 "clipboard/clipboard.h", 36 "clipboard/clipboard_android.cc", 37 "clipboard/clipboard_android_initialization.h", 38 "clipboard/clipboard_constants.cc", 39 "clipboard/clipboard_mac.mm", 40 "clipboard/clipboard_types.h", 41 "clipboard/clipboard_util_win.cc", 42 "clipboard/clipboard_util_win.h", 43 "clipboard/clipboard_win.cc", 44 "clipboard/custom_data_helper.cc", 45 "clipboard/custom_data_helper.h", 46 "clipboard/custom_data_helper_linux.cc", 47 "clipboard/custom_data_helper_mac.mm", 48 "clipboard/scoped_clipboard_writer.cc", 49 "clipboard/scoped_clipboard_writer.h", 50 "cocoa/animation_utils.h", 51 "cocoa/appkit_utils.h", 52 "cocoa/appkit_utils.mm", 53 "cocoa/base_view.h", 54 "cocoa/base_view.mm", 55 "cocoa/cocoa_base_utils.h", 56 "cocoa/cocoa_base_utils.mm", 57 "cocoa/controls/blue_label_button.h", 58 "cocoa/controls/blue_label_button.mm", 59 "cocoa/controls/hover_image_menu_button.h", 60 "cocoa/controls/hover_image_menu_button.mm", 61 "cocoa/controls/hover_image_menu_button_cell.h", 62 "cocoa/controls/hover_image_menu_button_cell.mm", 63 "cocoa/controls/hyperlink_button_cell.h", 64 "cocoa/controls/hyperlink_button_cell.mm", 65 "cocoa/find_pasteboard.h", 66 "cocoa/find_pasteboard.mm", 67 "cocoa/flipped_view.h", 68 "cocoa/flipped_view.mm", 69 "cocoa/focus_tracker.h", 70 "cocoa/focus_tracker.mm", 71 "cocoa/focus_window_set.h", 72 "cocoa/focus_window_set.mm", 73 "cocoa/fullscreen_window_manager.h", 74 "cocoa/fullscreen_window_manager.mm", 75 "cocoa/hover_button.h", 76 "cocoa/hover_button.mm", 77 "cocoa/hover_image_button.h", 78 "cocoa/hover_image_button.mm", 79 "cocoa/menu_controller.h", 80 "cocoa/menu_controller.mm", 81 "cocoa/nib_loading.h", 82 "cocoa/nib_loading.mm", 83 "cocoa/nsgraphics_context_additions.h", 84 "cocoa/nsgraphics_context_additions.mm", 85 "cocoa/tracking_area.h", 86 "cocoa/tracking_area.mm", 87 "cocoa/underlay_opengl_hosting_window.h", 88 "cocoa/underlay_opengl_hosting_window.mm", 89 "cocoa/view_description.h", 90 "cocoa/view_description.mm", 91 "cocoa/window_size_constants.h", 92 "cocoa/window_size_constants.mm", 93 "cursor/cursor.cc", 94 "cursor/cursor.h", 95 "cursor/cursor_android.cc", 96 "cursor/cursor_loader.h", 97 "cursor/cursor_loader_win.cc", 98 "cursor/cursor_loader_win.h", 99 "cursor/cursor_util.cc", 100 "cursor/cursor_util.h", 101 "cursor/cursor_win.cc", 102 "cursor/cursors_aura.cc", 103 "cursor/cursors_aura.h", 104 "default_theme_provider.cc", 105 "default_theme_provider.h", 106 "default_theme_provider_mac.mm", 107 "device_form_factor_android.cc", 108 "device_form_factor_android.h", 109 "device_form_factor_desktop.cc", 110 "device_form_factor_ios.mm", 111 "device_form_factor.h", 112 "dragdrop/cocoa_dnd_util.h", 113 "dragdrop/cocoa_dnd_util.mm", 114 "dragdrop/drag_drop_types.h", 115 "dragdrop/drag_drop_types.h", 116 "dragdrop/drag_drop_types_win.cc", 117 "dragdrop/drag_source_win.cc", 118 "dragdrop/drag_source_win.h", 119 "dragdrop/drag_utils.cc", 120 "dragdrop/drag_utils.h", 121 "dragdrop/drag_utils_aura.cc", 122 "dragdrop/drag_utils_win.cc", 123 "dragdrop/drop_target_event.cc", 124 "dragdrop/drop_target_event.h", 125 "dragdrop/drop_target_win.cc", 126 "dragdrop/drop_target_win.h", 127 "dragdrop/file_info.cc", 128 "dragdrop/file_info.h", 129 "dragdrop/os_exchange_data.cc", 130 "dragdrop/os_exchange_data.h", 131 "dragdrop/os_exchange_data_provider_win.cc", 132 "dragdrop/os_exchange_data_provider_win.h", 133 "hit_test.h", 134 "l10n/formatter.cc", 135 "l10n/formatter.h", 136 "l10n/l10n_font_util.cc", 137 "l10n/l10n_font_util.h", 138 "l10n/l10n_util.cc", 139 "l10n/l10n_util.h", 140 "l10n/l10n_util_android.cc", 141 "l10n/l10n_util_android.h", 142 "l10n/l10n_util_collator.h", 143 "l10n/l10n_util_mac.h", 144 "l10n/l10n_util_mac.mm", 145 "l10n/l10n_util_plurals.cc", 146 "l10n/l10n_util_plurals.h", 147 "l10n/l10n_util_posix.cc", 148 "l10n/l10n_util_win.cc", 149 "l10n/l10n_util_win.h", 150 "l10n/time_format.cc", 151 "l10n/time_format.h", 152 "layout.cc", 153 "layout.h", 154 "layout_mac.mm", 155 "models/button_menu_item_model.cc", 156 "models/button_menu_item_model.h", 157 "models/combobox_model.cc", 158 "models/combobox_model.h", 159 "models/combobox_model_observer.h", 160 "models/dialog_model.cc", 161 "models/dialog_model.h", 162 "models/list_model.h", 163 "models/list_model_observer.h", 164 "models/list_selection_model.cc", 165 "models/list_selection_model.h", 166 "models/menu_model.cc", 167 "models/menu_model.h", 168 "models/menu_model_delegate.h", 169 "models/menu_separator_types.h", 170 "models/simple_menu_model.cc", 171 "models/simple_menu_model.h", 172 "models/table_model.cc", 173 "models/table_model.h", 174 "models/table_model_observer.h", 175 "models/tree_model.cc", 176 "models/tree_model.h", 177 "models/tree_node_iterator.h", 178 "models/tree_node_model.h", 179 "nine_image_painter_factory.cc", 180 "nine_image_painter_factory.h", 181 "resource/data_pack.cc", 182 "resource/data_pack.h", 183 "resource/resource_bundle.cc", 184 "resource/resource_bundle.h", 185 "resource/resource_bundle_android.cc", 186 "resource/resource_bundle_auralinux.cc", 187 "resource/resource_bundle_ios.mm", 188 "resource/resource_bundle_mac.mm", 189 "resource/resource_bundle_win.cc", 190 "resource/resource_bundle_win.h", 191 "resource/resource_data_dll_win.cc", 192 "resource/resource_data_dll_win.h", 193 "resource/resource_handle.h", 194 "text/bytes_formatting.cc", 195 "text/bytes_formatting.h", 196 "theme_provider.cc", 197 "theme_provider.h", 198 "touch/touch_device.cc", 199 "touch/touch_device.h", 200 "touch/touch_device_android.cc", 201 "touch/touch_device_ozone.cc", 202 "touch/touch_device_win.cc", 203 "touch/touch_editing_controller.cc", 204 "touch/touch_editing_controller.h", 205 "touch/touch_enabled.cc", 206 "touch/touch_enabled.h", 207 "ui_base_exports.cc", 208 "ui_base_paths.cc", 209 "ui_base_paths.h", 210 "ui_base_switches.cc", 211 "ui_base_switches.h", 212 "ui_base_switches_util.cc", 213 "ui_base_switches_util.h", 214 "ui_base_types.cc", 215 "ui_base_types.h", 216 "ui_base_export.h", 217 "view_prop.cc", 218 "view_prop.h", 219 # TODO(tfarina): Uncomment these when http://crbug.com/367591 is fixed. 220 "webui/jstemplate_builder.cc", 221 "webui/jstemplate_builder.h", 222 #"webui/web_ui_util.cc", 223 #"webui/web_ui_util.h", 224 "win/accessibility_ids_win.h", 225 "win/accessibility_misc_utils.cc", 226 "win/accessibility_misc_utils.h", 227 "win/atl_module.h", 228 "win/dpi_setup.cc", 229 "win/dpi_setup.h", 230 "win/foreground_helper.cc", 231 "win/foreground_helper.h", 232 "win/hidden_window.cc", 233 "win/hidden_window.h", 234 "win/hwnd_subclass.cc", 235 "win/hwnd_subclass.h", 236 "win/internal_constants.cc", 237 "win/internal_constants.h", 238 "win/lock_state.cc", 239 "win/lock_state.h", 240 "win/message_box_win.cc", 241 "win/message_box_win.h", 242 "win/mouse_wheel_util.cc", 243 "win/mouse_wheel_util.h", 244 "win/scoped_ole_initializer.cc", 245 "win/scoped_ole_initializer.h", 246 "win/shell.cc", 247 "win/shell.h", 248 "win/touch_input.cc", 249 "win/touch_input.h", 250 "win/window_event_target.cc", 251 "win/window_event_target.h", 252 "window_open_disposition.cc", 253 "window_open_disposition.h", 254 "work_area_watcher_observer.h", 255 "x/x11_menu_list.cc", 256 "x/x11_menu_list.h", 257 "x/x11_util.cc", 258 "x/x11_util.h", 259 "x/x11_util_internal.h", 260 ] 261 262 defines = [ "UI_BASE_IMPLEMENTATION" ] 263 264 deps = [ 265 "//base", 266 "//base/third_party/dynamic_annotations", 267 "//base:base_static", 268 "//base:i18n", 269 "//net", 270 "//skia", 271 "//third_party/icu", 272 "//ui/resources", 273 "//ui/resources:unscaled_resources", 274 "//ui/strings", 275 "//ui/webui/resources", 276 "//url", 277 ] 278 279 if (is_ios) { 280 sources += [ 281 "l10n/l10n_util_mac.h", 282 "l10n/l10n_util_mac.mm", 283 ] 284 } 285 286 if (toolkit_views) { 287 deps += [ 288 "//ui/events", 289 ] 290 } 291 292 if (use_x11 && use_aura) { 293 sources += [ 294 "x/selection_owner.cc", 295 "x/selection_owner.h", 296 "x/selection_requestor.cc", 297 "x/selection_requestor.h", 298 "x/selection_utils.cc", 299 "x/selection_utils.h", 300 ] 301 } 302 303 if (use_aura) { 304 deps += [ 305 "//ui/events", 306 ] 307 } else { 308 sources -= [ 309 "cursor/cursor.cc", 310 "cursor/cursor.h", 311 "dragdrop/drag_utils_aura.cc", 312 ] 313 } 314 if (!use_x11) { 315 sources -= [ 316 "x/x11_util.cc", 317 "x/x11_util.h", 318 "x/x11_util_internal.h", 319 ] 320 } 321 322 if (!use_ozone) { 323 sources -= [ 324 "touch/touch_device_ozone.cc", 325 ] 326 } 327 328 if (!use_aura || !is_linux) { 329 sources -= [ 330 "resource/resource_bundle_auralinux.cc", 331 ] 332 } 333 334 if (use_aura && is_win) { 335 sources -= [ 336 "dragdrop/drag_utils_aura.cc", 337 ] 338 } 339 340 if (is_linux) { 341 configs += [ 342 "//build/config/linux:fontconfig", 343 "//build/config/linux:glib", 344 ] 345 } 346 347 if ((is_linux && !is_chromeos) || is_chromeos) { 348 if (!toolkit_views && !use_aura) { 349 sources -= [ 350 "dragdrop/drag_utils.cc", 351 "dragdrop/drag_utils.h", 352 ] 353 } 354 } 355 356 if (use_pango) { 357 configs += [ 358 "//build/config/linux:pangocairo", 359 ] 360 } 361 362 if (is_chromeos || (use_aura && is_linux && !use_x11)) { 363 sources += [ 364 "dragdrop/os_exchange_data_provider_aura.cc", 365 "dragdrop/os_exchange_data_provider_aura.h", 366 ] 367 sources -= [ 368 "touch/touch_device.cc", 369 ] 370 } 371 372 libs = [] 373 if (is_win) { 374 deps += [ 375 "//third_party/wtl", 376 ] 377 sources -= [ 378 "touch/touch_device.cc", 379 ] 380 cflags = [ 381 "/wd4267", # TODO(jschuh): C4267: http://crbug.com/167187 size_t -> int. 382 "/wd4324", # Structure was padded due to __declspec(align()), which is 383 # uninteresting. 384 ] 385 ldflags = [ 386 "/DELAYLOAD:d2d1.dll", 387 "/DELAYLOAD:d3d10_1.dll", 388 "/DELAYLOAD:dwmapi.dll", 389 ] 390 libs += [ 391 "d2d1.lib", 392 "d3d10_1.lib", 393 "dwmapi.lib", 394 "imm32.lib", 395 "d2d1.lib", 396 "dwmapi.lib", 397 "oleacc.lib", 398 ] 399 } else { 400 if (!use_aura) { 401 sources -= [ 402 "view_prop.cc", 403 "view_prop.h", 404 ] 405 } 406 } 407 408 if (is_mac) { 409 deps += [ 410 #TODO(tfarina): port this third_party component to GN. 411 #"//third_party/mozilla", 412 ] 413 414 sources -= [ 415 "dragdrop/drag_utils.cc", 416 "dragdrop/drag_utils.h", 417 ] 418 419 libs += [ 420 "Accelerate.framework", 421 "AudioUnit.framework", 422 "CoreView.framework", 423 ] 424 } 425 426 if (use_x11) { 427 #'all_dependent_settings': { 428 #'ldflags': [ 429 #'-L<(PRODUCT_DIR)', 430 #], 431 #}, 432 configs += [ 433 "//build/config/linux:x11" 434 ] 435 } 436 437 if (use_aura) { 438 if (use_x11) { 439 sources += [ 440 "cursor/cursor_loader_x11.cc", 441 "cursor/cursor_loader_x11.h", 442 "cursor/cursor_x11.cc", 443 "touch/touch_device_aurax11.cc", 444 ] 445 if (!is_chromeos) { 446 # These Aura X11 files aren't used on ChromeOS. 447 sources += [ 448 "dragdrop/os_exchange_data_provider_aurax11.cc", 449 "dragdrop/os_exchange_data_provider_aurax11.h", 450 ] 451 } 452 } 453 } 454 455 if (!toolkit_views) { 456 sources -= [ 457 "dragdrop/drag_drop_types.h", 458 "dragdrop/drop_target_event.cc", 459 "dragdrop/drop_target_event.h", 460 "dragdrop/os_exchange_data.cc", 461 "dragdrop/os_exchange_data.h", 462 "nine_image_painter_factory.cc", 463 "nine_image_painter_factory.h", 464 ] 465 } 466 467 if (is_android) { 468 sources -= [ 469 "default_theme_provider.cc", 470 "dragdrop/drag_utils.cc", 471 "dragdrop/drag_utils.h", 472 "l10n/l10n_font_util.cc", 473 "models/button_menu_item_model.cc", 474 "models/dialog_model.cc", 475 "theme_provider.cc", 476 "touch/touch_device.cc", 477 "touch/touch_editing_controller.cc", 478 "ui_base_types.cc", 479 ] 480 481 deps += [ 482 ":ui_base_jni_headers", 483 ] 484 485 libs += [ 486 "jnigraphics", 487 ] 488 } 489 490 if (is_android && is_android_webview_build) { 491 deps += [ 492 #TODO(GYP): port this component to GN. 493 #"//ui/android:ui_java", 494 ] 495 } 496 497 if (is_android && !use_aura) { 498 sources -= [ 499 "cursor/cursor_android.cc", 500 ] 501 } 502 503 # Aura clipboard. 504 if (use_aura) { 505 if (use_x11) { 506 sources += [ "clipboard/clipboard_aurax11.cc" ] 507 } else if (!is_win) { 508 # This file is used for all non-X11, non-Windows aura Builds. 509 sources += [ "clipboard/clipboard_aura.cc" ] 510 } 511 } 512 513 if (is_android || is_ios) { 514 sources -= [ 515 "device_form_factor_desktop.cc", 516 ] 517 } 518} 519 520source_set("ui_base_test_support") { 521 sources = [ 522 "test/ui_controls.h", 523 "test/ui_controls_aura.cc", 524 "test/ui_controls_internal_win.cc", 525 "test/ui_controls_internal_win.h", 526 "test/ui_controls_mac.mm", 527 "test/ui_controls_win.cc", 528 ] 529 530 deps = [ 531 "//base", 532 "//skia", 533 "//testing/gtest", 534 "//ui/events:events_base", 535 "//ui/gfx", 536 "//ui/gfx/geometry", 537 ] 538 539 if (!is_ios) { 540 sources += [ 541 "ime/dummy_input_method.cc", 542 "ime/dummy_input_method.h", 543 "ime/dummy_text_input_client.cc", 544 "ime/dummy_text_input_client.h", 545 ] 546 } 547} 548 549if (is_android) { 550 generate_jni("ui_base_jni_headers") { 551 sources = [ 552 "../android/java/src/org/chromium/ui/base/Clipboard.java", 553 "../android/java/src/org/chromium/ui/base/DeviceFormFactor.java", 554 "../android/java/src/org/chromium/ui/base/LocalizationUtils.java", 555 "../android/java/src/org/chromium/ui/base/SelectFileDialog.java", 556 "../android/java/src/org/chromium/ui/base/TouchDevice.java", 557 "../android/java/src/org/chromium/ui/base/ViewAndroid.java", 558 "../android/java/src/org/chromium/ui/base/WindowAndroid.java", 559 ] 560 jni_package = "base" 561 } 562} 563