Home | History | Annotate | Download | only in base
      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/ui.gni")
      6 
      7 if (is_android) {
      8   import("//build/config/android/config.gni")
      9   import("//build/config/android/rules.gni")
     10 }
     11 
     12 component("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.h",
    199     "touch/touch_editing_controller.cc",
    200     "touch/touch_editing_controller.h",
    201     "touch/touch_enabled.cc",
    202     "touch/touch_enabled.h",
    203     "ui_base_exports.cc",
    204     "ui_base_paths.cc",
    205     "ui_base_paths.h",
    206     "ui_base_switches.cc",
    207     "ui_base_switches.h",
    208     "ui_base_switches_util.cc",
    209     "ui_base_switches_util.h",
    210     "ui_base_types.cc",
    211     "ui_base_types.h",
    212     "ui_base_export.h",
    213     "view_prop.cc",
    214     "view_prop.h",
    215     "webui/jstemplate_builder.cc",
    216     "webui/jstemplate_builder.h",
    217     "webui/web_ui_util.cc",
    218     "webui/web_ui_util.h",
    219     "win/accessibility_ids_win.h",
    220     "win/accessibility_misc_utils.cc",
    221     "win/accessibility_misc_utils.h",
    222     "win/atl_module.h",
    223     "win/dpi_setup.cc",
    224     "win/dpi_setup.h",
    225     "win/foreground_helper.cc",
    226     "win/foreground_helper.h",
    227     "win/hidden_window.cc",
    228     "win/hidden_window.h",
    229     "win/hwnd_subclass.cc",
    230     "win/hwnd_subclass.h",
    231     "win/internal_constants.cc",
    232     "win/internal_constants.h",
    233     "win/lock_state.cc",
    234     "win/lock_state.h",
    235     "win/message_box_win.cc",
    236     "win/message_box_win.h",
    237     "win/mouse_wheel_util.cc",
    238     "win/mouse_wheel_util.h",
    239     "win/scoped_ole_initializer.cc",
    240     "win/scoped_ole_initializer.h",
    241     "win/shell.cc",
    242     "win/shell.h",
    243     "win/touch_input.cc",
    244     "win/touch_input.h",
    245     "win/window_event_target.cc",
    246     "win/window_event_target.h",
    247     "window_open_disposition.cc",
    248     "window_open_disposition.h",
    249     "work_area_watcher_observer.h",
    250     "x/x11_menu_list.cc",
    251     "x/x11_menu_list.h",
    252     "x/x11_util.cc",
    253     "x/x11_util.h",
    254     "x/x11_util_internal.h",
    255   ]
    256 
    257   if (is_win) {
    258     sources += [ "touch/touch_device_win.cc" ]
    259   } else if (is_android) {
    260     sources += [ "touch/touch_device_android.cc" ]
    261   } else if (use_ozone) {
    262     sources += [ "touch/touch_device_ozone.cc" ]
    263   } else if (use_aura && use_x11) { 
    264     sources += [ "touch/touch_device_aurax11.cc" ]
    265   } else {
    266     # Empty implementation for all other cases.
    267     sources += [ "touch/touch_device.cc" ]
    268   }
    269 
    270   defines = [ "UI_BASE_IMPLEMENTATION" ]
    271 
    272   deps = [
    273     "//base",
    274     "//base/third_party/dynamic_annotations",
    275     "//base:base_static",
    276     "//base:i18n",
    277     "//net",
    278     "//skia",
    279     "//third_party/icu",
    280     "//ui/resources",
    281     "//ui/resources:unscaled_resources",
    282     "//ui/strings",
    283     "//ui/webui/resources",
    284     "//url",
    285   ]
    286 
    287   if (is_ios) {
    288     sources += [
    289       "l10n/l10n_util_mac.h",
    290       "l10n/l10n_util_mac.mm",
    291     ]
    292   }
    293 
    294   if (toolkit_views) {
    295     deps += [
    296       "//ui/events",
    297     ]
    298   }
    299 
    300   if (use_x11 && use_aura) {
    301     sources += [
    302       "x/selection_owner.cc",
    303       "x/selection_owner.h",
    304       "x/selection_requestor.cc",
    305       "x/selection_requestor.h",
    306       "x/selection_utils.cc",
    307       "x/selection_utils.h",
    308     ]
    309   }
    310 
    311   if (use_aura) {
    312     deps += [
    313       "//ui/events",
    314     ]
    315   } else {
    316     sources -= [
    317       "cursor/cursor.cc",
    318       "cursor/cursor.h",
    319       "dragdrop/drag_utils_aura.cc",
    320     ]
    321   }
    322   if (!use_x11) {
    323     sources -= [
    324       "x/x11_util.cc",
    325       "x/x11_util.h",
    326       "x/x11_util_internal.h",
    327     ]
    328   }
    329 
    330   if (!use_aura || !is_linux) {
    331     sources -= [
    332       "resource/resource_bundle_auralinux.cc",
    333     ]
    334   }
    335 
    336   if (use_aura && is_win) {
    337     sources -= [
    338       "dragdrop/drag_utils_aura.cc",
    339     ]
    340   }
    341 
    342   if (is_linux) {
    343     configs += [
    344       "//build/config/linux:fontconfig",
    345       "//build/config/linux:glib",
    346     ]
    347   }
    348 
    349   if ((is_linux && !is_chromeos) || is_chromeos) {
    350     if (!toolkit_views && !use_aura) {
    351       sources -= [
    352         "dragdrop/drag_utils.cc",
    353         "dragdrop/drag_utils.h",
    354       ]
    355     }
    356   }
    357 
    358   if (use_pango) {
    359     configs += [
    360       "//build/config/linux:pangocairo",
    361     ]
    362   }
    363 
    364   if (is_chromeos || (use_aura && is_linux && !use_x11)) {
    365     sources += [
    366       "dragdrop/os_exchange_data_provider_aura.cc",
    367       "dragdrop/os_exchange_data_provider_aura.h",
    368     ]
    369   }
    370 
    371   libs = []
    372   if (is_win) {
    373     deps += [
    374       "//third_party/wtl",
    375     ]
    376     cflags = [
    377       "/wd4267",  # TODO(jschuh): C4267: http://crbug.com/167187 size_t -> int.
    378       "/wd4324",  # Structure was padded due to __declspec(align()), which is
    379                   # uninteresting.
    380     ]
    381     ldflags = [
    382       "/DELAYLOAD:d2d1.dll",
    383       "/DELAYLOAD:d3d10_1.dll",
    384       "/DELAYLOAD:dwmapi.dll",
    385     ]
    386     libs += [
    387       "d2d1.lib",
    388       "d3d10_1.lib",
    389       "dwmapi.lib",
    390       "imm32.lib",
    391       "d2d1.lib",
    392       "dwmapi.lib",
    393       "oleacc.lib",
    394     ]
    395   } else {
    396     if (!use_aura) {
    397       sources -= [
    398         "view_prop.cc",
    399         "view_prop.h",
    400       ]
    401     }
    402   }
    403 
    404   if (is_mac) {
    405     deps += [
    406       #TODO(tfarina): port this third_party component to GN.
    407       #"//third_party/mozilla",
    408     ]
    409 
    410     sources -= [
    411       "dragdrop/drag_utils.cc",
    412       "dragdrop/drag_utils.h",
    413     ]
    414 
    415     libs += [
    416       "Accelerate.framework",
    417       "AudioUnit.framework",
    418       "CoreView.framework",
    419     ]
    420   }
    421 
    422   if (use_x11) {
    423     #'all_dependent_settings': {
    424       #'ldflags': [
    425         #'-L<(PRODUCT_DIR)',
    426       #],
    427     #},
    428     configs += [
    429       "//build/config/linux:x11"
    430     ]
    431   }
    432 
    433   if (use_aura) {
    434     if (use_x11) {
    435       sources += [
    436         "cursor/cursor_loader_x11.cc",
    437         "cursor/cursor_loader_x11.h",
    438         "cursor/cursor_x11.cc",
    439       ]
    440       if (!is_chromeos) {
    441         # These Aura X11 files aren't used on ChromeOS.
    442         sources += [
    443           "dragdrop/os_exchange_data_provider_aurax11.cc",
    444           "dragdrop/os_exchange_data_provider_aurax11.h",
    445         ]
    446       }
    447     }
    448   }
    449 
    450   if (!toolkit_views) {
    451     sources -= [
    452       "dragdrop/drag_drop_types.h",
    453       "dragdrop/drop_target_event.cc",
    454       "dragdrop/drop_target_event.h",
    455       "dragdrop/os_exchange_data.cc",
    456       "dragdrop/os_exchange_data.h",
    457       "nine_image_painter_factory.cc",
    458       "nine_image_painter_factory.h",
    459     ]
    460   }
    461 
    462   if (is_android) {
    463     sources -= [
    464       "default_theme_provider.cc",
    465       "dragdrop/drag_utils.cc",
    466       "dragdrop/drag_utils.h",
    467       "l10n/l10n_font_util.cc",
    468       "models/button_menu_item_model.cc",
    469       "models/dialog_model.cc",
    470       "theme_provider.cc",
    471       "touch/touch_editing_controller.cc",
    472       "ui_base_types.cc",
    473     ]
    474 
    475     deps += [
    476       ":ui_base_jni_headers",
    477     ]
    478 
    479     libs += [
    480       "jnigraphics",
    481     ]
    482   }
    483 
    484   if (is_android && is_android_webview_build) {
    485     deps += [
    486       #TODO(GYP): port this component to GN.
    487       #"//ui/android:ui_java",
    488     ]
    489   }
    490 
    491   if (is_android && !use_aura) {
    492     sources -= [
    493       "cursor/cursor_android.cc",
    494     ]
    495   }
    496 
    497   # Aura clipboard.
    498   if (use_aura) {
    499     if (use_x11) {
    500       sources += [ "clipboard/clipboard_aurax11.cc" ]
    501     } else if (!is_win) {
    502       # This file is used for all non-X11, non-Windows aura Builds.
    503       sources += [ "clipboard/clipboard_aura.cc" ]
    504     }
    505   }
    506 
    507   if (is_android || is_ios) {
    508     sources -= [
    509       "device_form_factor_desktop.cc",
    510     ]
    511   }
    512 }
    513 
    514 source_set("ui_base_test_support") {
    515   sources = [
    516     "test/ui_controls.h",
    517     "test/ui_controls_aura.cc",
    518     "test/ui_controls_internal_win.cc",
    519     "test/ui_controls_internal_win.h",
    520     "test/ui_controls_mac.mm",
    521     "test/ui_controls_win.cc",
    522   ]
    523 
    524   deps = [
    525     "//base",
    526     "//skia",
    527     "//testing/gtest",
    528     "//ui/events:events_base",
    529     "//ui/gfx",
    530     "//ui/gfx/geometry",
    531   ]
    532 
    533   if (!is_ios) {
    534     sources += [
    535       "ime/dummy_input_method.cc",
    536       "ime/dummy_input_method.h",
    537       "ime/dummy_text_input_client.cc",
    538       "ime/dummy_text_input_client.h",
    539     ]
    540   }
    541 }
    542 
    543 if (is_android) {
    544   generate_jni("ui_base_jni_headers") {
    545     sources = [
    546       "../android/java/src/org/chromium/ui/base/Clipboard.java",
    547       "../android/java/src/org/chromium/ui/base/DeviceFormFactor.java",
    548       "../android/java/src/org/chromium/ui/base/LocalizationUtils.java",
    549       "../android/java/src/org/chromium/ui/base/ResourceBundle.java",
    550       "../android/java/src/org/chromium/ui/base/SelectFileDialog.java",
    551       "../android/java/src/org/chromium/ui/base/TouchDevice.java",
    552       "../android/java/src/org/chromium/ui/base/ViewAndroid.java",
    553       "../android/java/src/org/chromium/ui/base/WindowAndroid.java",
    554     ]
    555     jni_package = "base"
    556   }
    557 }
    558