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