| 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 #include "chrome/browser/extensions/updater/extension_downloader.h" | 5 #include "chrome/browser/extensions/updater/extension_downloader.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 173 } |
| 174 | 174 |
| 175 ExtensionDownloader::ExtensionFetch::~ExtensionFetch() {} | 175 ExtensionDownloader::ExtensionFetch::~ExtensionFetch() {} |
| 176 | 176 |
| 177 ExtensionDownloader::ExtensionDownloader( | 177 ExtensionDownloader::ExtensionDownloader( |
| 178 ExtensionDownloaderDelegate* delegate, | 178 ExtensionDownloaderDelegate* delegate, |
| 179 net::URLRequestContextGetter* request_context) | 179 net::URLRequestContextGetter* request_context) |
| 180 : OAuth2TokenService::Consumer(kTokenServiceConsumerId), | 180 : OAuth2TokenService::Consumer(kTokenServiceConsumerId), |
| 181 delegate_(delegate), | 181 delegate_(delegate), |
| 182 request_context_(request_context), | 182 request_context_(request_context), |
| 183 weak_ptr_factory_(this), | |
| 184 manifests_queue_(&kDefaultBackoffPolicy, | 183 manifests_queue_(&kDefaultBackoffPolicy, |
| 185 base::Bind(&ExtensionDownloader::CreateManifestFetcher, | 184 base::Bind(&ExtensionDownloader::CreateManifestFetcher, |
| 186 base::Unretained(this))), | 185 base::Unretained(this))), |
| 187 extensions_queue_(&kDefaultBackoffPolicy, | 186 extensions_queue_(&kDefaultBackoffPolicy, |
| 188 base::Bind(&ExtensionDownloader::CreateExtensionFetcher, | 187 base::Bind(&ExtensionDownloader::CreateExtensionFetcher, |
| 189 base::Unretained(this))), | 188 base::Unretained(this))), |
| 190 extension_cache_(NULL) { | 189 extension_cache_(NULL), |
| 190 weak_ptr_factory_(this) { |
| 191 DCHECK(delegate_); | 191 DCHECK(delegate_); |
| 192 DCHECK(request_context_.get()); | 192 DCHECK(request_context_.get()); |
| 193 } | 193 } |
| 194 | 194 |
| 195 ExtensionDownloader::~ExtensionDownloader() {} | 195 ExtensionDownloader::~ExtensionDownloader() {} |
| 196 | 196 |
| 197 bool ExtensionDownloader::AddExtension(const Extension& extension, | 197 bool ExtensionDownloader::AddExtension(const Extension& extension, |
| 198 int request_id) { | 198 int request_id) { |
| 199 // Skip extensions with empty update URLs converted from user | 199 // Skip extensions with empty update URLs converted from user |
| 200 // scripts. | 200 // scripts. |
| (...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 | 942 |
| 943 void ExtensionDownloader::OnGetTokenFailure( | 943 void ExtensionDownloader::OnGetTokenFailure( |
| 944 const OAuth2TokenService::Request* request, | 944 const OAuth2TokenService::Request* request, |
| 945 const GoogleServiceAuthError& error) { | 945 const GoogleServiceAuthError& error) { |
| 946 // If we fail to get an access token, kick the pending fetch and let it fall | 946 // If we fail to get an access token, kick the pending fetch and let it fall |
| 947 // back on cookies. | 947 // back on cookies. |
| 948 extension_fetcher_->Start(); | 948 extension_fetcher_->Start(); |
| 949 } | 949 } |
| 950 | 950 |
| 951 } // namespace extensions | 951 } // namespace extensions |
| OLD | NEW |