Home | History | Annotate | Download | only in ui
      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/crypto.gni")
      6 import("//build/config/features.gni")
      7 import("//build/config/ui.gni")
      8 
      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" ])
     14 
     15 static_library("ui") {
     16   output_name = "browser_ui"
     17 
     18   sources = []
     19   defines = []
     20   libs = []
     21 
     22   configs += [ "//build/config/compiler:wexit_time_destructors" ]
     23 
     24   # Since browser and browser_ui actually depend on each other,
     25   # we must omit the dependency from browser_ui to browser.
     26   # However, this means browser_ui and browser should more or less
     27   # have the same dependencies. Once browser_ui is untangled from
     28   # browser, then we can clean up these dependencies.
     29   public_deps = [
     30     "//components/dom_distiller/core",
     31     "//sync",
     32   ]
     33   deps = [
     34     # NOTE: New dependencies should generally be added in the OS!="ios"
     35     # dependencies block below, rather than here.
     36     "//base/allocator",
     37     "//chrome:extra_resources",
     38     "//chrome:resources",
     39     "//chrome:strings",
     40     "//chrome/app/resources:platform_locale_settings",
     41     "//chrome/app/theme:theme_resources",
     42     "//chrome/browser/history:in_memory_url_index_cache_proto",
     43     "//chrome/browser/net:cert_logger_proto",
     44     "//chrome/common",
     45     "//chrome/common/net",
     46     "//components/auto_login_parser",
     47     "//components/dom_distiller/webui",
     48     "//components/feedback/proto",
     49     "//components/invalidation",
     50     "//components/omaha_query_params",
     51     "//components/onc",
     52     "//components/password_manager/core/browser",
     53     "//components/resources",
     54     "//components/strings",
     55     "//content/public/browser",
     56     "//content/public/common",
     57     "//crypto",
     58     "//skia",
     59     "//third_party/cacheinvalidation",
     60     "//third_party/icu",
     61     "//third_party/libusb",
     62     "//third_party/libxml",
     63     "//third_party/zlib",
     64     "//ui/accessibility",
     65     "//ui/base",
     66     "//ui/events",
     67     "//ui/gfx",
     68     "//ui/gfx/geometry",
     69     "//ui/message_center",
     70     "//ui/native_theme",
     71     "//ui/resources",
     72     "//ui/snapshot",
     73     "//ui/strings",
     74   ]
     75 
     76   if (!is_ios) {
     77     sources += rebase_path(gypi_values.chrome_browser_ui_non_ios_sources,
     78                            ".", "//chrome")
     79     deps += [
     80       "//chrome/browser/devtools",
     81       "//chrome/browser/ui/views",
     82       "//chrome/browser/ui/webui/omnibox:mojo_bindings",
     83       "//chrome/installer/util",
     84       "//components/autofill/content/browser:risk_proto",
     85       "//components/power",
     86       "//device/bluetooth",
     87       "//device/nfc",
     88       "//media",
     89       "//mojo/system",
     90       "//net:net_with_v8",
     91       "//storage/browser",
     92       "//storage/common",
     93       "//third_party/WebKit/public:resources",
     94       "//third_party/adobe/flash:flapper_version_h",
     95       "//third_party/expat",
     96       "//third_party/hunspell",
     97       "//third_party/leveldatabase",
     98       "//third_party/npapi",
     99       "//third_party/libjingle",
    100       "//third_party/re2",
    101       "//ui/compositor",
    102       "//ui/surface",
    103       "//ui/web_dialogs",
    104       "//v8",
    105     ]
    106     # TODO(GYP)
    107     #'defines': [
    108     #  '<@(nacl_defines)',
    109     #],
    110     #'direct_dependent_settings': {
    111     #  'defines': [
    112     #    '<@(nacl_defines)',
    113     #  ],
    114     #  },
    115   } else {
    116     # iOS.
    117     sources += rebase_path(gypi_values.chrome_browser_ui_ios_sources,
    118                            ".", "//chrome")
    119     deps += [ "//net" ]
    120   }
    121 
    122   if (printing_mode != 0) {
    123     deps += [ "//printing" ]
    124   }
    125 
    126   if (enable_one_click_signin) {
    127     sources += rebase_path(
    128         gypi_values.chrome_browser_ui_one_click_signin_sources,
    129         ".", "//chrome")
    130   }
    131   if (enable_task_manager) {
    132     sources += rebase_path(gypi_values.chrome_browser_ui_task_manager_sources,
    133                            ".", "//chrome")
    134     if (!toolkit_views || is_mac) {
    135       sources -= [ "views/task_manager_view.cc" ]
    136     }
    137   }
    138   if (!enable_nacl) {
    139     sources += rebase_path(gypi_values.chrome_browser_ui_nacl_sources,
    140                            ".", "//chrome")
    141     deps += [
    142       #"//native_client/src/trusted/service_runtime/service_runtime.gyp:sel",  TODO(GYP)
    143     ]
    144   }
    145   if (debug_devtools) {
    146     defines += [ "DEBUG_DEVTOOLS=1" ]
    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       #"browser_chromeos",  TODO(GYP)
    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 (toolkit_views) {
    197     sources += rebase_path(gypi_values.chrome_browser_ui_views_sources,
    198                            ".", "//chrome")
    199     if (!is_chromeos) {
    200       sources += rebase_path(
    201           gypi_values.chrome_browser_ui_views_non_chromeos_sources,
    202           ".", "//chrome")
    203     }
    204     if (!is_mac) {
    205       sources += rebase_path(
    206           gypi_values.chrome_browser_ui_views_non_mac_sources,
    207           ".", "//chrome")
    208     }
    209     if (use_ash) {
    210       sources += rebase_path(gypi_values.chrome_browser_ui_ash_views_sources,
    211                              ".", "//chrome")
    212       }
    213   }
    214   if (use_aura && !use_ozone && is_desktop_linux) {
    215     deps += [
    216       "//build/config/linux:gio",
    217       # gtk2 is the only component that can interact with gtk2 in our new
    218       # world.
    219       "//chrome/browser/ui/libgtk2ui",
    220     ]
    221   }
    222   if (is_win || is_mac || is_desktop_linux) {
    223     sources += rebase_path(gypi_values.chrome_browser_ui_desktop_sources,
    224                            ".", "//chrome")
    225   }
    226   if (use_aura) {
    227     sources += rebase_path(gypi_values.chrome_browser_ui_aura_sources,
    228                            ".", "//chrome")
    229     deps += [
    230       # aura uses some of ash resources.
    231       "//ash/resources",
    232       "//ui/aura",
    233       "//ui/keyboard",
    234       "//ui/keyboard:resources",
    235       "//ui/wm",
    236     ]
    237     if (!is_chromeos) {
    238       sources += rebase_path(gypi_values.chrome_browser_ui_aura_non_chromeos,
    239                              ".", "//chrome")
    240     }
    241   }
    242   if (ui_compositor_image_transport) {
    243     deps += [ "//ui/gl" ]
    244   }
    245   if (use_nss_certs) {
    246     sources += rebase_path(gypi_values.chrome_browser_ui_nss_sources,
    247                            ".", "//chrome")
    248   }
    249   if (!enable_themes) {
    250     sources -= [ "webui/theme_source.cc" ]
    251   }
    252   if (printing_mode == 1) {
    253     sources += rebase_path(gypi_values.chrome_browser_ui_print_preview_sources,
    254                            ".", "//chrome")
    255   }
    256   if (is_linux || is_android) {
    257     sources += rebase_path(gypi_values.chrome_browser_ui_android_linux_sources,
    258                            ".", "//chrome")
    259   }
    260 
    261   if (is_android) {
    262     deps += [
    263       "//chrome/browser:jni_headers",
    264       "//crypto:platform",
    265       #'../components/components.gyp:web_contents_delegate_android',  TODO(GYP)
    266     ]
    267     deps -= [
    268       "//chrome/browser/ui/views",
    269       "//components/feedback/proto",
    270       "//third_party/libusb",
    271       "//ui/events",
    272     ]
    273     sources += rebase_path(gypi_values.chrome_browser_ui_android_sources,
    274                            ".", "//chrome")
    275 
    276     defines += [ "CHROME_BUILD_ID=" + android_chrome_build_id ]
    277   } else {  # Non-Android.
    278     sources += rebase_path(gypi_values.chrome_browser_ui_non_android_sources,
    279                            ".", "//chrome")
    280   }
    281 
    282   if (is_mac) {
    283     sources += rebase_path(gypi_values.chrome_browser_ui_mac_sources,
    284                            ".", "//chrome")
    285     sources -= [
    286       # Mac has its own way of drawing tabs.
    287       "tabs/tab_resources.cc",
    288       "tabs/tab_resources.h",
    289     ]
    290     deps += [
    291       "//third_party/google_toolbox_for_mac",
    292       ":generate_localizer",
    293       #'../third_party/apple_sample_code/apple_sample_code.gyp:apple_sample_code',  TODO(GYP)
    294       #'../third_party/molokocacao/molokocacao.gyp:molokocacao',  TODO(GYP)
    295       #'../third_party/mozilla/mozilla.gyp:mozilla',  TODO(GYP)
    296     ]
    297     include_dirs = [ "$target_gen_dir" ]
    298     libs += [ "Quartz.framework" ]
    299     configs += [
    300       "//third_party/google_toolbox_for_mac:google_toolbox_for_mac_config",
    301     ]
    302   } else {  # non-Mac.
    303     sources += rebase_path(gypi_values.chrome_browser_ui_non_mac_sources,
    304                            ".", "//chrome")
    305   }
    306 
    307   if (is_win) {
    308     sources += rebase_path(gypi_values.chrome_browser_ui_win_sources,
    309                            ".", "//chrome")
    310     public_deps += [
    311       "//ui/views",
    312       "//ui/views/controls/webview",
    313     ]
    314     deps += [
    315       "//chrome/installer/util:strings",
    316       "//third_party/wtl",
    317       "//third_party/iaccessible2",
    318       "//third_party/isimpledom",
    319       "//ui/app_list",
    320       #'metro_utils',  TODO(GYP)
    321       #'../google_update/google_update.gyp:google_update',  TODO(GYP)
    322     ]
    323   } else {  # 'OS!="win"
    324     if (toolkit_views) {
    325       public_deps += [
    326         "//ui/views",
    327         "//ui/views/controls/webview",
    328       ]
    329     }
    330   }
    331   if (is_desktop_linux) {
    332     sources += rebase_path(gypi_values.chrome_browser_ui_desktop_linux_sources,
    333                            ".", "//chrome")
    334   }
    335   if (is_linux) {  # Both desktop Linux and ChromeOS.
    336     sources += rebase_path(gypi_values.chrome_browser_ui_linux_sources,
    337                            ".", "//chrome")
    338     configs += [ "//build/config/linux:udev" ]
    339     if (use_aura) {
    340       configs += [ "//build/config/linux:fontconfig" ]
    341       deps += [ "//dbus" ]
    342     }
    343     if (use_x11) {
    344       sources += rebase_path(gypi_values.chrome_browser_ui_x11_sources,
    345                              ".", "//chrome")
    346       configs += [ "//build/config/linux:x11" ]
    347     }
    348   }
    349 
    350   if (enable_app_list) {
    351     sources += rebase_path(gypi_values.chrome_browser_ui_app_list_sources,
    352                            ".", "//chrome")
    353     deps += [ "//ui/app_list" ]
    354   } else {
    355     sources += rebase_path(gypi_values.chrome_browser_ui_non_app_list_sources,
    356                            ".", "//chrome")
    357   }
    358   if (enable_autofill_dialog) {
    359     sources += rebase_path(
    360         gypi_values.chrome_browser_ui_autofill_dialog_sources,
    361         ".", "//chrome")
    362     if (!is_android && !is_ios) {
    363       sources += rebase_path(
    364           gypi_values.chrome_browser_ui_autofill_dialog_non_mobile_sources,
    365           ".", "//chrome")
    366       deps += [
    367         "//third_party/libaddressinput",
    368         "//third_party/libaddressinput:strings",
    369       ]
    370     }
    371   }
    372   if (enable_extensions) {
    373     deps += [
    374       "//chrome/browser/extensions",
    375       "//chrome/common/extensions/api",
    376       "//chrome/common/extensions/api:api_registration",
    377     ]
    378     sources += rebase_path(gypi_values.chrome_browser_ui_extensions_sources,
    379                            ".", "//chrome")
    380   }
    381   if (enable_google_now && !is_android) {
    382     sources += rebase_path(
    383         gypi_values.chrome_browser_ui_google_now_non_android_sources,
    384         ".", "//chrome")
    385   }
    386   if (enable_webrtc) {
    387     sources += rebase_path(gypi_values.chrome_browser_ui_webrtc_sources,
    388                            ".", "//chrome")
    389   }
    390   if (enable_service_discovery) {
    391     sources += rebase_path(
    392         gypi_values.chrome_browser_ui_service_discovery_sources,
    393         ".", "//chrome")
    394   }
    395   if (enable_spellcheck) {
    396     deps += [ "//third_party/hunspell" ]
    397   }
    398 }
    399 
    400 if (is_mac) {
    401   nib_gypi_values = exec_script(
    402       "//build/gypi_to_gn.py",
    403       [ rebase_path("../../chrome_nibs.gypi") ],
    404       "scope",
    405       [ "../../chrome_nibs.gypi" ])
    406 
    407   action("generate_localizer") {
    408     script = "//chrome/tools/build/mac/generate_localizer"
    409     sources = [ ]
    410     table_path = "$target_gen_dir/ui_localizer_table.h"
    411     outputs = [ table_path ]
    412     args = [ rebase_path(table_path, root_build_dir) ] +
    413              rebase_path(nib_gypi_values.mac_translated_xibs,
    414                          root_build_dir,
    415                          "//chrome")
    416   }
    417 }
    418 
    419 # In GYP this is part of test_support_common.
    420 source_set("test_support") {
    421   testonly = true
    422 
    423   sources = [
    424     "browser.h",
    425     "cocoa/find_bar/find_bar_host_unittest_util_cocoa.mm",
    426     "cocoa/run_loop_testing.h",
    427     "cocoa/run_loop_testing.mm",
    428     "find_bar/find_bar_host_unittest_util.h",
    429     "fullscreen/fullscreen_controller_state_test.cc",
    430     "fullscreen/fullscreen_controller_state_test.h",
    431     "fullscreen/fullscreen_controller_state_tests.h",
    432     "fullscreen/fullscreen_controller_test.cc",
    433     "fullscreen/fullscreen_controller_test.h",
    434     "login/login_prompt_test_utils.cc",
    435     "login/login_prompt_test_utils.h",
    436     "passwords/manage_passwords_ui_controller_mock.cc",
    437     "passwords/manage_passwords_ui_controller_mock.h",
    438     "pdf/pdf_browsertest_base.cc",
    439     "pdf/pdf_browsertest_base.h",
    440     "test/test_confirm_bubble_model.cc",
    441     "test/test_confirm_bubble_model.h",
    442     "views/find_bar_host_unittest_util_views.cc",
    443     "website_settings/mock_permission_bubble_request.cc",
    444     "website_settings/mock_permission_bubble_request.h",
    445   ]
    446 
    447   public_deps = [
    448     ":ui",
    449   ]
    450   deps = [
    451     "//chrome/app/theme:theme_resources",
    452     "//chrome/browser",
    453     "//content/public/browser",
    454     "//content/public/common",
    455     "//content/test:test_support",
    456     "//net:test_support",
    457     "//skia",
    458     "//testing/gtest",
    459     "//ui/base",
    460   ]
    461 }
    462