| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_timers_controller.h" | 5 #include "ui/message_center/popup_timers_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "ui/message_center/message_center_style.h" | 10 #include "ui/message_center/message_center_style.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 void PopupTimersController::StartTimer(const std::string& id, | 35 void PopupTimersController::StartTimer(const std::string& id, |
| 36 const base::TimeDelta& timeout) { | 36 const base::TimeDelta& timeout) { |
| 37 PopupTimerCollection::const_iterator iter = popup_timers_.find(id); | 37 PopupTimerCollection::const_iterator iter = popup_timers_.find(id); |
| 38 if (iter != popup_timers_.end()) { | 38 if (iter != popup_timers_.end()) { |
| 39 DCHECK(iter->second); | 39 DCHECK(iter->second); |
| 40 iter->second->Start(); | 40 iter->second->Start(); |
| 41 return; | 41 return; |
| 42 } | 42 } |
| 43 | 43 |
| 44 scoped_ptr<PopupTimer> timer(new PopupTimer(id, timeout, AsWeakPtr())); | 44 std::unique_ptr<PopupTimer> timer(new PopupTimer(id, timeout, AsWeakPtr())); |
| 45 | 45 |
| 46 timer->Start(); | 46 timer->Start(); |
| 47 popup_timers_.insert(std::make_pair(id, std::move(timer))); | 47 popup_timers_.insert(std::make_pair(id, std::move(timer))); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void PopupTimersController::StartAll() { | 50 void PopupTimersController::StartAll() { |
| 51 for (const auto& iter : popup_timers_) | 51 for (const auto& iter : popup_timers_) |
| 52 iter.second->Start(); | 52 iter.second->Start(); |
| 53 } | 53 } |
| 54 | 54 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 if (popup_timers_.find(id) == popup_timers_.end()) | 117 if (popup_timers_.find(id) == popup_timers_.end()) |
| 118 StartTimer(id, GetTimeoutForNotification(*iter)); | 118 StartTimer(id, GetTimeoutForNotification(*iter)); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void PopupTimersController::OnNotificationRemoved(const std::string& id, | 121 void PopupTimersController::OnNotificationRemoved(const std::string& id, |
| 122 bool by_user) { | 122 bool by_user) { |
| 123 CancelTimer(id); | 123 CancelTimer(id); |
| 124 } | 124 } |
| 125 | 125 |
| 126 } // namespace message_center | 126 } // namespace message_center |
| OLD | NEW |