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_EXTENSIONS_UPDATER_EXTENSION_UPDATER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_UPDATER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_UPDATER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_UPDATER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // extensions and installing updated ones. The |frequency_seconds| parameter | 84 // extensions and installing updated ones. The |frequency_seconds| parameter |
85 // controls how often update checks are scheduled. | 85 // controls how often update checks are scheduled. |
86 ExtensionUpdater(ExtensionServiceInterface* service, | 86 ExtensionUpdater(ExtensionServiceInterface* service, |
87 ExtensionPrefs* extension_prefs, | 87 ExtensionPrefs* extension_prefs, |
88 PrefService* prefs, | 88 PrefService* prefs, |
89 Profile* profile, | 89 Profile* profile, |
90 int frequency_seconds, | 90 int frequency_seconds, |
91 ExtensionCache* cache, | 91 ExtensionCache* cache, |
92 const ExtensionDownloader::Factory& downloader_factory); | 92 const ExtensionDownloader::Factory& downloader_factory); |
93 | 93 |
94 virtual ~ExtensionUpdater(); | 94 ~ExtensionUpdater() override; |
95 | 95 |
96 // Starts the updater running. Should be called at most once. | 96 // Starts the updater running. Should be called at most once. |
97 void Start(); | 97 void Start(); |
98 | 98 |
99 // Stops the updater running, cancelling any outstanding update manifest and | 99 // Stops the updater running, cancelling any outstanding update manifest and |
100 // crx downloads. Does not cancel any in-progress installs. | 100 // crx downloads. Does not cancel any in-progress installs. |
101 void Stop(); | 101 void Stop(); |
102 | 102 |
103 // Posts a task to do an update check. Does nothing if there is | 103 // Posts a task to do an update check. Does nothing if there is |
104 // already a pending task that has not yet run. | 104 // already a pending task that has not yet run. |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 const std::list<std::string>& pending_ids, | 184 const std::list<std::string>& pending_ids, |
185 int request_id); | 185 int request_id); |
186 | 186 |
187 // BaseTimer::ReceiverMethod callback. | 187 // BaseTimer::ReceiverMethod callback. |
188 void TimerFired(); | 188 void TimerFired(); |
189 | 189 |
190 // Posted by CheckSoon(). | 190 // Posted by CheckSoon(). |
191 void DoCheckSoon(); | 191 void DoCheckSoon(); |
192 | 192 |
193 // Implementation of ExtensionDownloaderDelegate. | 193 // Implementation of ExtensionDownloaderDelegate. |
194 virtual void OnExtensionDownloadFailed( | 194 void OnExtensionDownloadFailed(const std::string& id, |
195 const std::string& id, | 195 Error error, |
196 Error error, | 196 const PingResult& ping, |
197 const PingResult& ping, | 197 const std::set<int>& request_ids) override; |
198 const std::set<int>& request_ids) override; | 198 void OnExtensionDownloadFinished(const std::string& id, |
199 virtual void OnExtensionDownloadFinished( | 199 const base::FilePath& path, |
200 const std::string& id, | 200 bool file_ownership_passed, |
201 const base::FilePath& path, | 201 const GURL& download_url, |
202 bool file_ownership_passed, | 202 const std::string& version, |
203 const GURL& download_url, | 203 const PingResult& ping, |
204 const std::string& version, | 204 const std::set<int>& request_id) override; |
205 const PingResult& ping, | 205 bool GetPingDataForExtension(const std::string& id, |
206 const std::set<int>& request_id) override; | 206 ManifestFetchData::PingData* ping_data) override; |
207 virtual bool GetPingDataForExtension( | 207 std::string GetUpdateUrlData(const std::string& id) override; |
208 const std::string& id, | 208 bool IsExtensionPending(const std::string& id) override; |
209 ManifestFetchData::PingData* ping_data) override; | 209 bool GetExtensionExistingVersion(const std::string& id, |
210 virtual std::string GetUpdateUrlData(const std::string& id) override; | 210 std::string* version) override; |
211 virtual bool IsExtensionPending(const std::string& id) override; | 211 bool ShouldForceUpdate(const std::string& extension_id, |
212 virtual bool GetExtensionExistingVersion(const std::string& id, | 212 std::string* source) override; |
213 std::string* version) override; | |
214 virtual bool ShouldForceUpdate(const std::string& extension_id, | |
215 std::string* source) override; | |
216 | 213 |
217 void UpdatePingData(const std::string& id, const PingResult& ping_result); | 214 void UpdatePingData(const std::string& id, const PingResult& ping_result); |
218 | 215 |
219 // Starts installing a crx file that has been fetched but not installed yet. | 216 // Starts installing a crx file that has been fetched but not installed yet. |
220 void MaybeInstallCRXFile(); | 217 void MaybeInstallCRXFile(); |
221 | 218 |
222 // content::NotificationObserver implementation. | 219 // content::NotificationObserver implementation. |
223 virtual void Observe(int type, | 220 void Observe(int type, |
224 const content::NotificationSource& source, | 221 const content::NotificationSource& source, |
225 const content::NotificationDetails& details) override; | 222 const content::NotificationDetails& details) override; |
226 | 223 |
227 // Implementation of ExtensionRegistryObserver. | 224 // Implementation of ExtensionRegistryObserver. |
228 virtual void OnExtensionWillBeInstalled( | 225 void OnExtensionWillBeInstalled(content::BrowserContext* browser_context, |
229 content::BrowserContext* browser_context, | 226 const Extension* extension, |
230 const Extension* extension, | 227 bool is_update, |
231 bool is_update, | 228 bool from_ephemeral, |
232 bool from_ephemeral, | 229 const std::string& old_name) override; |
233 const std::string& old_name) override; | |
234 | 230 |
235 // Send a notification that update checks are starting. | 231 // Send a notification that update checks are starting. |
236 void NotifyStarted(); | 232 void NotifyStarted(); |
237 | 233 |
238 // Send a notification if we're finished updating. | 234 // Send a notification if we're finished updating. |
239 void NotifyIfFinished(int request_id); | 235 void NotifyIfFinished(int request_id); |
240 | 236 |
241 void ExtensionCheckFinished(const std::string& extension_id, | 237 void ExtensionCheckFinished(const std::string& extension_id, |
242 const FinishedCallback& callback); | 238 const FinishedCallback& callback); |
243 | 239 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 std::set<std::string> forced_updates_; | 288 std::set<std::string> forced_updates_; |
293 | 289 |
294 base::WeakPtrFactory<ExtensionUpdater> weak_ptr_factory_; | 290 base::WeakPtrFactory<ExtensionUpdater> weak_ptr_factory_; |
295 | 291 |
296 DISALLOW_COPY_AND_ASSIGN(ExtensionUpdater); | 292 DISALLOW_COPY_AND_ASSIGN(ExtensionUpdater); |
297 }; | 293 }; |
298 | 294 |
299 } // namespace extensions | 295 } // namespace extensions |
300 | 296 |
301 #endif // CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_UPDATER_H_ | 297 #endif // CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_UPDATER_H_ |
OLD | NEW |