Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Side by Side Diff: ui/message_center/message_center_impl.h

Issue 288033014: Remove Notifications Associated with an Extension When the Extension is Unchecked from the Message … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Unit Test That Left Dangling Pointer Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/memory/scoped_vector.h" 11 #include "base/memory/scoped_vector.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/stl_util.h" 13 #include "base/stl_util.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "base/timer/timer.h" 15 #include "base/timer/timer.h"
16 #include "ui/message_center/message_center.h" 16 #include "ui/message_center/message_center.h"
17 #include "ui/message_center/message_center_observer.h" 17 #include "ui/message_center/message_center_observer.h"
18 #include "ui/message_center/message_center_types.h" 18 #include "ui/message_center/message_center_types.h"
19 #include "ui/message_center/notification_blocker.h" 19 #include "ui/message_center/notification_blocker.h"
20 #include "ui/message_center/notifier_settings.h"
20 21
21 namespace message_center { 22 namespace message_center {
22 class NotificationDelegate; 23 class NotificationDelegate;
23 class MessageCenterImpl; 24 class MessageCenterImpl;
24 25
25 namespace internal { 26 namespace internal {
26 class ChangeQueue; 27 class ChangeQueue;
27 class PopupTimersController; 28 class PopupTimersController;
28 29
29 // A class that manages timeout behavior for notification popups. One instance 30 // A class that manages timeout behavior for notification popups. One instance
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 PopupTimerCollection popup_timers_; 131 PopupTimerCollection popup_timers_;
131 STLValueDeleter<PopupTimerCollection> popup_deleter_; 132 STLValueDeleter<PopupTimerCollection> popup_deleter_;
132 133
133 DISALLOW_COPY_AND_ASSIGN(PopupTimersController); 134 DISALLOW_COPY_AND_ASSIGN(PopupTimersController);
134 }; 135 };
135 136
136 } // namespace internal 137 } // namespace internal
137 138
138 // The default implementation of MessageCenter. 139 // The default implementation of MessageCenter.
139 class MessageCenterImpl : public MessageCenter, 140 class MessageCenterImpl : public MessageCenter,
140 public NotificationBlocker::Observer { 141 public NotificationBlocker::Observer,
142 public message_center::NotifierSettingsObserver {
141 public: 143 public:
142 MessageCenterImpl(); 144 MessageCenterImpl();
143 virtual ~MessageCenterImpl(); 145 virtual ~MessageCenterImpl();
144 146
145 // MessageCenter overrides: 147 // MessageCenter overrides:
146 virtual void AddObserver(MessageCenterObserver* observer) OVERRIDE; 148 virtual void AddObserver(MessageCenterObserver* observer) OVERRIDE;
147 virtual void RemoveObserver(MessageCenterObserver* observer) OVERRIDE; 149 virtual void RemoveObserver(MessageCenterObserver* observer) OVERRIDE;
148 virtual void AddNotificationBlocker(NotificationBlocker* blocker) OVERRIDE; 150 virtual void AddNotificationBlocker(NotificationBlocker* blocker) OVERRIDE;
149 virtual void RemoveNotificationBlocker(NotificationBlocker* blocker) OVERRIDE; 151 virtual void RemoveNotificationBlocker(NotificationBlocker* blocker) OVERRIDE;
150 virtual void SetVisibility(Visibility visible) OVERRIDE; 152 virtual void SetVisibility(Visibility visible) OVERRIDE;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 virtual NotifierSettingsProvider* GetNotifierSettingsProvider() OVERRIDE; 189 virtual NotifierSettingsProvider* GetNotifierSettingsProvider() OVERRIDE;
188 virtual void SetQuietMode(bool in_quiet_mode) OVERRIDE; 190 virtual void SetQuietMode(bool in_quiet_mode) OVERRIDE;
189 virtual void EnterQuietModeWithExpire( 191 virtual void EnterQuietModeWithExpire(
190 const base::TimeDelta& expires_in) OVERRIDE; 192 const base::TimeDelta& expires_in) OVERRIDE;
191 virtual void RestartPopupTimers() OVERRIDE; 193 virtual void RestartPopupTimers() OVERRIDE;
192 virtual void PausePopupTimers() OVERRIDE; 194 virtual void PausePopupTimers() OVERRIDE;
193 195
194 // NotificationBlocker::Observer overrides: 196 // NotificationBlocker::Observer overrides:
195 virtual void OnBlockingStateChanged(NotificationBlocker* blocker) OVERRIDE; 197 virtual void OnBlockingStateChanged(NotificationBlocker* blocker) OVERRIDE;
196 198
199 // message_center::NotifierSettingsObserver overrides:
200 virtual void UpdateIconImage(const NotifierId& notifier_id,
201 const gfx::Image& icon) OVERRIDE;
202 virtual void NotifierGroupChanged() OVERRIDE;
203 virtual void NotifierEnabledChanged(const NotifierId& notifier_id,
204 bool enabled) OVERRIDE;
205
197 protected: 206 protected:
198 virtual void DisableTimersForTest() OVERRIDE; 207 virtual void DisableTimersForTest() OVERRIDE;
199 208
200 private: 209 private:
201 struct NotificationCache { 210 struct NotificationCache {
202 NotificationCache(); 211 NotificationCache();
203 ~NotificationCache(); 212 ~NotificationCache();
204 void Rebuild(const NotificationList::Notifications& notifications); 213 void Rebuild(const NotificationList::Notifications& notifications);
205 void RecountUnread(); 214 void RecountUnread();
206 215
207 NotificationList::Notifications visible_notifications; 216 NotificationList::Notifications visible_notifications;
208 size_t unread_count; 217 size_t unread_count;
209 }; 218 };
210 219
211 void RemoveNotifications(bool by_user, const NotificationBlockers& blockers); 220 void RemoveNotifications(bool by_user, const NotificationBlockers& blockers);
221 void RemoveNotificationsForNotifierId(const NotifierId& notifier_id);
212 222
213 scoped_ptr<NotificationList> notification_list_; 223 scoped_ptr<NotificationList> notification_list_;
214 NotificationCache notification_cache_; 224 NotificationCache notification_cache_;
215 ObserverList<MessageCenterObserver> observer_list_; 225 ObserverList<MessageCenterObserver> observer_list_;
216 scoped_ptr<internal::PopupTimersController> popup_timers_controller_; 226 scoped_ptr<internal::PopupTimersController> popup_timers_controller_;
217 scoped_ptr<base::OneShotTimer<MessageCenterImpl> > quiet_mode_timer_; 227 scoped_ptr<base::OneShotTimer<MessageCenterImpl> > quiet_mode_timer_;
218 NotifierSettingsProvider* settings_provider_; 228 NotifierSettingsProvider* settings_provider_;
219 std::vector<NotificationBlocker*> blockers_; 229 std::vector<NotificationBlocker*> blockers_;
220 230
221 // Queue for the notifications to delay the addition/updates when the message 231 // Queue for the notifications to delay the addition/updates when the message
222 // center is visible. 232 // center is visible.
223 scoped_ptr<internal::ChangeQueue> notification_queue_; 233 scoped_ptr<internal::ChangeQueue> notification_queue_;
224 234
225 DISALLOW_COPY_AND_ASSIGN(MessageCenterImpl); 235 DISALLOW_COPY_AND_ASSIGN(MessageCenterImpl);
226 }; 236 };
227 237
228 } // namespace message_center 238 } // namespace message_center
229 239
230 #endif // UI_MESSAGE_CENTER_MESSAGE_CENTER_H_ 240 #endif // UI_MESSAGE_CENTER_MESSAGE_CENTER_H_
OLDNEW
« no previous file with comments | « ui/message_center/cocoa/tray_view_controller_unittest.mm ('k') | ui/message_center/message_center_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698