| 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 <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // Continues all managed timers. | 46 // Continues all managed timers. |
| 47 void StartAll(); | 47 void StartAll(); |
| 48 | 48 |
| 49 // Removes all managed timers. | 49 // Removes all managed timers. |
| 50 void CancelAll(); | 50 void CancelAll(); |
| 51 | 51 |
| 52 // Starts a timer (by creating a PopupTimer) for |id|. | 52 // Starts a timer (by creating a PopupTimer) for |id|. |
| 53 void StartTimer(const std::string& id, | 53 void StartTimer(const std::string& id, |
| 54 const base::TimeDelta& timeout_in_seconds); | 54 const base::TimeDelta& timeout_in_seconds); |
| 55 | 55 |
| 56 // Stops a single timer, reverts it to a new timeout, and restarts it. | |
| 57 void ResetTimer(const std::string& id, | |
| 58 const base::TimeDelta& timeout_in_seconds); | |
| 59 | |
| 60 // Pauses a single timer, such that it will continue where it left off after a | |
| 61 // call to StartAll or StartTimer. | |
| 62 void PauseTimer(const std::string& id); | |
| 63 | |
| 64 // Removes and cancels a single popup timer, if it exists. | 56 // Removes and cancels a single popup timer, if it exists. |
| 65 void CancelTimer(const std::string& id); | 57 void CancelTimer(const std::string& id); |
| 66 | 58 |
| 67 private: | 59 private: |
| 68 // Weak, global. | 60 // Weak, global. |
| 69 MessageCenter* message_center_; | 61 MessageCenter* message_center_; |
| 70 | 62 |
| 71 // The PopupTimerCollection contains all the managed timers by their ID. | 63 // The PopupTimerCollection contains all the managed timers by their ID. |
| 72 using PopupTimerCollection = | 64 using PopupTimerCollection = |
| 73 std::map<std::string, std::unique_ptr<PopupTimer>>; | 65 std::map<std::string, std::unique_ptr<PopupTimer>>; |
| 74 PopupTimerCollection popup_timers_; | 66 PopupTimerCollection popup_timers_; |
| 75 | 67 |
| 76 DISALLOW_COPY_AND_ASSIGN(PopupTimersController); | 68 DISALLOW_COPY_AND_ASSIGN(PopupTimersController); |
| 77 }; | 69 }; |
| 78 | 70 |
| 79 } // namespace message_center | 71 } // namespace message_center |
| 80 | 72 |
| 81 #endif // UI_MESSAGE_CENTER_POPUP_TIMERS_CONTROLLER_H_ | 73 #endif // UI_MESSAGE_CENTER_POPUP_TIMERS_CONTROLLER_H_ |
| OLD | NEW |