• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #ifndef UI_MESSAGE_CENTER_MESSAGE_CENTER_OBSERVER_H_
6 #define UI_MESSAGE_CENTER_MESSAGE_CENTER_OBSERVER_H_
7 
8 #include <string>
9 
10 #include "ui/message_center/message_center_export.h"
11 #include "ui/message_center/message_center_types.h"
12 
13 namespace message_center {
14 class NotificationBlocker;
15 
16 // An observer class for the change of notifications in the MessageCenter.
17 class MESSAGE_CENTER_EXPORT MessageCenterObserver {
18  public:
~MessageCenterObserver()19   virtual ~MessageCenterObserver() {}
20 
21   // Called when the notification associated with |notification_id| is added
22   // to the notification_list.
OnNotificationAdded(const std::string & notification_id)23   virtual void OnNotificationAdded(const std::string& notification_id) {}
24 
25   // Called when the notification associated with |notification_id| is removed
26   // from the notification_list.
OnNotificationRemoved(const std::string & notification_id,bool by_user)27   virtual void OnNotificationRemoved(const std::string& notification_id,
28                                      bool by_user) {}
29 
30   // Called when the contents of the notification associated with
31   // |notification_id| is updated.
OnNotificationUpdated(const std::string & notification_id)32   virtual void OnNotificationUpdated(const std::string& notification_id) {}
33 
34   // Called when a click event happens on the notification associated with
35   // |notification_id|.
OnNotificationClicked(const std::string & notification_id)36   virtual void OnNotificationClicked(const std::string& notification_id) {}
37 
38   // Called when a click event happens on a button indexed by |button_index|
39   // of the notification associated with |notification_id|.
OnNotificationButtonClicked(const std::string & notification_id,int button_index)40   virtual void OnNotificationButtonClicked(const std::string& notification_id,
41                                            int button_index) {}
42 
43   // Called when the notification associated with |notification_id| is actually
44   // displayed.
OnNotificationDisplayed(const std::string & notification_id,const DisplaySource source)45   virtual void OnNotificationDisplayed(
46       const std::string& notification_id,
47       const DisplaySource source) {}
48 
49   // Called when the notification center is shown or hidden.
OnCenterVisibilityChanged(Visibility visibility)50   virtual void OnCenterVisibilityChanged(Visibility visibility) {}
51 
52   // Called whenever the quiet mode changes as a result of user action or when
53   // quiet mode expires.
OnQuietModeChanged(bool in_quiet_mode)54   virtual void OnQuietModeChanged(bool in_quiet_mode) {}
55 
56   // Called when the blocking state of |blocker| is changed.
OnBlockingStateChanged(NotificationBlocker * blocker)57   virtual void OnBlockingStateChanged(NotificationBlocker* blocker) {}
58 };
59 
60 }  // namespace message_center
61 
62 #endif  // UI_MESSAGE_CENTER_MESSAGE_CENTER_OBSERVER_H_
63