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

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

Issue 2198363002: Pass Notification into NotificationBlocker ShouldShow* methods (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ash build errors Created 4 years, 4 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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_NOTIFICATION_BLOCKER_H_ 5 #ifndef UI_MESSAGE_CENTER_NOTIFICATION_BLOCKER_H_
6 #define UI_MESSAGE_CENTER_NOTIFICATION_BLOCKER_H_ 6 #define UI_MESSAGE_CENTER_NOTIFICATION_BLOCKER_H_
7 7
8 #include "base/observer_list.h" 8 #include "base/observer_list.h"
9 #include "ui/message_center/message_center_export.h" 9 #include "ui/message_center/message_center_export.h"
10 #include "ui/message_center/notification.h" 10 #include "ui/message_center/notification.h"
(...skipping 13 matching lines...) Expand all
24 24
25 explicit NotificationBlocker(MessageCenter* message_center); 25 explicit NotificationBlocker(MessageCenter* message_center);
26 virtual ~NotificationBlocker(); 26 virtual ~NotificationBlocker();
27 27
28 void AddObserver(Observer* observer); 28 void AddObserver(Observer* observer);
29 void RemoveObserver(Observer* observer); 29 void RemoveObserver(Observer* observer);
30 30
31 // Checks the current state and updates the availability. 31 // Checks the current state and updates the availability.
32 virtual void CheckState() {} 32 virtual void CheckState() {}
33 33
34 // Returns true when notifications from |notifier_id| should appear in the 34 // Returns true should be shown in the message center. Default returns true
35 // message center. Default returns true always. 35 // always.
36 virtual bool ShouldShowNotification(const NotifierId& notifier_id) const; 36 virtual bool ShouldShowNotification(
37 const Notification& notification) const;
37 38
38 // Returns true when notifications from |notifier_id| should be shown as 39 // Returns true if this notification should be shown as popups on screen.
39 // popups on screen. If it's false, those notifications should be queued. 40 // If it's false, those notifications should be queued.
40 // When a blocker starts returning false for a notification which is already 41 // When a blocker starts returning false for a notification which is already
41 // shown as a popup, the notification should be closed as a popup immediately. 42 // shown as a popup, the notification should be closed as a popup immediately.
42 virtual bool ShouldShowNotificationAsPopup( 43 virtual bool ShouldShowNotificationAsPopup(
43 const NotifierId& notifier_id) const = 0; 44 const Notification& notification) const = 0;
44 45
45 protected: 46 protected:
46 MessageCenter* message_center() { return message_center_; } 47 MessageCenter* message_center() { return message_center_; }
47 void NotifyBlockingStateChanged(); 48 void NotifyBlockingStateChanged();
48 49
49 private: 50 private:
50 base::ObserverList<Observer> observers_; 51 base::ObserverList<Observer> observers_;
51 MessageCenter* message_center_; // weak 52 MessageCenter* message_center_; // weak
52 }; 53 };
53 54
54 typedef std::vector<NotificationBlocker*> NotificationBlockers; 55 typedef std::vector<NotificationBlocker*> NotificationBlockers;
55 56
56 } // namespace message_center 57 } // namespace message_center
57 58
58 #endif // UI_MESSAGE_CENTER_NOTIFICATION_BLOCKER_H_ 59 #endif // UI_MESSAGE_CENTER_NOTIFICATION_BLOCKER_H_
OLDNEW
« no previous file with comments | « ui/message_center/message_center_impl_unittest.cc ('k') | ui/message_center/notification_blocker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698