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 #ifndef UI_MESSAGE_CENTER_POPUP_TIMERS_CONTROLLER_H_ | 5 #ifndef UI_MESSAGE_CENTER_POPUP_TIMERS_CONTROLLER_H_ |
6 #define UI_MESSAGE_CENTER_POPUP_TIMERS_CONTROLLER_H_ | 6 #define UI_MESSAGE_CENTER_POPUP_TIMERS_CONTROLLER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
| 9 #include <memory> |
9 #include <string> | 10 #include <string> |
10 | 11 |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "ui/message_center/message_center.h" | 14 #include "ui/message_center/message_center.h" |
15 #include "ui/message_center/message_center_observer.h" | 15 #include "ui/message_center/message_center_observer.h" |
16 #include "ui/message_center/popup_timer.h" | 16 #include "ui/message_center/popup_timer.h" |
17 | 17 |
18 namespace message_center { | 18 namespace message_center { |
19 | 19 |
20 // A class that manages all the timers running for individual notification popup | 20 // A class that manages all the timers running for individual notification popup |
21 // windows. It supports weak pointers in order to allow safe callbacks when | 21 // windows. It supports weak pointers in order to allow safe callbacks when |
22 // timers expire. | 22 // timers expire. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 void PauseTimer(const std::string& id); | 62 void PauseTimer(const std::string& id); |
63 | 63 |
64 // Removes and cancels a single popup timer, if it exists. | 64 // Removes and cancels a single popup timer, if it exists. |
65 void CancelTimer(const std::string& id); | 65 void CancelTimer(const std::string& id); |
66 | 66 |
67 private: | 67 private: |
68 // Weak, global. | 68 // Weak, global. |
69 MessageCenter* message_center_; | 69 MessageCenter* message_center_; |
70 | 70 |
71 // The PopupTimerCollection contains all the managed timers by their ID. | 71 // The PopupTimerCollection contains all the managed timers by their ID. |
72 using PopupTimerCollection = std::map<std::string, scoped_ptr<PopupTimer>>; | 72 using PopupTimerCollection = |
| 73 std::map<std::string, std::unique_ptr<PopupTimer>>; |
73 PopupTimerCollection popup_timers_; | 74 PopupTimerCollection popup_timers_; |
74 | 75 |
75 DISALLOW_COPY_AND_ASSIGN(PopupTimersController); | 76 DISALLOW_COPY_AND_ASSIGN(PopupTimersController); |
76 }; | 77 }; |
77 | 78 |
78 } // namespace message_center | 79 } // namespace message_center |
79 | 80 |
80 #endif // UI_MESSAGE_CENTER_POPUP_TIMERS_CONTROLLER_H_ | 81 #endif // UI_MESSAGE_CENTER_POPUP_TIMERS_CONTROLLER_H_ |
OLD | NEW |