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