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_DOWNLOADER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_DOWNLOADER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_DOWNLOADER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_DOWNLOADER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <deque> | 9 #include <deque> |
10 #include <map> | 10 #include <map> |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 GURL update_url, | 112 GURL update_url, |
113 const std::string& update_url_data); | 113 const std::string& update_url_data); |
114 | 114 |
115 // Adds all recorded stats taken so far to histogram counts. | 115 // Adds all recorded stats taken so far to histogram counts. |
116 void ReportStats() const; | 116 void ReportStats() const; |
117 | 117 |
118 // Begins an update check. Takes ownership of |fetch_data|. | 118 // Begins an update check. Takes ownership of |fetch_data|. |
119 void StartUpdateCheck(ManifestFetchData* fetch_data); | 119 void StartUpdateCheck(ManifestFetchData* fetch_data); |
120 | 120 |
121 // content::URLFetcherDelegate implementation. | 121 // content::URLFetcherDelegate implementation. |
122 virtual void OnURLFetchComplete(const content::URLFetcher* source) OVERRIDE; | 122 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; |
123 | 123 |
124 // Handles the result of a manifest fetch. | 124 // Handles the result of a manifest fetch. |
125 void OnManifestFetchComplete(const GURL& url, | 125 void OnManifestFetchComplete(const GURL& url, |
126 const net::URLRequestStatus& status, | 126 const net::URLRequestStatus& status, |
127 int response_code, | 127 int response_code, |
128 const std::string& data); | 128 const std::string& data); |
129 | 129 |
130 // Once a manifest is parsed, this starts fetches of any relevant crx files. | 130 // Once a manifest is parsed, this starts fetches of any relevant crx files. |
131 // If |results| is null, it means something went wrong when parsing it. | 131 // If |results| is null, it means something went wrong when parsing it. |
132 void HandleManifestResults(const ManifestFetchData& fetch_data, | 132 void HandleManifestResults(const ManifestFetchData& fetch_data, |
133 const UpdateManifest::Results* results); | 133 const UpdateManifest::Results* results); |
134 | 134 |
135 // Given a list of potential updates, returns the indices of the ones that are | 135 // Given a list of potential updates, returns the indices of the ones that are |
136 // applicable (are actually a new version, etc.) in |result|. | 136 // applicable (are actually a new version, etc.) in |result|. |
137 void DetermineUpdates(const ManifestFetchData& fetch_data, | 137 void DetermineUpdates(const ManifestFetchData& fetch_data, |
138 const UpdateManifest::Results& possible_updates, | 138 const UpdateManifest::Results& possible_updates, |
139 std::vector<int>* result); | 139 std::vector<int>* result); |
140 | 140 |
141 // Begins (or queues up) download of an updated extension. | 141 // Begins (or queues up) download of an updated extension. |
142 void FetchUpdatedExtension(const std::string& id, | 142 void FetchUpdatedExtension(const std::string& id, |
143 const GURL& url, | 143 const GURL& url, |
144 const std::string& hash, | 144 const std::string& hash, |
145 const std::string& version); | 145 const std::string& version); |
146 | 146 |
147 // Handles the result of a crx fetch. | 147 // Handles the result of a crx fetch. |
148 void OnCRXFetchComplete(const content::URLFetcher* source, | 148 void OnCRXFetchComplete(const net::URLFetcher* source, |
149 const GURL& url, | 149 const GURL& url, |
150 const net::URLRequestStatus& status, | 150 const net::URLRequestStatus& status, |
151 int response_code); | 151 int response_code); |
152 | 152 |
153 // Invokes OnExtensionDownloadFailed() on the |delegate_| for each extension | 153 // Invokes OnExtensionDownloadFailed() on the |delegate_| for each extension |
154 // in the set, with |error| as the reason for failure. | 154 // in the set, with |error| as the reason for failure. |
155 void NotifyExtensionsDownloadFailed(const std::set<std::string>& id_set, | 155 void NotifyExtensionsDownloadFailed(const std::set<std::string>& id_set, |
156 ExtensionDownloaderDelegate::Error error); | 156 ExtensionDownloaderDelegate::Error error); |
157 | 157 |
158 // Send a notification that an update was found for |id| that we'll | 158 // Send a notification that an update was found for |id| that we'll |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 | 196 |
197 // Maps an extension-id to its PingResult data. | 197 // Maps an extension-id to its PingResult data. |
198 std::map<std::string, ExtensionDownloaderDelegate::PingResult> ping_results_; | 198 std::map<std::string, ExtensionDownloaderDelegate::PingResult> ping_results_; |
199 | 199 |
200 DISALLOW_COPY_AND_ASSIGN(ExtensionDownloader); | 200 DISALLOW_COPY_AND_ASSIGN(ExtensionDownloader); |
201 }; | 201 }; |
202 | 202 |
203 } // namespace extensions | 203 } // namespace extensions |
204 | 204 |
205 #endif // CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_DOWNLOADER_H_ | 205 #endif // CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_DOWNLOADER_H_ |
OLD | NEW |