OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_GEOMETRY_CACHE_H_ | 5 #ifndef EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_GEOMETRY_CACHE_H_ |
6 #define EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_GEOMETRY_CACHE_H_ | 6 #define EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_GEOMETRY_CACHE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 }; | 120 }; |
121 | 121 |
122 // Data stored for each extension. | 122 // Data stored for each extension. |
123 typedef std::map<std::string, WindowData> ExtensionData; | 123 typedef std::map<std::string, WindowData> ExtensionData; |
124 | 124 |
125 // ExtensionRegistryObserver implementation. | 125 // ExtensionRegistryObserver implementation. |
126 void OnExtensionLoaded(content::BrowserContext* browser_context, | 126 void OnExtensionLoaded(content::BrowserContext* browser_context, |
127 const Extension* extension) override; | 127 const Extension* extension) override; |
128 void OnExtensionUnloaded(content::BrowserContext* browser_context, | 128 void OnExtensionUnloaded(content::BrowserContext* browser_context, |
129 const Extension* extension, | 129 const Extension* extension, |
130 UnloadedExtensionInfo::Reason reason) override; | 130 UnloadedExtensionReason reason) override; |
131 | 131 |
132 void LoadGeometryFromStorage(const std::string& extension_id); | 132 void LoadGeometryFromStorage(const std::string& extension_id); |
133 void SyncToStorage(); | 133 void SyncToStorage(); |
134 | 134 |
135 // Preferences storage. | 135 // Preferences storage. |
136 ExtensionPrefs* prefs_; | 136 ExtensionPrefs* prefs_; |
137 | 137 |
138 // Cached data. | 138 // Cached data. |
139 std::map<std::string, ExtensionData> cache_; | 139 std::map<std::string, ExtensionData> cache_; |
140 | 140 |
141 // Data that still needs saving. | 141 // Data that still needs saving. |
142 std::set<std::string> unsynced_extensions_; | 142 std::set<std::string> unsynced_extensions_; |
143 | 143 |
144 // The timer used to save the data. | 144 // The timer used to save the data. |
145 base::OneShotTimer sync_timer_; | 145 base::OneShotTimer sync_timer_; |
146 | 146 |
147 // The timeout value we'll use for |sync_timer_|. | 147 // The timeout value we'll use for |sync_timer_|. |
148 base::TimeDelta sync_delay_; | 148 base::TimeDelta sync_delay_; |
149 | 149 |
150 // Listen to extension load, unloaded notifications. | 150 // Listen to extension load, unloaded notifications. |
151 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 151 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
152 extension_registry_observer_; | 152 extension_registry_observer_; |
153 | 153 |
154 base::ObserverList<Observer> observers_; | 154 base::ObserverList<Observer> observers_; |
155 }; | 155 }; |
156 | 156 |
157 } // namespace extensions | 157 } // namespace extensions |
158 | 158 |
159 #endif // EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_GEOMETRY_CACHE_H_ | 159 #endif // EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_GEOMETRY_CACHE_H_ |
OLD | NEW |