Chromium Code Reviews| 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_NOTIFIER_SETTINGS_H_ | 5 #ifndef UI_MESSAGE_CENTER_NOTIFIER_SETTINGS_H_ |
| 6 #define UI_MESSAGE_CENTER_NOTIFIER_SETTINGS_H_ | 6 #define UI_MESSAGE_CENTER_NOTIFIER_SETTINGS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 // True if the source is allowed to send notifications. True is default. | 77 // True if the source is allowed to send notifications. True is default. |
| 78 bool enabled; | 78 bool enabled; |
| 79 | 79 |
| 80 // The icon image of the notifier. The extension icon or favicon. | 80 // The icon image of the notifier. The extension icon or favicon. |
| 81 gfx::Image icon; | 81 gfx::Image icon; |
| 82 | 82 |
| 83 private: | 83 private: |
| 84 DISALLOW_COPY_AND_ASSIGN(Notifier); | 84 DISALLOW_COPY_AND_ASSIGN(Notifier); |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 struct MESSAGE_CENTER_EXPORT NotifierGroup { | |
| 88 NotifierGroup(const gfx::Image& icon, | |
| 89 const string16& name, | |
| 90 const string16& login_info, | |
| 91 size_t index); | |
| 92 ~NotifierGroup(); | |
| 93 | |
| 94 // Icon of a notifier group. | |
| 95 const gfx::Image icon; | |
| 96 | |
| 97 // Display name of a notifier group. | |
| 98 const string16 name; | |
| 99 | |
| 100 // More display information about the notifier group. | |
| 101 string16 login_info; | |
| 102 | |
| 103 // Unique identifier for the notifier group so that they can be selected in | |
| 104 // the UI. | |
| 105 const size_t index; | |
| 106 | |
| 107 private: | |
| 108 DISALLOW_COPY_AND_ASSIGN(NotifierGroup); | |
| 109 }; | |
| 110 | |
| 87 MESSAGE_CENTER_EXPORT std::string ToString( | 111 MESSAGE_CENTER_EXPORT std::string ToString( |
| 88 NotifierId::SystemComponentNotifierType type); | 112 NotifierId::SystemComponentNotifierType type); |
| 89 MESSAGE_CENTER_EXPORT NotifierId::SystemComponentNotifierType | 113 MESSAGE_CENTER_EXPORT NotifierId::SystemComponentNotifierType |
| 90 ParseSystemComponentName(const std::string& name); | 114 ParseSystemComponentName(const std::string& name); |
| 91 | 115 |
| 92 // An observer class implemented by the view of the NotifierSettings to get | 116 // An observer class implemented by the view of the NotifierSettings to get |
| 93 // notified when the controller has changed data. | 117 // notified when the controller has changed data. |
| 94 class MESSAGE_CENTER_EXPORT NotifierSettingsObserver { | 118 class MESSAGE_CENTER_EXPORT NotifierSettingsObserver { |
| 95 public: | 119 public: |
| 96 // Called when an icon in the controller has been updated. | 120 // Called when an icon in the controller has been updated. |
| 97 virtual void UpdateIconImage(const NotifierId& notifier_id, | 121 virtual void UpdateIconImage(const NotifierId& notifier_id, |
| 98 const gfx::Image& icon) = 0; | 122 const gfx::Image& icon) = 0; |
| 123 | |
| 124 // Called when any change happens to the set of notifier groups. | |
| 125 virtual void NotifierGroupChanged() = 0; | |
| 99 }; | 126 }; |
| 100 | 127 |
| 101 // A class used by NotifierSettingsView to integrate with a setting system | 128 // A class used by NotifierSettingsView to integrate with a setting system |
| 102 // for the clients of this module. | 129 // for the clients of this module. |
| 103 class MESSAGE_CENTER_EXPORT NotifierSettingsProvider { | 130 class MESSAGE_CENTER_EXPORT NotifierSettingsProvider { |
| 104 public: | 131 public: |
| 132 virtual ~NotifierSettingsProvider() {}; | |
|
jianli
2013/08/05 20:48:03
nit: add an empty line after this line.
dewittj
2013/08/05 22:42:28
Done.
| |
| 105 // Sets the delegate. | 133 // Sets the delegate. |
| 106 virtual void AddObserver(NotifierSettingsObserver* observer) = 0; | 134 virtual void AddObserver(NotifierSettingsObserver* observer) = 0; |
| 107 virtual void RemoveObserver(NotifierSettingsObserver* observer) = 0; | 135 virtual void RemoveObserver(NotifierSettingsObserver* observer) = 0; |
| 108 | 136 |
| 137 // Returns the number of notifier groups available. | |
| 138 virtual size_t GetNotifierGroupCount() = 0; | |
|
jianli
2013/08/05 20:48:03
nit: add const modifier?
dewittj
2013/08/05 22:42:28
Done.
| |
| 139 | |
| 140 // Requests the model for a particular notifier group. | |
| 141 virtual const message_center::NotifierGroup& GetNotifierGroupAt( | |
|
jianli
2013/08/05 20:48:03
nit: add const modifier?
dewittj
2013/08/05 22:42:28
Done.
| |
| 142 size_t index) = 0; | |
| 143 | |
| 144 // Informs the settings provider that further requests to GetNotifierList | |
| 145 // should return notifiers for the specified notifier group. | |
| 146 virtual void SwitchToNotifierGroup(size_t index) = 0; | |
| 147 | |
| 148 // Requests the currently active notifier group. | |
| 149 virtual const message_center::NotifierGroup& GetActiveNotifierGroup() = 0; | |
|
jianli
2013/08/05 20:48:03
nit: add const modifier?
dewittj
2013/08/05 22:42:28
Done.
| |
| 150 | |
| 109 // Collects the current notifier list and fills to |notifiers|. Caller takes | 151 // Collects the current notifier list and fills to |notifiers|. Caller takes |
| 110 // the ownership of the elements of |notifiers|. | 152 // the ownership of the elements of |notifiers|. |
| 111 virtual void GetNotifierList(std::vector<Notifier*>* notifiers) = 0; | 153 virtual void GetNotifierList(std::vector<Notifier*>* notifiers) = 0; |
| 112 | 154 |
| 113 // Called when the |enabled| for the |notifier| has been changed by user | 155 // Called when the |enabled| for the |notifier| has been changed by user |
| 114 // operation. | 156 // operation. |
| 115 virtual void SetNotifierEnabled(const Notifier& notifier, bool enabled) = 0; | 157 virtual void SetNotifierEnabled(const Notifier& notifier, bool enabled) = 0; |
| 116 | 158 |
| 117 // Called when the settings window is closed. | 159 // Called when the settings window is closed. |
| 118 virtual void OnNotifierSettingsClosing() = 0; | 160 virtual void OnNotifierSettingsClosing() = 0; |
| 119 }; | 161 }; |
| 120 | 162 |
| 121 } // namespace message_center | 163 } // namespace message_center |
| 122 | 164 |
| 123 #endif // UI_MESSAGE_CENTER_NOTIFIER_SETTINGS_H_ | 165 #endif // UI_MESSAGE_CENTER_NOTIFIER_SETTINGS_H_ |
| OLD | NEW |