OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_MESSAGE_CENTER_IMPL_H_ | 5 #ifndef UI_MESSAGE_CENTER_MESSAGE_CENTER_IMPL_H_ |
6 #define UI_MESSAGE_CENTER_MESSAGE_CENTER_IMPL_H_ | 6 #define UI_MESSAGE_CENTER_MESSAGE_CENTER_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
| 11 #include "base/containers/scoped_ptr_map.h" |
| 12 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
12 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
13 #include "base/stl_util.h" | |
14 #include "base/time/time.h" | 15 #include "base/time/time.h" |
15 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
16 #include "ui/message_center/message_center.h" | 17 #include "ui/message_center/message_center.h" |
17 #include "ui/message_center/message_center_observer.h" | 18 #include "ui/message_center/message_center_observer.h" |
18 #include "ui/message_center/message_center_types.h" | 19 #include "ui/message_center/message_center_types.h" |
19 #include "ui/message_center/notification_blocker.h" | 20 #include "ui/message_center/notification_blocker.h" |
20 #include "ui/message_center/notifier_settings.h" | 21 #include "ui/message_center/notifier_settings.h" |
21 | 22 |
22 namespace message_center { | 23 namespace message_center { |
23 class NotificationDelegate; | 24 class NotificationDelegate; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // call to StartAll or StartTimer. | 116 // call to StartAll or StartTimer. |
116 void PauseTimer(const std::string& id); | 117 void PauseTimer(const std::string& id); |
117 | 118 |
118 // Removes and cancels a single popup timer, if it exists. | 119 // Removes and cancels a single popup timer, if it exists. |
119 void CancelTimer(const std::string& id); | 120 void CancelTimer(const std::string& id); |
120 | 121 |
121 private: | 122 private: |
122 // Weak, this class is owned by MessageCenterImpl. | 123 // Weak, this class is owned by MessageCenterImpl. |
123 MessageCenter* message_center_; | 124 MessageCenter* message_center_; |
124 | 125 |
125 // The PopupTimerCollection contains all the managed timers by their ID. They | 126 // The PopupTimerCollection contains all the managed timers by their ID. |
126 // are owned by this class, and deleted by |popup_deleter_| on destructon or | 127 typedef ScopedPtrMap<std::string, scoped_ptr<PopupTimer>> |
127 // when explicitly cancelled. | 128 PopupTimerCollection; |
128 typedef std::map<std::string, PopupTimer*> PopupTimerCollection; | |
129 PopupTimerCollection popup_timers_; | 129 PopupTimerCollection popup_timers_; |
130 STLValueDeleter<PopupTimerCollection> popup_deleter_; | |
131 | 130 |
132 DISALLOW_COPY_AND_ASSIGN(PopupTimersController); | 131 DISALLOW_COPY_AND_ASSIGN(PopupTimersController); |
133 }; | 132 }; |
134 | 133 |
135 } // namespace internal | 134 } // namespace internal |
136 | 135 |
137 // The default implementation of MessageCenter. | 136 // The default implementation of MessageCenter. |
138 class MessageCenterImpl : public MessageCenter, | 137 class MessageCenterImpl : public MessageCenter, |
139 public NotificationBlocker::Observer, | 138 public NotificationBlocker::Observer, |
140 public message_center::NotifierSettingsObserver { | 139 public message_center::NotifierSettingsObserver { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 // Queue for the notifications to delay the addition/updates when the message | 223 // Queue for the notifications to delay the addition/updates when the message |
225 // center is visible. | 224 // center is visible. |
226 scoped_ptr<internal::ChangeQueue> notification_queue_; | 225 scoped_ptr<internal::ChangeQueue> notification_queue_; |
227 | 226 |
228 DISALLOW_COPY_AND_ASSIGN(MessageCenterImpl); | 227 DISALLOW_COPY_AND_ASSIGN(MessageCenterImpl); |
229 }; | 228 }; |
230 | 229 |
231 } // namespace message_center | 230 } // namespace message_center |
232 | 231 |
233 #endif // UI_MESSAGE_CENTER_MESSAGE_CENTER_H_ | 232 #endif // UI_MESSAGE_CENTER_MESSAGE_CENTER_H_ |
OLD | NEW |