| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 #include <stack> | 10 #include <stack> |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 private: | 86 private: |
| 87 friend class ExtensionUpdaterTest; | 87 friend class ExtensionUpdaterTest; |
| 88 friend class ExtensionUpdaterFileHandler; | 88 friend class ExtensionUpdaterFileHandler; |
| 89 | 89 |
| 90 // FetchedCRXFile holds information about a CRX file we fetched to disk, | 90 // FetchedCRXFile holds information about a CRX file we fetched to disk, |
| 91 // but have not yet installed. | 91 // but have not yet installed. |
| 92 struct FetchedCRXFile { | 92 struct FetchedCRXFile { |
| 93 FetchedCRXFile(); | 93 FetchedCRXFile(); |
| 94 FetchedCRXFile(const std::string& id, | 94 FetchedCRXFile(const std::string& id, |
| 95 const FilePath& path, | 95 const FilePath& path, |
| 96 const GURL& download_url); | 96 const GURL& download_url, |
| 97 const bool is_sync); |
| 97 ~FetchedCRXFile(); | 98 ~FetchedCRXFile(); |
| 98 | 99 |
| 99 std::string id; | 100 std::string id; |
| 100 FilePath path; | 101 FilePath path; |
| 101 GURL download_url; | 102 GURL download_url; |
| 103 bool is_sync; |
| 102 }; | 104 }; |
| 103 | 105 |
| 104 // Computes when to schedule the first update check. | 106 // Computes when to schedule the first update check. |
| 105 base::TimeDelta DetermineFirstCheckDelay(); | 107 base::TimeDelta DetermineFirstCheckDelay(); |
| 106 | 108 |
| 107 // Sets the timer to call TimerFired after roughly |target_delay| from now. | 109 // Sets the timer to call TimerFired after roughly |target_delay| from now. |
| 108 // To help spread load evenly on servers, this method adds some random | 110 // To help spread load evenly on servers, this method adds some random |
| 109 // jitter. It also saves the scheduled time so it can be reloaded on | 111 // jitter. It also saves the scheduled time so it can be reloaded on |
| 110 // browser restart. | 112 // browser restart. |
| 111 void ScheduleNextCheck(const base::TimeDelta& target_delay); | 113 void ScheduleNextCheck(const base::TimeDelta& target_delay); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 123 | 125 |
| 124 // Implenentation of ExtensionDownloaderDelegate. | 126 // Implenentation of ExtensionDownloaderDelegate. |
| 125 virtual void OnExtensionDownloadFailed(const std::string& id, | 127 virtual void OnExtensionDownloadFailed(const std::string& id, |
| 126 Error error, | 128 Error error, |
| 127 const PingResult& ping) OVERRIDE; | 129 const PingResult& ping) OVERRIDE; |
| 128 | 130 |
| 129 virtual void OnExtensionDownloadFinished(const std::string& id, | 131 virtual void OnExtensionDownloadFinished(const std::string& id, |
| 130 const FilePath& path, | 132 const FilePath& path, |
| 131 const GURL& download_url, | 133 const GURL& download_url, |
| 132 const std::string& version, | 134 const std::string& version, |
| 133 const PingResult& ping) OVERRIDE; | 135 const PingResult& ping, |
| 136 const bool is_sync) OVERRIDE; |
| 134 | 137 |
| 135 virtual void OnBlacklistDownloadFinished(const std::string& data, | 138 virtual void OnBlacklistDownloadFinished(const std::string& data, |
| 136 const std::string& package_hash, | 139 const std::string& package_hash, |
| 137 const std::string& version, | 140 const std::string& version, |
| 138 const PingResult& ping) OVERRIDE; | 141 const PingResult& ping) OVERRIDE; |
| 139 virtual bool GetPingDataForExtension( | 142 virtual bool GetPingDataForExtension( |
| 140 const std::string& id, | 143 const std::string& id, |
| 141 ManifestFetchData::PingData* ping_data) OVERRIDE; | 144 ManifestFetchData::PingData* ping_data) OVERRIDE; |
| 142 | 145 |
| 143 virtual std::string GetUpdateUrlData(const std::string& id) OVERRIDE; | 146 virtual std::string GetUpdateUrlData(const std::string& id) OVERRIDE; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 | 198 |
| 196 // Fetched CRX files waiting to be installed. | 199 // Fetched CRX files waiting to be installed. |
| 197 std::stack<FetchedCRXFile> fetched_crx_files_; | 200 std::stack<FetchedCRXFile> fetched_crx_files_; |
| 198 | 201 |
| 199 DISALLOW_COPY_AND_ASSIGN(ExtensionUpdater); | 202 DISALLOW_COPY_AND_ASSIGN(ExtensionUpdater); |
| 200 }; | 203 }; |
| 201 | 204 |
| 202 } // namespace extensions | 205 } // namespace extensions |
| 203 | 206 |
| 204 #endif // CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_UPDATER_H_ | 207 #endif // CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_UPDATER_H_ |
| OLD | NEW |