blob: fe42ae9ec26e251e7527361e005c60b4a5f41427 [file] [log] [blame]
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/ui.gni")
if (is_android) {
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
}
component("base") {
output_name = "ui_base"
sources = [
"accelerators/accelerator.cc",
"accelerators/accelerator.h",
"accelerators/accelerator_manager.cc",
"accelerators/accelerator_manager.h",
"accelerators/menu_label_accelerator_util_linux.cc",
"accelerators/menu_label_accelerator_util_linux.h",
"accelerators/platform_accelerator.h",
"accelerators/platform_accelerator_cocoa.h",
"accelerators/platform_accelerator_cocoa.mm",
"android/ui_base_jni_registrar.cc",
"android/ui_base_jni_registrar.h",
"android/view_android.cc",
"android/view_android.h",
"android/window_android.cc",
"android/window_android.h",
"android/window_android_compositor.h",
"android/window_android_observer.h",
"base_window.cc",
"base_window.h",
"clipboard/clipboard.cc",
"clipboard/clipboard.h",
"clipboard/clipboard_android.cc",
"clipboard/clipboard_android_initialization.h",
"clipboard/clipboard_constants.cc",
"clipboard/clipboard_mac.mm",
"clipboard/clipboard_types.h",
"clipboard/clipboard_util_win.cc",
"clipboard/clipboard_util_win.h",
"clipboard/clipboard_win.cc",
"clipboard/custom_data_helper.cc",
"clipboard/custom_data_helper.h",
"clipboard/custom_data_helper_linux.cc",
"clipboard/custom_data_helper_mac.mm",
"clipboard/scoped_clipboard_writer.cc",
"clipboard/scoped_clipboard_writer.h",
"cocoa/animation_utils.h",
"cocoa/appkit_utils.h",
"cocoa/appkit_utils.mm",
"cocoa/base_view.h",
"cocoa/base_view.mm",
"cocoa/cocoa_base_utils.h",
"cocoa/cocoa_base_utils.mm",
"cocoa/controls/blue_label_button.h",
"cocoa/controls/blue_label_button.mm",
"cocoa/controls/hover_image_menu_button.h",
"cocoa/controls/hover_image_menu_button.mm",
"cocoa/controls/hover_image_menu_button_cell.h",
"cocoa/controls/hover_image_menu_button_cell.mm",
"cocoa/controls/hyperlink_button_cell.h",
"cocoa/controls/hyperlink_button_cell.mm",
"cocoa/find_pasteboard.h",
"cocoa/find_pasteboard.mm",
"cocoa/flipped_view.h",
"cocoa/flipped_view.mm",
"cocoa/focus_tracker.h",
"cocoa/focus_tracker.mm",
"cocoa/focus_window_set.h",
"cocoa/focus_window_set.mm",
"cocoa/fullscreen_window_manager.h",
"cocoa/fullscreen_window_manager.mm",
"cocoa/hover_button.h",
"cocoa/hover_button.mm",
"cocoa/hover_image_button.h",
"cocoa/hover_image_button.mm",
"cocoa/menu_controller.h",
"cocoa/menu_controller.mm",
"cocoa/nib_loading.h",
"cocoa/nib_loading.mm",
"cocoa/nsgraphics_context_additions.h",
"cocoa/nsgraphics_context_additions.mm",
"cocoa/tracking_area.h",
"cocoa/tracking_area.mm",
"cocoa/underlay_opengl_hosting_window.h",
"cocoa/underlay_opengl_hosting_window.mm",
"cocoa/view_description.h",
"cocoa/view_description.mm",
"cocoa/window_size_constants.h",
"cocoa/window_size_constants.mm",
"cursor/cursor.cc",
"cursor/cursor.h",
"cursor/cursor_android.cc",
"cursor/cursor_loader.h",
"cursor/cursor_loader_win.cc",
"cursor/cursor_loader_win.h",
"cursor/cursor_util.cc",
"cursor/cursor_util.h",
"cursor/cursor_win.cc",
"cursor/cursors_aura.cc",
"cursor/cursors_aura.h",
"default_theme_provider.cc",
"default_theme_provider.h",
"default_theme_provider_mac.mm",
"device_form_factor_android.cc",
"device_form_factor_android.h",
"device_form_factor_desktop.cc",
"device_form_factor_ios.mm",
"device_form_factor.h",
"dragdrop/cocoa_dnd_util.h",
"dragdrop/cocoa_dnd_util.mm",
"dragdrop/drag_drop_types.h",
"dragdrop/drag_drop_types.h",
"dragdrop/drag_drop_types_win.cc",
"dragdrop/drag_source_win.cc",
"dragdrop/drag_source_win.h",
"dragdrop/drag_utils.cc",
"dragdrop/drag_utils.h",
"dragdrop/drag_utils_aura.cc",
"dragdrop/drag_utils_win.cc",
"dragdrop/drop_target_event.cc",
"dragdrop/drop_target_event.h",
"dragdrop/drop_target_win.cc",
"dragdrop/drop_target_win.h",
"dragdrop/file_info.cc",
"dragdrop/file_info.h",
"dragdrop/os_exchange_data.cc",
"dragdrop/os_exchange_data.h",
"dragdrop/os_exchange_data_provider_win.cc",
"dragdrop/os_exchange_data_provider_win.h",
"hit_test.h",
"l10n/formatter.cc",
"l10n/formatter.h",
"l10n/l10n_font_util.cc",
"l10n/l10n_font_util.h",
"l10n/l10n_util.cc",
"l10n/l10n_util.h",
"l10n/l10n_util_android.cc",
"l10n/l10n_util_android.h",
"l10n/l10n_util_collator.h",
"l10n/l10n_util_mac.h",
"l10n/l10n_util_mac.mm",
"l10n/l10n_util_plurals.cc",
"l10n/l10n_util_plurals.h",
"l10n/l10n_util_posix.cc",
"l10n/l10n_util_win.cc",
"l10n/l10n_util_win.h",
"l10n/time_format.cc",
"l10n/time_format.h",
"layout.cc",
"layout.h",
"layout_mac.mm",
"models/button_menu_item_model.cc",
"models/button_menu_item_model.h",
"models/combobox_model.cc",
"models/combobox_model.h",
"models/combobox_model_observer.h",
"models/dialog_model.cc",
"models/dialog_model.h",
"models/list_model.h",
"models/list_model_observer.h",
"models/list_selection_model.cc",
"models/list_selection_model.h",
"models/menu_model.cc",
"models/menu_model.h",
"models/menu_model_delegate.h",
"models/menu_separator_types.h",
"models/simple_menu_model.cc",
"models/simple_menu_model.h",
"models/table_model.cc",
"models/table_model.h",
"models/table_model_observer.h",
"models/tree_model.cc",
"models/tree_model.h",
"models/tree_node_iterator.h",
"models/tree_node_model.h",
"nine_image_painter_factory.cc",
"nine_image_painter_factory.h",
"resource/data_pack.cc",
"resource/data_pack.h",
"resource/resource_bundle.cc",
"resource/resource_bundle.h",
"resource/resource_bundle_android.cc",
"resource/resource_bundle_auralinux.cc",
"resource/resource_bundle_ios.mm",
"resource/resource_bundle_mac.mm",
"resource/resource_bundle_win.cc",
"resource/resource_bundle_win.h",
"resource/resource_data_dll_win.cc",
"resource/resource_data_dll_win.h",
"resource/resource_handle.h",
"text/bytes_formatting.cc",
"text/bytes_formatting.h",
"theme_provider.cc",
"theme_provider.h",
"touch/touch_device.h",
"touch/touch_editing_controller.cc",
"touch/touch_editing_controller.h",
"touch/touch_enabled.cc",
"touch/touch_enabled.h",
"ui_base_exports.cc",
"ui_base_paths.cc",
"ui_base_paths.h",
"ui_base_switches.cc",
"ui_base_switches.h",
"ui_base_switches_util.cc",
"ui_base_switches_util.h",
"ui_base_types.cc",
"ui_base_types.h",
"ui_base_export.h",
"view_prop.cc",
"view_prop.h",
"webui/jstemplate_builder.cc",
"webui/jstemplate_builder.h",
"webui/web_ui_util.cc",
"webui/web_ui_util.h",
"win/accessibility_ids_win.h",
"win/accessibility_misc_utils.cc",
"win/accessibility_misc_utils.h",
"win/atl_module.h",
"win/dpi_setup.cc",
"win/dpi_setup.h",
"win/foreground_helper.cc",
"win/foreground_helper.h",
"win/hidden_window.cc",
"win/hidden_window.h",
"win/hwnd_subclass.cc",
"win/hwnd_subclass.h",
"win/internal_constants.cc",
"win/internal_constants.h",
"win/lock_state.cc",
"win/lock_state.h",
"win/message_box_win.cc",
"win/message_box_win.h",
"win/mouse_wheel_util.cc",
"win/mouse_wheel_util.h",
"win/scoped_ole_initializer.cc",
"win/scoped_ole_initializer.h",
"win/shell.cc",
"win/shell.h",
"win/touch_input.cc",
"win/touch_input.h",
"win/window_event_target.cc",
"win/window_event_target.h",
"window_open_disposition.cc",
"window_open_disposition.h",
"work_area_watcher_observer.h",
"x/x11_menu_list.cc",
"x/x11_menu_list.h",
"x/x11_util.cc",
"x/x11_util.h",
"x/x11_util_internal.h",
]
if (is_win) {
sources += [ "touch/touch_device_win.cc" ]
} else if (is_android) {
sources += [ "touch/touch_device_android.cc" ]
} else if (use_ozone) {
sources += [ "touch/touch_device_ozone.cc" ]
} else if (use_aura && use_x11) {
sources += [ "touch/touch_device_aurax11.cc" ]
} else {
# Empty implementation for all other cases.
sources += [ "touch/touch_device.cc" ]
}
defines = [ "UI_BASE_IMPLEMENTATION" ]
deps = [
"//base",
"//base/third_party/dynamic_annotations",
"//base:base_static",
"//base:i18n",
"//net",
"//skia",
"//third_party/icu",
"//ui/resources",
"//ui/resources:unscaled_resources",
"//ui/strings",
"//ui/webui/resources",
"//url",
]
if (is_ios) {
sources += [
"l10n/l10n_util_mac.h",
"l10n/l10n_util_mac.mm",
]
}
if (toolkit_views) {
deps += [
"//ui/events",
]
}
if (use_x11 && use_aura) {
sources += [
"x/selection_owner.cc",
"x/selection_owner.h",
"x/selection_requestor.cc",
"x/selection_requestor.h",
"x/selection_utils.cc",
"x/selection_utils.h",
]
}
if (use_aura) {
deps += [
"//ui/events",
]
} else {
sources -= [
"cursor/cursor.cc",
"cursor/cursor.h",
"dragdrop/drag_utils_aura.cc",
]
}
if (!use_x11) {
sources -= [
"x/x11_util.cc",
"x/x11_util.h",
"x/x11_util_internal.h",
]
}
if (!use_aura || !is_linux) {
sources -= [
"resource/resource_bundle_auralinux.cc",
]
}
if (use_aura && is_win) {
sources -= [
"dragdrop/drag_utils_aura.cc",
]
}
if (is_linux) {
configs += [
"//build/config/linux:fontconfig",
"//build/config/linux:glib",
]
}
if ((is_linux && !is_chromeos) || is_chromeos) {
if (!toolkit_views && !use_aura) {
sources -= [
"dragdrop/drag_utils.cc",
"dragdrop/drag_utils.h",
]
}
}
if (use_pango) {
configs += [
"//build/config/linux:pangocairo",
]
}
if (is_chromeos || (use_aura && is_linux && !use_x11)) {
sources += [
"dragdrop/os_exchange_data_provider_aura.cc",
"dragdrop/os_exchange_data_provider_aura.h",
]
}
libs = []
if (is_win) {
deps += [
"//third_party/wtl",
]
cflags = [
"/wd4267", # TODO(jschuh): C4267: http://crbug.com/167187 size_t -> int.
"/wd4324", # Structure was padded due to __declspec(align()), which is
# uninteresting.
]
ldflags = [
"/DELAYLOAD:d2d1.dll",
"/DELAYLOAD:d3d10_1.dll",
"/DELAYLOAD:dwmapi.dll",
]
libs += [
"d2d1.lib",
"d3d10_1.lib",
"dwmapi.lib",
"imm32.lib",
"d2d1.lib",
"dwmapi.lib",
"oleacc.lib",
]
} else {
if (!use_aura) {
sources -= [
"view_prop.cc",
"view_prop.h",
]
}
}
if (is_mac) {
deps += [
#TODO(tfarina): port this third_party component to GN.
#"//third_party/mozilla",
]
sources -= [
"dragdrop/drag_utils.cc",
"dragdrop/drag_utils.h",
]
libs += [
"Accelerate.framework",
"AudioUnit.framework",
"CoreView.framework",
]
}
if (use_x11) {
#'all_dependent_settings': {
#'ldflags': [
#'-L<(PRODUCT_DIR)',
#],
#},
configs += [
"//build/config/linux:x11"
]
}
if (use_aura) {
if (use_x11) {
sources += [
"cursor/cursor_loader_x11.cc",
"cursor/cursor_loader_x11.h",
"cursor/cursor_x11.cc",
]
if (!is_chromeos) {
# These Aura X11 files aren't used on ChromeOS.
sources += [
"dragdrop/os_exchange_data_provider_aurax11.cc",
"dragdrop/os_exchange_data_provider_aurax11.h",
]
}
}
}
if (!toolkit_views) {
sources -= [
"dragdrop/drag_drop_types.h",
"dragdrop/drop_target_event.cc",
"dragdrop/drop_target_event.h",
"dragdrop/os_exchange_data.cc",
"dragdrop/os_exchange_data.h",
"nine_image_painter_factory.cc",
"nine_image_painter_factory.h",
]
}
if (is_android) {
sources -= [
"default_theme_provider.cc",
"dragdrop/drag_utils.cc",
"dragdrop/drag_utils.h",
"l10n/l10n_font_util.cc",
"models/button_menu_item_model.cc",
"models/dialog_model.cc",
"theme_provider.cc",
"touch/touch_editing_controller.cc",
"ui_base_types.cc",
]
deps += [
":ui_base_jni_headers",
]
libs += [
"jnigraphics",
]
}
if (is_android && is_android_webview_build) {
deps += [
#TODO(GYP): port this component to GN.
#"//ui/android:ui_java",
]
}
if (is_android && !use_aura) {
sources -= [
"cursor/cursor_android.cc",
]
}
# Aura clipboard.
if (use_aura) {
if (use_x11) {
sources += [ "clipboard/clipboard_aurax11.cc" ]
} else if (!is_win) {
# This file is used for all non-X11, non-Windows aura Builds.
sources += [ "clipboard/clipboard_aura.cc" ]
}
}
if (is_android || is_ios) {
sources -= [
"device_form_factor_desktop.cc",
]
}
}
source_set("ui_base_test_support") {
sources = [
"test/ui_controls.h",
"test/ui_controls_aura.cc",
"test/ui_controls_internal_win.cc",
"test/ui_controls_internal_win.h",
"test/ui_controls_mac.mm",
"test/ui_controls_win.cc",
]
deps = [
"//base",
"//skia",
"//testing/gtest",
"//ui/events:events_base",
"//ui/gfx",
"//ui/gfx/geometry",
]
if (!is_ios) {
sources += [
"ime/dummy_input_method.cc",
"ime/dummy_input_method.h",
"ime/dummy_text_input_client.cc",
"ime/dummy_text_input_client.h",
]
}
}
if (is_android) {
generate_jni("ui_base_jni_headers") {
sources = [
"../android/java/src/org/chromium/ui/base/Clipboard.java",
"../android/java/src/org/chromium/ui/base/DeviceFormFactor.java",
"../android/java/src/org/chromium/ui/base/LocalizationUtils.java",
"../android/java/src/org/chromium/ui/base/SelectFileDialog.java",
"../android/java/src/org/chromium/ui/base/TouchDevice.java",
"../android/java/src/org/chromium/ui/base/ViewAndroid.java",
"../android/java/src/org/chromium/ui/base/WindowAndroid.java",
]
jni_package = "base"
}
}