Home | History | Annotate | Download | only in message_center
      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/features.gni")
      6 import("//build/config/ui.gni")
      7 
      8 component("message_center") {
      9   deps = [
     10     "//base",
     11     "//base:i18n",
     12     "//base/third_party/dynamic_annotations",
     13     "//skia",
     14     "//ui/accessibility",
     15     "//ui/base",
     16     "//ui/events",
     17     "//ui/gfx",
     18     "//ui/gfx/geometry",
     19     "//ui/native_theme",
     20     "//ui/resources",
     21     "//ui/strings",
     22     "//url",
     23   ]
     24 
     25   defines = [ "MESSAGE_CENTER_IMPLEMENTATION" ]
     26 
     27   if (enable_notifications) {
     28     sources = [
     29       "cocoa/notification_controller.h",
     30       "cocoa/notification_controller.mm",
     31       "cocoa/opaque_views.h",
     32       "cocoa/opaque_views.mm",
     33       "cocoa/popup_collection.h",
     34       "cocoa/popup_collection.mm",
     35       "cocoa/popup_controller.h",
     36       "cocoa/popup_controller.mm",
     37       "cocoa/settings_controller.h",
     38       "cocoa/settings_controller.mm",
     39       "cocoa/settings_entry_view.h",
     40       "cocoa/settings_entry_view.mm",
     41       "cocoa/status_item_view.h",
     42       "cocoa/status_item_view.mm",
     43       "cocoa/tray_controller.h",
     44       "cocoa/tray_controller.mm",
     45       "cocoa/tray_view_controller.h",
     46       "cocoa/tray_view_controller.mm",
     47       "message_center.cc",
     48       "message_center.h",
     49       "message_center_export.h",
     50       "notification_delegate.cc",
     51       "notification_delegate.h",
     52       "message_center_impl.cc",
     53       "message_center_impl.h",
     54       "message_center_observer.h",
     55       "message_center_style.cc",
     56       "message_center_style.h",
     57       "message_center_tray.cc",
     58       "message_center_tray.h",
     59       "message_center_tray_delegate.h",
     60       "message_center_types.h",
     61       "message_center_switches.h",
     62       "message_center_switches.cc",
     63       "notification.cc",
     64       "notification.h",
     65       "notification_blocker.cc",
     66       "notification_blocker.h",
     67       "notification_list.cc",
     68       "notification_list.h",
     69       "notification_types.cc",
     70       "notification_types.h",
     71       "notifier_settings.cc",
     72       "notifier_settings.h",
     73     ]
     74 
     75     if (is_win) {
     76       # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
     77       cflags = [ "/wd4267" ]
     78       deps += [ "//ui/aura" ]
     79     }
     80 
     81     # On Mac, toolkit-views builds still use the Cocoa UI. Keep this in sync
     82     # with message_center_unittests below.
     83     if (toolkit_views && !is_mac) {
     84       sources += [
     85         "views/bounded_label.cc",
     86         "views/bounded_label.h",
     87         "views/constants.h",
     88         "views/desktop_popup_alignment_delegate.cc",
     89         "views/desktop_popup_alignment_delegate.h",
     90         "views/message_center_controller.h",
     91         "views/message_center_button_bar.cc",
     92         "views/message_center_button_bar.h",
     93         "views/message_center_view.cc",
     94         "views/message_center_view.h",
     95         "views/message_popup_collection.cc",
     96         "views/message_popup_collection.h",
     97         "views/message_view.cc",
     98         "views/message_view.h",
     99         "views/message_view_context_menu_controller.cc",
    100         "views/message_view_context_menu_controller.h",
    101         "views/notifier_settings_view.cc",
    102         "views/notifier_settings_view.h",
    103         "views/notification_button.cc",
    104         "views/notification_button.h",
    105         "views/notification_view.cc",
    106         "views/notification_view.h",
    107         "views/padded_button.cc",
    108         "views/padded_button.h",
    109         "views/popup_alignment_delegate.cc",
    110         "views/popup_alignment_delegate.h",
    111         "views/proportional_image_view.cc",
    112         "views/proportional_image_view.h",
    113         "views/toast_contents_view.cc",
    114         "views/toast_contents_view.h",
    115       ]
    116       deps += [
    117         "//ui/events",
    118         "//ui/views",
    119         "//ui/compositor",
    120       ]
    121     }
    122 
    123     if (use_ash) {
    124       sources += [
    125         "views/message_bubble_base.cc",
    126         "views/message_bubble_base.h",
    127         "views/message_center_bubble.cc",
    128         "views/message_center_bubble.h",
    129       ]
    130     }
    131 
    132   } else {
    133     # Notification service disabled.
    134     sources = [
    135       "dummy_message_center.cc",
    136       "notification_delegate.cc",
    137       "notification_delegate.h",
    138     ]
    139     # Android implements its own notification UI manager instead of deferring to
    140     # the message center (when notifications are enabled). Include a minimal
    141     # set of files required for notifications on Android.
    142     if (is_android) {
    143       sources += [
    144         "notification.cc",
    145         "notification.h",
    146         "notifier_settings.cc",
    147         "notifier_settings.h",
    148       ]
    149     }
    150   }
    151 }
    152 
    153 static_library("test_support") {
    154   testonly = true
    155   sources = [
    156     "fake_message_center.h",
    157     "fake_message_center.cc",
    158     "fake_message_center_tray_delegate.h",
    159     "fake_message_center_tray_delegate.cc",
    160     "fake_notifier_settings_provider.h",
    161     "fake_notifier_settings_provider.cc",
    162   ]
    163 
    164   public_deps = [
    165     ":message_center",
    166   ]
    167 
    168   deps = [
    169     "//base",
    170     "//base/test:test_support",
    171     "//skia",
    172     "//ui/gfx",
    173     "//ui/gfx/geometry",
    174   ]
    175 }
    176 
    177 test("message_center_unittests") {
    178   sources = [
    179     "test/run_all_unittests.cc",
    180   ]
    181 
    182   deps = [
    183     ":message_center",
    184     ":test_support",
    185     "//base",
    186     "//base/allocator",
    187     "//base/test:test_support",
    188     "//skia",
    189     "//testing/gtest",
    190     "//ui/base",
    191     "//ui/events",
    192     "//ui/gfx",
    193     "//ui/gfx/geometry",
    194     "//ui/gl",
    195     "//ui/resources",
    196     "//ui/resources:ui_test_pak",
    197     "//url",
    198   ]
    199 
    200   if (enable_notifications) {
    201     sources += [
    202       "cocoa/notification_controller_unittest.mm",
    203       "cocoa/popup_collection_unittest.mm",
    204       "cocoa/popup_controller_unittest.mm",
    205       "cocoa/settings_controller_unittest.mm",
    206       "cocoa/status_item_view_unittest.mm",
    207       "cocoa/tray_controller_unittest.mm",
    208       "cocoa/tray_view_controller_unittest.mm",
    209       "message_center_tray_unittest.cc",
    210       "message_center_impl_unittest.cc",
    211       "notification_delegate_unittest.cc",
    212       "notification_list_unittest.cc",
    213     ]
    214 
    215     if (is_mac) {
    216       deps += [ "//ui/gfx:test_support" ]
    217     }
    218 
    219     if (toolkit_views && !is_mac) {
    220       sources += [
    221         "views/bounded_label_unittest.cc",
    222         "views/message_center_view_unittest.cc",
    223         "views/message_popup_collection_unittest.cc",
    224         "views/notification_view_unittest.cc",
    225         "views/notifier_settings_view_unittest.cc",
    226       ]
    227       deps += [
    228         # Compositor is needed by message_center_view_unittest.cc and for the
    229         # fonts used by bounded_label_unittest.cc.
    230         "//ui/compositor",
    231         "//ui/views",
    232         "//ui/views:test_support",
    233       ]
    234     }
    235   }  # enable_notifications
    236 }
    237