| 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 EXTENSIONS_BROWSER_UPDATER_EXTENSION_DOWNLOADER_H_ | 5 #ifndef EXTENSIONS_BROWSER_UPDATER_EXTENSION_DOWNLOADER_H_ |
| 6 #define EXTENSIONS_BROWSER_UPDATER_EXTENSION_DOWNLOADER_H_ | 6 #define EXTENSIONS_BROWSER_UPDATER_EXTENSION_DOWNLOADER_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <utility> | 13 #include <utility> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/memory/linked_ptr.h" | |
| 19 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 20 #include "base/version.h" | 19 #include "base/version.h" |
| 21 #include "extensions/browser/updater/extension_downloader_delegate.h" | 20 #include "extensions/browser/updater/extension_downloader_delegate.h" |
| 22 #include "extensions/browser/updater/manifest_fetch_data.h" | 21 #include "extensions/browser/updater/manifest_fetch_data.h" |
| 23 #include "extensions/browser/updater/request_queue.h" | 22 #include "extensions/browser/updater/request_queue.h" |
| 24 #include "extensions/common/extension.h" | 23 #include "extensions/common/extension.h" |
| 25 #include "extensions/common/update_manifest.h" | 24 #include "extensions/common/update_manifest.h" |
| 26 #include "google_apis/gaia/oauth2_token_service.h" | 25 #include "google_apis/gaia/oauth2_token_service.h" |
| 27 #include "net/url_request/url_fetcher_delegate.h" | 26 #include "net/url_request/url_fetcher_delegate.h" |
| 28 #include "url/gurl.h" | 27 #include "url/gurl.h" |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 // The request context to use for the URLFetchers. | 278 // The request context to use for the URLFetchers. |
| 280 scoped_refptr<net::URLRequestContextGetter> request_context_; | 279 scoped_refptr<net::URLRequestContextGetter> request_context_; |
| 281 | 280 |
| 282 // Collects UMA samples that are reported when ReportStats() is called. | 281 // Collects UMA samples that are reported when ReportStats() is called. |
| 283 URLStats url_stats_; | 282 URLStats url_stats_; |
| 284 | 283 |
| 285 // List of data on fetches we're going to do. We limit the number of | 284 // List of data on fetches we're going to do. We limit the number of |
| 286 // extensions grouped together in one batch to avoid running into the limits | 285 // extensions grouped together in one batch to avoid running into the limits |
| 287 // on the length of http GET requests, so there might be multiple | 286 // on the length of http GET requests, so there might be multiple |
| 288 // ManifestFetchData* objects with the same base_url. | 287 // ManifestFetchData* objects with the same base_url. |
| 289 typedef std::map<std::pair<int, GURL>, | 288 using FetchMap = std::map<std::pair<int, GURL>, |
| 290 std::vector<linked_ptr<ManifestFetchData>>> FetchMap; | 289 std::vector<std::unique_ptr<ManifestFetchData>>>; |
| 291 FetchMap fetches_preparing_; | 290 FetchMap fetches_preparing_; |
| 292 | 291 |
| 293 // Outstanding url fetch requests for manifests and updates. | 292 // Outstanding url fetch requests for manifests and updates. |
| 294 std::unique_ptr<net::URLFetcher> manifest_fetcher_; | 293 std::unique_ptr<net::URLFetcher> manifest_fetcher_; |
| 295 std::unique_ptr<net::URLFetcher> extension_fetcher_; | 294 std::unique_ptr<net::URLFetcher> extension_fetcher_; |
| 296 | 295 |
| 297 // Pending manifests and extensions to be fetched when the appropriate fetcher | 296 // Pending manifests and extensions to be fetched when the appropriate fetcher |
| 298 // is available. | 297 // is available. |
| 299 RequestQueue<ManifestFetchData> manifests_queue_; | 298 RequestQueue<ManifestFetchData> manifests_queue_; |
| 300 RequestQueue<ExtensionFetch> extensions_queue_; | 299 RequestQueue<ExtensionFetch> extensions_queue_; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 328 | 327 |
| 329 // Used to create WeakPtrs to |this|. | 328 // Used to create WeakPtrs to |this|. |
| 330 base::WeakPtrFactory<ExtensionDownloader> weak_ptr_factory_; | 329 base::WeakPtrFactory<ExtensionDownloader> weak_ptr_factory_; |
| 331 | 330 |
| 332 DISALLOW_COPY_AND_ASSIGN(ExtensionDownloader); | 331 DISALLOW_COPY_AND_ASSIGN(ExtensionDownloader); |
| 333 }; | 332 }; |
| 334 | 333 |
| 335 } // namespace extensions | 334 } // namespace extensions |
| 336 | 335 |
| 337 #endif // EXTENSIONS_BROWSER_UPDATER_EXTENSION_DOWNLOADER_H_ | 336 #endif // EXTENSIONS_BROWSER_UPDATER_EXTENSION_DOWNLOADER_H_ |
| OLD | NEW |