OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BACKGROUND_APPLICATION_LIST_MODEL_H_ | 5 #ifndef CHROME_BROWSER_BACKGROUND_BACKGROUND_APPLICATION_LIST_MODEL_H_ |
6 #define CHROME_BROWSER_BACKGROUND_BACKGROUND_APPLICATION_LIST_MODEL_H_ | 6 #define CHROME_BROWSER_BACKGROUND_BACKGROUND_APPLICATION_LIST_MODEL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 // Returns true if all startup notifications have already been issued. | 94 // Returns true if all startup notifications have already been issued. |
95 bool is_ready() const { | 95 bool is_ready() const { |
96 return ready_; | 96 return ready_; |
97 } | 97 } |
98 | 98 |
99 private: | 99 private: |
100 // Contains data associated with a background application that is not | 100 // Contains data associated with a background application that is not |
101 // represented by the Extension class. | 101 // represented by the Extension class. |
102 class Application; | 102 class Application; |
103 | 103 |
104 // Associates extension id strings with Application objects. | |
105 typedef std::map<std::string, Application*> ApplicationMap; | |
106 | |
107 // Identifies and caches data related to the extension. | 104 // Identifies and caches data related to the extension. |
108 void AssociateApplicationData(const extensions::Extension* extension); | 105 void AssociateApplicationData(const extensions::Extension* extension); |
109 | 106 |
110 // Clears cached data related to |extension|. | 107 // Clears cached data related to |extension|. |
111 void DissociateApplicationData(const extensions::Extension* extension); | 108 void DissociateApplicationData(const extensions::Extension* extension); |
112 | 109 |
113 // Returns the Application associated with |extension| or NULL. | 110 // Returns the Application associated with |extension| or NULL. |
114 const Application* FindApplication( | 111 const Application* FindApplication( |
115 const extensions::Extension* extension) const; | 112 const extensions::Extension* extension) const; |
116 | 113 |
(...skipping 22 matching lines...) Expand all Loading... |
139 | 136 |
140 // Invoked by Observe for NOTIFICATION_EXTENSION_PERMISSIONS_UPDATED. | 137 // Invoked by Observe for NOTIFICATION_EXTENSION_PERMISSIONS_UPDATED. |
141 void OnExtensionPermissionsUpdated( | 138 void OnExtensionPermissionsUpdated( |
142 const extensions::Extension* extension, | 139 const extensions::Extension* extension, |
143 extensions::UpdatedExtensionPermissionsInfo::Reason reason, | 140 extensions::UpdatedExtensionPermissionsInfo::Reason reason, |
144 const extensions::PermissionSet& permissions); | 141 const extensions::PermissionSet& permissions); |
145 | 142 |
146 // Refresh the list of background applications and generate notifications. | 143 // Refresh the list of background applications and generate notifications. |
147 void Update(); | 144 void Update(); |
148 | 145 |
149 ApplicationMap applications_; | 146 // Associates extension id strings with Application objects. |
| 147 std::map<std::string, std::unique_ptr<Application>> applications_; |
| 148 |
150 extensions::ExtensionList extensions_; | 149 extensions::ExtensionList extensions_; |
151 base::ObserverList<Observer, true> observers_; | 150 base::ObserverList<Observer, true> observers_; |
152 Profile* profile_; | 151 Profile* profile_; |
153 content::NotificationRegistrar registrar_; | 152 content::NotificationRegistrar registrar_; |
154 bool ready_; | 153 bool ready_; |
155 | 154 |
156 DISALLOW_COPY_AND_ASSIGN(BackgroundApplicationListModel); | 155 DISALLOW_COPY_AND_ASSIGN(BackgroundApplicationListModel); |
157 }; | 156 }; |
158 | 157 |
159 #endif // CHROME_BROWSER_BACKGROUND_BACKGROUND_APPLICATION_LIST_MODEL_H_ | 158 #endif // CHROME_BROWSER_BACKGROUND_BACKGROUND_APPLICATION_LIST_MODEL_H_ |
OLD | NEW |