| 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 <set> | 10 #include <set> |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 struct UpdateDetails { | 40 struct UpdateDetails { |
| 41 UpdateDetails(const std::string& id, const base::Version& version); | 41 UpdateDetails(const std::string& id, const base::Version& version); |
| 42 ~UpdateDetails(); | 42 ~UpdateDetails(); |
| 43 | 43 |
| 44 std::string id; | 44 std::string id; |
| 45 base::Version version; | 45 base::Version version; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 class ExtensionCache; | 48 class ExtensionCache; |
| 49 class ExtensionDownloaderTestDelegate; | |
| 50 class ExtensionUpdaterTest; | 49 class ExtensionUpdaterTest; |
| 51 | 50 |
| 52 // A class that checks for updates of a given list of extensions, and downloads | 51 // A class that checks for updates of a given list of extensions, and downloads |
| 53 // the crx file when updates are found. It uses a |ExtensionDownloaderDelegate| | 52 // the crx file when updates are found. It uses a |ExtensionDownloaderDelegate| |
| 54 // that takes ownership of the downloaded crx files, and handles events during | 53 // that takes ownership of the downloaded crx files, and handles events during |
| 55 // the update check. | 54 // the update check. |
| 56 class ExtensionDownloader : public net::URLFetcherDelegate, | 55 class ExtensionDownloader : public net::URLFetcherDelegate, |
| 57 public OAuth2TokenService::Consumer { | 56 public OAuth2TokenService::Consumer { |
| 58 public: | 57 public: |
| 59 // A closure which constructs a new ExtensionDownloader to be owned by the | 58 // A closure which constructs a new ExtensionDownloader to be owned by the |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 } | 107 } |
| 109 | 108 |
| 110 void set_ping_enabled_domain(const std::string& domain) { | 109 void set_ping_enabled_domain(const std::string& domain) { |
| 111 ping_enabled_domain_ = domain; | 110 ping_enabled_domain_ = domain; |
| 112 } | 111 } |
| 113 | 112 |
| 114 void set_enable_extra_update_metrics(bool enable) { | 113 void set_enable_extra_update_metrics(bool enable) { |
| 115 enable_extra_update_metrics_ = enable; | 114 enable_extra_update_metrics_ = enable; |
| 116 } | 115 } |
| 117 | 116 |
| 118 // Sets a test delegate to use by any instances of this class. The |delegate| | |
| 119 // should outlive all instances. | |
| 120 static void set_test_delegate(ExtensionDownloaderTestDelegate* delegate); | |
| 121 | |
| 122 // These are needed for unit testing, to help identify the correct mock | 117 // These are needed for unit testing, to help identify the correct mock |
| 123 // URLFetcher objects. | 118 // URLFetcher objects. |
| 124 static const int kManifestFetcherId = 1; | 119 static const int kManifestFetcherId = 1; |
| 125 static const int kExtensionFetcherId = 2; | 120 static const int kExtensionFetcherId = 2; |
| 126 | 121 |
| 127 // Update AppID for extension blacklist. | 122 // Update AppID for extension blacklist. |
| 128 static const char kBlacklistAppID[]; | 123 static const char kBlacklistAppID[]; |
| 129 | 124 |
| 130 static const int kMaxRetries = 10; | 125 static const int kMaxRetries = 10; |
| 131 | 126 |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 | 328 |
| 334 // Used to create WeakPtrs to |this|. | 329 // Used to create WeakPtrs to |this|. |
| 335 base::WeakPtrFactory<ExtensionDownloader> weak_ptr_factory_; | 330 base::WeakPtrFactory<ExtensionDownloader> weak_ptr_factory_; |
| 336 | 331 |
| 337 DISALLOW_COPY_AND_ASSIGN(ExtensionDownloader); | 332 DISALLOW_COPY_AND_ASSIGN(ExtensionDownloader); |
| 338 }; | 333 }; |
| 339 | 334 |
| 340 } // namespace extensions | 335 } // namespace extensions |
| 341 | 336 |
| 342 #endif // EXTENSIONS_BROWSER_UPDATER_EXTENSION_DOWNLOADER_H_ | 337 #endif // EXTENSIONS_BROWSER_UPDATER_EXTENSION_DOWNLOADER_H_ |
| OLD | NEW |