OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 "ui/message_center/popup_timer.h" | 5 #include "ui/message_center/popup_timer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ui/message_center/message_center_style.h" | 9 #include "ui/message_center/message_center_style.h" |
10 #include "ui/message_center/message_center_types.h" | 10 #include "ui/message_center/message_center_types.h" |
11 #include "ui/message_center/notification.h" | 11 #include "ui/message_center/notification.h" |
12 #include "ui/message_center/notification_list.h" | 12 #include "ui/message_center/notification_list.h" |
13 | 13 |
14 namespace message_center { | 14 namespace message_center { |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 base::TimeDelta GetTimeoutForNotification(Notification* notification) { | 18 base::TimeDelta GetTimeoutForNotification(Notification* notification) { |
19 if (notification->priority() > message_center::DEFAULT_PRIORITY) | 19 if (notification->priority() > DEFAULT_PRIORITY) |
20 return base::TimeDelta::FromSeconds(kAutocloseHighPriorityDelaySeconds); | 20 return base::TimeDelta::FromSeconds(kAutocloseHighPriorityDelaySeconds); |
21 if (notification->is_web_notification()) | 21 if (notification->notifier_id().type == NotifierId::WEB_PAGE) |
22 return base::TimeDelta::FromSeconds(kAutocloseWebNotificationDelaySeconds); | 22 return base::TimeDelta::FromSeconds(kAutocloseWebPageDelaySeconds); |
23 return base::TimeDelta::FromSeconds(kAutocloseDefaultDelaySeconds); | 23 return base::TimeDelta::FromSeconds(kAutocloseDefaultDelaySeconds); |
24 } | 24 } |
25 | 25 |
26 } // namespace | 26 } // namespace |
27 | 27 |
28 //////////////////////////////////////////////////////////////////////////////// | 28 //////////////////////////////////////////////////////////////////////////////// |
29 // PopupTimer | 29 // PopupTimer |
30 | 30 |
31 PopupTimer::PopupTimer(const std::string& id, | 31 PopupTimer::PopupTimer(const std::string& id, |
32 base::TimeDelta timeout, | 32 base::TimeDelta timeout, |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 if (popup_timers_.find(id) == popup_timers_.end()) | 166 if (popup_timers_.find(id) == popup_timers_.end()) |
167 StartTimer(id, GetTimeoutForNotification(*iter)); | 167 StartTimer(id, GetTimeoutForNotification(*iter)); |
168 } | 168 } |
169 | 169 |
170 void PopupTimersController::OnNotificationRemoved(const std::string& id, | 170 void PopupTimersController::OnNotificationRemoved(const std::string& id, |
171 bool by_user) { | 171 bool by_user) { |
172 CancelTimer(id); | 172 CancelTimer(id); |
173 } | 173 } |
174 | 174 |
175 } // namespace message_center | 175 } // namespace message_center |
OLD | NEW |