OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_BACKGROUND_APPLICATION_LIST_MODEL_H_ | 5 #ifndef CHROME_BROWSER_BACKGROUND_APPLICATION_LIST_MODEL_H_ |
6 #define CHROME_BROWSER_BACKGROUND_APPLICATION_LIST_MODEL_H_ | 6 #define CHROME_BROWSER_BACKGROUND_APPLICATION_LIST_MODEL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 14 matching lines...) Expand all Loading... |
25 public: | 25 public: |
26 // Observer is informed of changes to the model. Users of the | 26 // Observer is informed of changes to the model. Users of the |
27 // BackgroundApplicationListModel should anticipate that associated data, | 27 // BackgroundApplicationListModel should anticipate that associated data, |
28 // e. g. the Icon, may exist and yet not be immediately available. When the | 28 // e. g. the Icon, may exist and yet not be immediately available. When the |
29 // data becomes available, OnApplicationDataChanged will be invoked for all | 29 // data becomes available, OnApplicationDataChanged will be invoked for all |
30 // Observers of the model. | 30 // Observers of the model. |
31 class Observer { | 31 class Observer { |
32 public: | 32 public: |
33 // Invoked when data that the model associates with the extension, such as | 33 // Invoked when data that the model associates with the extension, such as |
34 // the Icon, has changed. | 34 // the Icon, has changed. |
35 virtual void OnApplicationDataChanged(const Extension* extension, | 35 virtual void OnApplicationDataChanged(const Extension* extension); |
36 Profile* profile); | |
37 | 36 |
38 // Invoked when the model detects a previously unknown extension and/or when | 37 // Invoked when the model detects a previously unknown extension and/or when |
39 // it no longer detects a previously known extension. | 38 // it no longer detects a previously known extension. |
40 virtual void OnApplicationListChanged(Profile* profile); | 39 virtual void OnApplicationListChanged(); |
41 | 40 |
42 protected: | 41 protected: |
43 virtual ~Observer(); | 42 virtual ~Observer(); |
44 }; | 43 }; |
45 | 44 |
46 // Create a new model associated with profile. | 45 // Create a new model associated with profile. |
47 explicit BackgroundApplicationListModel(Profile* profile); | 46 explicit BackgroundApplicationListModel(Profile* profile); |
48 | 47 |
49 virtual ~BackgroundApplicationListModel(); | 48 virtual ~BackgroundApplicationListModel(); |
50 | 49 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // Returns the Application associated with |extension| or NULL. | 103 // Returns the Application associated with |extension| or NULL. |
105 Application* FindApplication(const Extension* extension); | 104 Application* FindApplication(const Extension* extension); |
106 | 105 |
107 // NotificationObserver implementation. | 106 // NotificationObserver implementation. |
108 virtual void Observe(NotificationType type, | 107 virtual void Observe(NotificationType type, |
109 const NotificationSource& source, | 108 const NotificationSource& source, |
110 const NotificationDetails& details); | 109 const NotificationDetails& details); |
111 | 110 |
112 // Notifies observers that some of the data associated with this background | 111 // Notifies observers that some of the data associated with this background |
113 // application, e. g. the Icon, has changed. | 112 // application, e. g. the Icon, has changed. |
114 void SendApplicationDataChangedNotifications(const Extension* extension); | 113 void OnApplicationDataChanged(const Extension* extension); |
115 | 114 |
116 // Notifies observers that at least one background application has been added | 115 // Notifies observers that at least one background application has been added |
117 // or removed. | 116 // or removed. |
118 void SendApplicationListChangedNotifications(); | 117 void OnApplicationListChanged(); |
119 | 118 |
120 // Invoked by Observe for EXTENSION_LOADED notifications. | 119 // Invoked by Observe for EXTENSION_LOADED notifications. |
121 void OnExtensionLoaded(Extension* extension); | 120 void OnExtensionLoaded(Extension* extension); |
122 | 121 |
123 // Invoked by Observe for EXTENSION_UNLOADED notifications. | 122 // Invoked by Observe for EXTENSION_UNLOADED notifications. |
124 void OnExtensionUnloaded(const Extension* extension); | 123 void OnExtensionUnloaded(const Extension* extension); |
125 | 124 |
126 // Refresh the list of background applications and generate notifications. | 125 // Refresh the list of background applications and generate notifications. |
127 void Update(); | 126 void Update(); |
128 | 127 |
129 ApplicationMap applications_; | 128 ApplicationMap applications_; |
130 ExtensionList extensions_; | 129 ExtensionList extensions_; |
131 ObserverList<Observer> observers_; | 130 ObserverList<Observer> observers_; |
132 Profile* profile_; | 131 Profile* profile_; |
133 NotificationRegistrar registrar_; | 132 NotificationRegistrar registrar_; |
134 | 133 |
135 DISALLOW_COPY_AND_ASSIGN(BackgroundApplicationListModel); | 134 DISALLOW_COPY_AND_ASSIGN(BackgroundApplicationListModel); |
136 }; | 135 }; |
137 | 136 |
138 #endif // CHROME_BROWSER_BACKGROUND_APPLICATION_LIST_MODEL_H_ | 137 #endif // CHROME_BROWSER_BACKGROUND_APPLICATION_LIST_MODEL_H_ |
OLD | NEW |