| 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 <utility> |
| 7 #include <vector> | 8 #include <vector> |
| 8 | 9 |
| 9 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
| 10 #include "ash/root_window_controller.h" | 11 #include "ash/root_window_controller.h" |
| 11 #include "ash/shelf/shelf_layout_manager.h" | 12 #include "ash/shelf/shelf_layout_manager.h" |
| 12 #include "ash/shelf/shelf_widget.h" | 13 #include "ash/shelf/shelf_widget.h" |
| 13 #include "ash/shell.h" | 14 #include "ash/shell.h" |
| 14 #include "ash/system/status_area_widget.h" | 15 #include "ash/system/status_area_widget.h" |
| 15 #include "ash/system/tray/system_tray.h" | 16 #include "ash/system/tray/system_tray.h" |
| 16 #include "ash/system/tray/system_tray_item.h" | 17 #include "ash/system/tray/system_tray_item.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 protected: | 101 protected: |
| 101 void AddNotification(const std::string& id) { | 102 void AddNotification(const std::string& id) { |
| 102 scoped_ptr<message_center::Notification> notification; | 103 scoped_ptr<message_center::Notification> notification; |
| 103 notification.reset(new message_center::Notification( | 104 notification.reset(new message_center::Notification( |
| 104 message_center::NOTIFICATION_TYPE_SIMPLE, id, | 105 message_center::NOTIFICATION_TYPE_SIMPLE, id, |
| 105 base::ASCIIToUTF16("Test Web Notification"), | 106 base::ASCIIToUTF16("Test Web Notification"), |
| 106 base::ASCIIToUTF16("Notification message body."), gfx::Image(), | 107 base::ASCIIToUTF16("Notification message body."), gfx::Image(), |
| 107 base::ASCIIToUTF16("www.test.org"), GURL(), | 108 base::ASCIIToUTF16("www.test.org"), GURL(), |
| 108 message_center::NotifierId(), message_center::RichNotificationData(), | 109 message_center::NotifierId(), message_center::RichNotificationData(), |
| 109 NULL /* delegate */)); | 110 NULL /* delegate */)); |
| 110 GetMessageCenter()->AddNotification(notification.Pass()); | 111 GetMessageCenter()->AddNotification(std::move(notification)); |
| 111 } | 112 } |
| 112 | 113 |
| 113 void UpdateNotification(const std::string& old_id, | 114 void UpdateNotification(const std::string& old_id, |
| 114 const std::string& new_id) { | 115 const std::string& new_id) { |
| 115 scoped_ptr<message_center::Notification> notification; | 116 scoped_ptr<message_center::Notification> notification; |
| 116 notification.reset(new message_center::Notification( | 117 notification.reset(new message_center::Notification( |
| 117 message_center::NOTIFICATION_TYPE_SIMPLE, new_id, | 118 message_center::NOTIFICATION_TYPE_SIMPLE, new_id, |
| 118 base::ASCIIToUTF16("Updated Web Notification"), | 119 base::ASCIIToUTF16("Updated Web Notification"), |
| 119 base::ASCIIToUTF16("Updated message body."), gfx::Image(), | 120 base::ASCIIToUTF16("Updated message body."), gfx::Image(), |
| 120 base::ASCIIToUTF16("www.test.org"), GURL(), | 121 base::ASCIIToUTF16("www.test.org"), GURL(), |
| 121 message_center::NotifierId(), message_center::RichNotificationData(), | 122 message_center::NotifierId(), message_center::RichNotificationData(), |
| 122 NULL /* delegate */)); | 123 NULL /* delegate */)); |
| 123 GetMessageCenter()->UpdateNotification(old_id, notification.Pass()); | 124 GetMessageCenter()->UpdateNotification(old_id, std::move(notification)); |
| 124 } | 125 } |
| 125 | 126 |
| 126 void RemoveNotification(const std::string& id) { | 127 void RemoveNotification(const std::string& id) { |
| 127 GetMessageCenter()->RemoveNotification(id, false); | 128 GetMessageCenter()->RemoveNotification(id, false); |
| 128 } | 129 } |
| 129 | 130 |
| 130 views::Widget* GetWidget() { | 131 views::Widget* GetWidget() { |
| 131 return GetTray()->GetWidget(); | 132 return GetTray()->GetWidget(); |
| 132 } | 133 } |
| 133 | 134 |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, out_of_bounds, touch_id, | 522 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, out_of_bounds, touch_id, |
| 522 move.time_stamp()+base::TimeDelta::FromMilliseconds(50)); | 523 move.time_stamp()+base::TimeDelta::FromMilliseconds(50)); |
| 523 generator.Dispatch(&release); | 524 generator.Dispatch(&release); |
| 524 EXPECT_FALSE(tray->draw_background_as_active()); | 525 EXPECT_FALSE(tray->draw_background_as_active()); |
| 525 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible()); | 526 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible()); |
| 526 } | 527 } |
| 527 | 528 |
| 528 #endif // OS_CHROMEOS | 529 #endif // OS_CHROMEOS |
| 529 | 530 |
| 530 } // namespace ash | 531 } // namespace ash |
| OLD | NEW |