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" |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 //////////////////////////////////////////////////////////////////////////////// | 29 //////////////////////////////////////////////////////////////////////////////// |
30 // PopupTimer | 30 // PopupTimer |
31 | 31 |
32 PopupTimer::PopupTimer(const std::string& id, | 32 PopupTimer::PopupTimer(const std::string& id, |
33 base::TimeDelta timeout, | 33 base::TimeDelta timeout, |
34 base::WeakPtr<PopupTimersController> controller) | 34 base::WeakPtr<PopupTimersController> controller) |
35 : id_(id), | 35 : id_(id), |
36 timeout_(timeout), | 36 timeout_(timeout), |
37 timer_controller_(controller), | 37 timer_controller_(controller), |
38 timer_(new base::OneShotTimer<PopupTimersController>) {} | 38 timer_(new base::OneShotTimer) {} |
39 | 39 |
40 PopupTimer::~PopupTimer() { | 40 PopupTimer::~PopupTimer() { |
41 if (!timer_) | 41 if (!timer_) |
42 return; | 42 return; |
43 | 43 |
44 if (timer_->IsRunning()) | 44 if (timer_->IsRunning()) |
45 timer_->Stop(); | 45 timer_->Stop(); |
46 } | 46 } |
47 | 47 |
48 void PopupTimer::Start() { | 48 void PopupTimer::Start() { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 if (popup_timers_.find(id) == popup_timers_.end()) | 167 if (popup_timers_.find(id) == popup_timers_.end()) |
168 StartTimer(id, GetTimeoutForPriority((*iter)->priority())); | 168 StartTimer(id, GetTimeoutForPriority((*iter)->priority())); |
169 } | 169 } |
170 | 170 |
171 void PopupTimersController::OnNotificationRemoved(const std::string& id, | 171 void PopupTimersController::OnNotificationRemoved(const std::string& id, |
172 bool by_user) { | 172 bool by_user) { |
173 CancelTimer(id); | 173 CancelTimer(id); |
174 } | 174 } |
175 | 175 |
176 } // namespace message_center | 176 } // namespace message_center |
OLD | NEW |