OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/system/web_notification/web_notification_tray.h" | 5 #include "ash/system/web_notification/web_notification_tray.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
10 #include "ash/system/status_area_widget.h" | 10 #include "ash/system/status_area_widget.h" |
11 #include "ash/system/tray/system_tray_item.h" | 11 #include "ash/system/tray/system_tray_item.h" |
12 #include "ash/test/ash_test_base.h" | 12 #include "ash/test/ash_test_base.h" |
13 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "ui/message_center/message_center_bubble.h" | 15 #include "ui/message_center/message_center_bubble.h" |
16 #include "ui/message_center/message_center_tray.h" | 16 #include "ui/message_center/message_center_tray.h" |
17 #include "ui/message_center/message_popup_bubble.h" | 17 #include "ui/message_center/message_popup_bubble.h" |
18 #include "ui/message_center/notification_list.h" | 18 #include "ui/message_center/notification_list.h" |
19 #include "ui/notifications/notification_types.h" | 19 #include "ui/message_center/notification_types.h" |
20 #include "ui/views/controls/label.h" | 20 #include "ui/views/controls/label.h" |
21 #include "ui/views/layout/fill_layout.h" | 21 #include "ui/views/layout/fill_layout.h" |
22 #include "ui/views/view.h" | 22 #include "ui/views/view.h" |
23 #include "ui/views/widget/widget.h" | 23 #include "ui/views/widget/widget.h" |
24 | 24 |
25 #if defined(OS_WIN) | 25 #if defined(OS_WIN) |
26 #include "base/win/windows_version.h" | 26 #include "base/win/windows_version.h" |
27 #endif | 27 #endif |
28 | 28 |
29 namespace ash { | 29 namespace ash { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 virtual void ShowSettingsDialog(gfx::NativeView context) OVERRIDE { | 68 virtual void ShowSettingsDialog(gfx::NativeView context) OVERRIDE { |
69 } | 69 } |
70 | 70 |
71 virtual void OnClicked(const std::string& notifcation_id) OVERRIDE { | 71 virtual void OnClicked(const std::string& notifcation_id) OVERRIDE { |
72 } | 72 } |
73 | 73 |
74 void AddNotification(WebNotificationTray* tray, const std::string& id) { | 74 void AddNotification(WebNotificationTray* tray, const std::string& id) { |
75 notification_ids_.insert(id); | 75 notification_ids_.insert(id); |
76 get_message_center()->AddNotification( | 76 get_message_center()->AddNotification( |
77 ui::notifications::NOTIFICATION_TYPE_SIMPLE, | 77 message_center::NOTIFICATION_TYPE_SIMPLE, |
78 id, | 78 id, |
79 ASCIIToUTF16("Test Web Notification"), | 79 ASCIIToUTF16("Test Web Notification"), |
80 ASCIIToUTF16("Notification message body."), | 80 ASCIIToUTF16("Notification message body."), |
81 ASCIIToUTF16("www.test.org"), | 81 ASCIIToUTF16("www.test.org"), |
82 "" /* extension id */, | 82 "" /* extension id */, |
83 NULL /* optional_fields */); | 83 NULL /* optional_fields */); |
84 } | 84 } |
85 | 85 |
86 void UpdateNotification(WebNotificationTray* tray, | 86 void UpdateNotification(WebNotificationTray* tray, |
87 const std::string& old_id, | 87 const std::string& old_id, |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 EXPECT_TRUE(tray->IsPopupVisible()); | 218 EXPECT_TRUE(tray->IsPopupVisible()); |
219 EXPECT_EQ(notifications_to_add, | 219 EXPECT_EQ(notifications_to_add, |
220 get_message_center()->NotificationCount()); | 220 get_message_center()->NotificationCount()); |
221 EXPECT_EQ(NotificationList::kMaxVisiblePopupNotifications, | 221 EXPECT_EQ(NotificationList::kMaxVisiblePopupNotifications, |
222 tray->GetPopupBubbleForTest()->NumMessageViewsForTest()); | 222 tray->GetPopupBubbleForTest()->NumMessageViewsForTest()); |
223 get_message_center()->SetDelegate(NULL); | 223 get_message_center()->SetDelegate(NULL); |
224 get_message_center()->notification_list()->RemoveAllNotifications(); | 224 get_message_center()->notification_list()->RemoveAllNotifications(); |
225 } | 225 } |
226 | 226 |
227 } // namespace ash | 227 } // namespace ash |
OLD | NEW |