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