Chromium Code Reviews| 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 "extensions/browser/updater/extension_downloader.h" | 5 #include "extensions/browser/updater/extension_downloader.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/location.h" | 14 #include "base/location.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
| 17 #include "base/metrics/histogram_macros.h" | 17 #include "base/metrics/histogram_macros.h" |
| 18 #include "base/stl_util.h" | 18 #include "base/stl_util.h" |
| 19 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
| 20 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
| 21 #include "base/strings/stringprintf.h" | 21 #include "base/strings/stringprintf.h" |
| 22 #include "base/time/time.h" | 22 #include "base/time/time.h" |
| 23 #include "base/version.h" | 23 #include "base/version.h" |
| 24 #include "components/update_client/update_query_params.h" | |
| 24 #include "content/public/browser/browser_thread.h" | 25 #include "content/public/browser/browser_thread.h" |
| 25 #include "content/public/browser/notification_details.h" | 26 #include "content/public/browser/notification_details.h" |
| 26 #include "content/public/browser/notification_service.h" | 27 #include "content/public/browser/notification_service.h" |
| 27 #include "extensions/browser/extensions_browser_client.h" | 28 #include "extensions/browser/extensions_browser_client.h" |
| 28 #include "extensions/browser/notification_types.h" | 29 #include "extensions/browser/notification_types.h" |
| 29 #include "extensions/browser/updater/extension_cache.h" | 30 #include "extensions/browser/updater/extension_cache.h" |
| 30 #include "extensions/browser/updater/extension_downloader_test_delegate.h" | 31 #include "extensions/browser/updater/extension_downloader_test_delegate.h" |
| 31 #include "extensions/browser/updater/request_queue_impl.h" | 32 #include "extensions/browser/updater/request_queue_impl.h" |
| 32 #include "extensions/browser/updater/safe_manifest_parser.h" | 33 #include "extensions/browser/updater/safe_manifest_parser.h" |
| 33 #include "extensions/common/extension_urls.h" | 34 #include "extensions/common/extension_urls.h" |
| 34 #include "extensions/common/manifest_url_handlers.h" | 35 #include "extensions/common/manifest_url_handlers.h" |
| 35 #include "google_apis/gaia/identity_provider.h" | 36 #include "google_apis/gaia/identity_provider.h" |
| 36 #include "net/base/backoff_entry.h" | 37 #include "net/base/backoff_entry.h" |
| 37 #include "net/base/load_flags.h" | 38 #include "net/base/load_flags.h" |
| 38 #include "net/base/net_errors.h" | 39 #include "net/base/net_errors.h" |
| 39 #include "net/http/http_request_headers.h" | 40 #include "net/http/http_request_headers.h" |
| 40 #include "net/http/http_status_code.h" | 41 #include "net/http/http_status_code.h" |
| 41 #include "net/url_request/url_fetcher.h" | 42 #include "net/url_request/url_fetcher.h" |
| 42 #include "net/url_request/url_request_context_getter.h" | 43 #include "net/url_request/url_request_context_getter.h" |
| 43 #include "net/url_request/url_request_status.h" | 44 #include "net/url_request/url_request_status.h" |
| 44 | 45 |
| 45 using base::Time; | 46 using base::Time; |
| 46 using base::TimeDelta; | 47 using base::TimeDelta; |
| 47 using content::BrowserThread; | 48 using content::BrowserThread; |
| 49 using update_client::UpdateQueryParams; | |
| 48 | 50 |
| 49 namespace extensions { | 51 namespace extensions { |
| 50 | 52 |
| 51 const char ExtensionDownloader::kBlacklistAppID[] = "com.google.crx.blacklist"; | 53 const char ExtensionDownloader::kBlacklistAppID[] = "com.google.crx.blacklist"; |
| 52 | 54 |
| 53 namespace { | 55 namespace { |
| 54 | 56 |
| 55 const net::BackoffEntry::Policy kDefaultBackoffPolicy = { | 57 const net::BackoffEntry::Policy kDefaultBackoffPolicy = { |
| 56 // Number of initial errors (in sequence) to ignore before applying | 58 // Number of initial errors (in sequence) to ignore before applying |
| 57 // exponential back-off rules. | 59 // exponential back-off rules. |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 std::string new_query_string = base::JoinString(new_query_parts, "&"); | 147 std::string new_query_string = base::JoinString(new_query_parts, "&"); |
| 146 url::Component new_query(0, new_query_string.size()); | 148 url::Component new_query(0, new_query_string.size()); |
| 147 url::Replacements<char> replacements; | 149 url::Replacements<char> replacements; |
| 148 replacements.SetQuery(new_query_string.c_str(), new_query); | 150 replacements.SetQuery(new_query_string.c_str(), new_query); |
| 149 *url = url->ReplaceComponents(replacements); | 151 *url = url->ReplaceComponents(replacements); |
| 150 return true; | 152 return true; |
| 151 } | 153 } |
| 152 | 154 |
| 153 } // namespace | 155 } // namespace |
| 154 | 156 |
| 157 const char ExtensionDownloader::kUpdateInteractivityHeader[] = | |
| 158 "X-GoogleUpdate-Interactivity"; | |
| 159 const char ExtensionDownloader::kUpdateAppIdHeader[] = "X-GoogleUpdate-AppId"; | |
| 160 const char ExtensionDownloader::kUpdateUpdaterHeader[] = | |
| 161 "X-GoogleUpdate-Updater"; | |
| 162 | |
| 163 const char ExtensionDownloader::kUpdateInteractivityForeground[] = "fg"; | |
| 164 const char ExtensionDownloader::kUpdateInteractivityBackground[] = "bg"; | |
| 165 | |
| 155 UpdateDetails::UpdateDetails(const std::string& id, | 166 UpdateDetails::UpdateDetails(const std::string& id, |
| 156 const base::Version& version) | 167 const base::Version& version) |
| 157 : id(id), version(version) {} | 168 : id(id), version(version) {} |
| 158 | 169 |
| 159 UpdateDetails::~UpdateDetails() { | 170 UpdateDetails::~UpdateDetails() { |
| 160 } | 171 } |
| 161 | 172 |
| 162 ExtensionDownloader::ExtensionFetch::ExtensionFetch() | 173 ExtensionDownloader::ExtensionFetch::ExtensionFetch() |
| 163 : url(), credentials(CREDENTIALS_NONE) { | 174 : url(), credentials(CREDENTIALS_NONE) { |
| 164 } | 175 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 197 base::Unretained(this))), | 208 base::Unretained(this))), |
| 198 extension_cache_(NULL), | 209 extension_cache_(NULL), |
| 199 weak_ptr_factory_(this) { | 210 weak_ptr_factory_(this) { |
| 200 DCHECK(delegate_); | 211 DCHECK(delegate_); |
| 201 DCHECK(request_context_.get()); | 212 DCHECK(request_context_.get()); |
| 202 } | 213 } |
| 203 | 214 |
| 204 ExtensionDownloader::~ExtensionDownloader() { | 215 ExtensionDownloader::~ExtensionDownloader() { |
| 205 } | 216 } |
| 206 | 217 |
| 207 bool ExtensionDownloader::AddExtension(const Extension& extension, | 218 bool ExtensionDownloader::AddExtension( |
| 208 int request_id) { | 219 const Extension& extension, |
| 220 int request_id, | |
| 221 ManifestFetchData::FetchPriority fetch_priority) { | |
| 209 // Skip extensions with empty update URLs converted from user | 222 // Skip extensions with empty update URLs converted from user |
| 210 // scripts. | 223 // scripts. |
| 211 if (extension.converted_from_user_script() && | 224 if (extension.converted_from_user_script() && |
| 212 ManifestURL::GetUpdateURL(&extension).is_empty()) { | 225 ManifestURL::GetUpdateURL(&extension).is_empty()) { |
| 213 return false; | 226 return false; |
| 214 } | 227 } |
| 215 | 228 |
| 216 ExtraParams extra; | 229 ExtraParams extra; |
| 217 | 230 |
| 218 // If the extension updates itself from the gallery, ignore any update URL | 231 // If the extension updates itself from the gallery, ignore any update URL |
| 219 // data. At the moment there is no extra data that an extension can | 232 // data. At the moment there is no extra data that an extension can |
| 220 // communicate to the the gallery update servers. | 233 // communicate to the the gallery update servers. |
| 221 std::string update_url_data; | 234 std::string update_url_data; |
| 222 if (!ManifestURL::UpdatesFromGallery(&extension)) | 235 if (!ManifestURL::UpdatesFromGallery(&extension)) |
| 223 extra.update_url_data = delegate_->GetUpdateUrlData(extension.id()); | 236 extra.update_url_data = delegate_->GetUpdateUrlData(extension.id()); |
| 224 | 237 |
| 225 return AddExtensionData( | 238 return AddExtensionData( |
| 226 extension.id(), *extension.version(), extension.GetType(), | 239 extension.id(), *extension.version(), extension.GetType(), |
| 227 ManifestURL::GetUpdateURL(&extension), extra, request_id); | 240 ManifestURL::GetUpdateURL(&extension), extra, request_id, fetch_priority); |
| 228 } | 241 } |
| 229 | 242 |
| 230 bool ExtensionDownloader::AddPendingExtension(const std::string& id, | 243 bool ExtensionDownloader::AddPendingExtension( |
| 231 const GURL& update_url, | 244 const std::string& id, |
| 232 bool is_corrupt_reinstall, | 245 const GURL& update_url, |
| 233 int request_id) { | 246 bool is_corrupt_reinstall, |
| 247 int request_id, | |
| 248 ManifestFetchData::FetchPriority fetch_priority) { | |
| 234 // Use a zero version to ensure that a pending extension will always | 249 // Use a zero version to ensure that a pending extension will always |
| 235 // be updated, and thus installed (assuming all extensions have | 250 // be updated, and thus installed (assuming all extensions have |
| 236 // non-zero versions). | 251 // non-zero versions). |
| 237 base::Version version("0.0.0.0"); | 252 base::Version version("0.0.0.0"); |
| 238 DCHECK(version.IsValid()); | 253 DCHECK(version.IsValid()); |
| 239 ExtraParams extra; | 254 ExtraParams extra; |
| 240 if (is_corrupt_reinstall) | 255 if (is_corrupt_reinstall) |
| 241 extra.is_corrupt_reinstall = true; | 256 extra.is_corrupt_reinstall = true; |
| 242 | 257 |
| 243 return AddExtensionData(id, version, Manifest::TYPE_UNKNOWN, update_url, | 258 return AddExtensionData(id, version, Manifest::TYPE_UNKNOWN, update_url, |
| 244 extra, request_id); | 259 extra, request_id, fetch_priority); |
| 245 } | 260 } |
| 246 | 261 |
| 247 void ExtensionDownloader::StartAllPending(ExtensionCache* cache) { | 262 void ExtensionDownloader::StartAllPending(ExtensionCache* cache) { |
| 248 if (cache) { | 263 if (cache) { |
| 249 extension_cache_ = cache; | 264 extension_cache_ = cache; |
| 250 extension_cache_->Start(base::Bind(&ExtensionDownloader::DoStartAllPending, | 265 extension_cache_->Start(base::Bind(&ExtensionDownloader::DoStartAllPending, |
| 251 weak_ptr_factory_.GetWeakPtr())); | 266 weak_ptr_factory_.GetWeakPtr())); |
| 252 } else { | 267 } else { |
| 253 DoStartAllPending(); | 268 DoStartAllPending(); |
| 254 } | 269 } |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 268 fetches_preparing_.clear(); | 283 fetches_preparing_.clear(); |
| 269 } | 284 } |
| 270 | 285 |
| 271 void ExtensionDownloader::StartBlacklistUpdate( | 286 void ExtensionDownloader::StartBlacklistUpdate( |
| 272 const std::string& version, | 287 const std::string& version, |
| 273 const ManifestFetchData::PingData& ping_data, | 288 const ManifestFetchData::PingData& ping_data, |
| 274 int request_id) { | 289 int request_id) { |
| 275 // Note: it is very important that we use the https version of the update | 290 // Note: it is very important that we use the https version of the update |
| 276 // url here to avoid DNS hijacking of the blacklist, which is not validated | 291 // url here to avoid DNS hijacking of the blacklist, which is not validated |
| 277 // by a public key signature like .crx files are. | 292 // by a public key signature like .crx files are. |
| 278 std::unique_ptr<ManifestFetchData> blacklist_fetch(CreateManifestFetchData( | 293 std::unique_ptr<ManifestFetchData> blacklist_fetch( |
| 279 extension_urls::GetWebstoreUpdateUrl(), request_id)); | 294 CreateManifestFetchData(extension_urls::GetWebstoreUpdateUrl(), |
| 295 request_id, ManifestFetchData::BACKGROUND)); | |
| 280 DCHECK(blacklist_fetch->base_url().SchemeIsCryptographic()); | 296 DCHECK(blacklist_fetch->base_url().SchemeIsCryptographic()); |
| 281 blacklist_fetch->AddExtension(kBlacklistAppID, version, &ping_data, | 297 blacklist_fetch->AddExtension(kBlacklistAppID, version, &ping_data, |
| 282 std::string(), kDefaultInstallSource); | 298 std::string(), kDefaultInstallSource, |
| 299 ManifestFetchData::FetchPriority::BACKGROUND); | |
| 283 StartUpdateCheck(std::move(blacklist_fetch)); | 300 StartUpdateCheck(std::move(blacklist_fetch)); |
| 284 } | 301 } |
| 285 | 302 |
| 286 void ExtensionDownloader::SetWebstoreIdentityProvider( | 303 void ExtensionDownloader::SetWebstoreIdentityProvider( |
| 287 std::unique_ptr<IdentityProvider> identity_provider) { | 304 std::unique_ptr<IdentityProvider> identity_provider) { |
| 288 identity_provider_.swap(identity_provider); | 305 identity_provider_.swap(identity_provider); |
| 289 } | 306 } |
| 290 | 307 |
| 291 // static | 308 // static |
| 292 void ExtensionDownloader::set_test_delegate( | 309 void ExtensionDownloader::set_test_delegate( |
| 293 ExtensionDownloaderTestDelegate* delegate) { | 310 ExtensionDownloaderTestDelegate* delegate) { |
| 294 g_test_delegate = delegate; | 311 g_test_delegate = delegate; |
| 295 } | 312 } |
| 296 | 313 |
| 297 bool ExtensionDownloader::AddExtensionData(const std::string& id, | 314 bool ExtensionDownloader::AddExtensionData( |
| 298 const base::Version& version, | 315 const std::string& id, |
| 299 Manifest::Type extension_type, | 316 const base::Version& version, |
| 300 const GURL& extension_update_url, | 317 Manifest::Type extension_type, |
| 301 const ExtraParams& extra, | 318 const GURL& extension_update_url, |
| 302 int request_id) { | 319 const ExtraParams& extra, |
| 320 int request_id, | |
| 321 ManifestFetchData::FetchPriority fetch_priority) { | |
| 303 GURL update_url(extension_update_url); | 322 GURL update_url(extension_update_url); |
| 304 // Skip extensions with non-empty invalid update URLs. | 323 // Skip extensions with non-empty invalid update URLs. |
| 305 if (!update_url.is_empty() && !update_url.is_valid()) { | 324 if (!update_url.is_empty() && !update_url.is_valid()) { |
| 306 DLOG(WARNING) << "Extension " << id << " has invalid update url " | 325 DLOG(WARNING) << "Extension " << id << " has invalid update url " |
| 307 << update_url; | 326 << update_url; |
| 308 return false; | 327 return false; |
| 309 } | 328 } |
| 310 | 329 |
| 311 // Make sure we use SSL for store-hosted extensions. | 330 // Make sure we use SSL for store-hosted extensions. |
| 312 if (extension_urls::IsWebstoreUpdateUrl(update_url) && | 331 if (extension_urls::IsWebstoreUpdateUrl(update_url) && |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 367 // Find or create a ManifestFetchData to add this extension to. | 386 // Find or create a ManifestFetchData to add this extension to. |
| 368 bool added = false; | 387 bool added = false; |
| 369 FetchMap::iterator existing_iter = | 388 FetchMap::iterator existing_iter = |
| 370 fetches_preparing_.find(std::make_pair(request_id, update_url)); | 389 fetches_preparing_.find(std::make_pair(request_id, update_url)); |
| 371 if (existing_iter != fetches_preparing_.end() && | 390 if (existing_iter != fetches_preparing_.end() && |
| 372 !existing_iter->second.empty()) { | 391 !existing_iter->second.empty()) { |
| 373 // Try to add to the ManifestFetchData at the end of the list. | 392 // Try to add to the ManifestFetchData at the end of the list. |
| 374 ManifestFetchData* existing_fetch = existing_iter->second.back().get(); | 393 ManifestFetchData* existing_fetch = existing_iter->second.back().get(); |
| 375 if (existing_fetch->AddExtension(id, version.GetString(), | 394 if (existing_fetch->AddExtension(id, version.GetString(), |
| 376 optional_ping_data, extra.update_url_data, | 395 optional_ping_data, extra.update_url_data, |
| 377 install_source)) { | 396 install_source, fetch_priority)) { |
| 378 added = true; | 397 added = true; |
| 379 } | 398 } |
| 380 } | 399 } |
| 381 if (!added) { | 400 if (!added) { |
| 382 // Otherwise add a new element to the list, if the list doesn't exist or | 401 // Otherwise add a new element to the list, if the list doesn't exist or |
| 383 // if its last element is already full. | 402 // if its last element is already full. |
| 384 std::unique_ptr<ManifestFetchData> fetch( | 403 std::unique_ptr<ManifestFetchData> fetch( |
| 385 CreateManifestFetchData(update_url, request_id)); | 404 CreateManifestFetchData(update_url, request_id, fetch_priority)); |
| 386 ManifestFetchData* fetch_ptr = fetch.get(); | 405 ManifestFetchData* fetch_ptr = fetch.get(); |
| 387 fetches_preparing_[std::make_pair(request_id, update_url)].push_back( | 406 fetches_preparing_[std::make_pair(request_id, update_url)].push_back( |
| 388 std::move(fetch)); | 407 std::move(fetch)); |
| 389 added = fetch_ptr->AddExtension(id, version.GetString(), optional_ping_data, | 408 added = fetch_ptr->AddExtension(id, version.GetString(), optional_ping_data, |
| 390 extra.update_url_data, install_source); | 409 extra.update_url_data, install_source, |
| 410 fetch_priority); | |
| 391 DCHECK(added); | 411 DCHECK(added); |
| 392 } | 412 } |
| 393 | 413 |
| 394 return true; | 414 return true; |
| 395 } | 415 } |
| 396 | 416 |
| 397 void ExtensionDownloader::ReportStats() const { | 417 void ExtensionDownloader::ReportStats() const { |
| 398 UMA_HISTOGRAM_COUNTS_100("Extensions.UpdateCheckExtension", | 418 UMA_HISTOGRAM_COUNTS_100("Extensions.UpdateCheckExtension", |
| 399 url_stats_.extension_count); | 419 url_stats_.extension_count); |
| 400 UMA_HISTOGRAM_COUNTS_100("Extensions.UpdateCheckTheme", | 420 UMA_HISTOGRAM_COUNTS_100("Extensions.UpdateCheckTheme", |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 443 } else { | 463 } else { |
| 444 UMA_HISTOGRAM_COUNTS( | 464 UMA_HISTOGRAM_COUNTS( |
| 445 "Extensions.UpdateCheckUrlLength", | 465 "Extensions.UpdateCheckUrlLength", |
| 446 fetch_data->full_url().possibly_invalid_spec().length()); | 466 fetch_data->full_url().possibly_invalid_spec().length()); |
| 447 | 467 |
| 448 manifests_queue_.ScheduleRequest(std::move(fetch_data)); | 468 manifests_queue_.ScheduleRequest(std::move(fetch_data)); |
| 449 } | 469 } |
| 450 } | 470 } |
| 451 | 471 |
| 452 void ExtensionDownloader::CreateManifestFetcher() { | 472 void ExtensionDownloader::CreateManifestFetcher() { |
| 473 const ManifestFetchData* active_request = manifests_queue_.active_request(); | |
| 474 std::vector<base::StringPiece> id_vector( | |
| 475 active_request->extension_ids().begin(), | |
| 476 active_request->extension_ids().end()); | |
| 477 std::string id_list = base::JoinString(id_vector, ","); | |
| 453 if (VLOG_IS_ON(2)) { | 478 if (VLOG_IS_ON(2)) { |
|
Marijn Kruisselbrink
2017/03/30 21:50:45
nit: I don't think there is any reason anymore for
Minh X. Nguyen
2017/03/30 22:20:56
Done.
| |
| 454 std::vector<std::string> id_vector( | 479 VLOG(2) << "Fetching " << active_request->full_url() << " for " << id_list; |
| 455 manifests_queue_.active_request()->extension_ids().begin(), | 480 VLOG(2) << "Update interactivity: " |
| 456 manifests_queue_.active_request()->extension_ids().end()); | 481 << (active_request->foreground_check() |
| 457 std::string id_list = base::JoinString(id_vector, ","); | 482 ? kUpdateInteractivityForeground |
| 458 VLOG(2) << "Fetching " << manifests_queue_.active_request()->full_url() | 483 : kUpdateInteractivityBackground); |
| 459 << " for " << id_list; | |
| 460 } | 484 } |
| 461 | 485 |
| 462 manifest_fetcher_ = net::URLFetcher::Create( | 486 manifest_fetcher_ = |
| 463 kManifestFetcherId, manifests_queue_.active_request()->full_url(), | 487 net::URLFetcher::Create(kManifestFetcherId, active_request->full_url(), |
| 464 net::URLFetcher::GET, this); | 488 net::URLFetcher::GET, this); |
| 465 manifest_fetcher_->SetRequestContext(request_context_.get()); | 489 manifest_fetcher_->SetRequestContext(request_context_.get()); |
| 466 manifest_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | | 490 manifest_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |
| 467 net::LOAD_DO_NOT_SAVE_COOKIES | | 491 net::LOAD_DO_NOT_SAVE_COOKIES | |
| 468 net::LOAD_DISABLE_CACHE); | 492 net::LOAD_DISABLE_CACHE); |
| 493 | |
| 494 // Send traffic-management headers. http://crosbug.com/130602 | |
|
Marijn Kruisselbrink
2017/03/30 21:50:45
This URL results in a 404?
Minh X. Nguyen
2017/03/30 22:20:56
Done.
| |
| 495 manifest_fetcher_->AddExtraRequestHeader(base::StringPrintf( | |
| 496 "%s: %s", kUpdateInteractivityHeader, | |
| 497 active_request->foreground_check() ? kUpdateInteractivityForeground | |
| 498 : kUpdateInteractivityBackground)); | |
| 499 manifest_fetcher_->AddExtraRequestHeader( | |
| 500 base::StringPrintf("%s: %s", kUpdateAppIdHeader, id_list.c_str())); | |
| 501 manifest_fetcher_->AddExtraRequestHeader(base::StringPrintf( | |
| 502 "%s: %s-%s", kUpdateUpdaterHeader, | |
| 503 UpdateQueryParams::GetProdIdString(UpdateQueryParams::CRX), | |
| 504 UpdateQueryParams::GetProdVersion().c_str())); | |
| 505 | |
| 469 // Update checks can be interrupted if a network change is detected; this is | 506 // Update checks can be interrupted if a network change is detected; this is |
| 470 // common for the retail mode AppPack on ChromeOS. Retrying once should be | 507 // common for the retail mode AppPack on ChromeOS. Retrying once should be |
| 471 // enough to recover in those cases; let the fetcher retry up to 3 times | 508 // enough to recover in those cases; let the fetcher retry up to 3 times |
| 472 // just in case. http://crosbug.com/130602 | 509 // just in case. http://crosbug.com/130602 |
| 473 manifest_fetcher_->SetAutomaticallyRetryOnNetworkChanges(3); | 510 manifest_fetcher_->SetAutomaticallyRetryOnNetworkChanges(3); |
| 474 manifest_fetcher_->Start(); | 511 manifest_fetcher_->Start(); |
| 475 } | 512 } |
| 476 | 513 |
| 477 void ExtensionDownloader::OnURLFetchComplete(const net::URLFetcher* source) { | 514 void ExtensionDownloader::OnURLFetchComplete(const net::URLFetcher* source) { |
| 478 VLOG(2) << source->GetResponseCode() << " " << source->GetURL(); | 515 VLOG(2) << source->GetResponseCode() << " " << source->GetURL(); |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 943 void ExtensionDownloader::OnGetTokenFailure( | 980 void ExtensionDownloader::OnGetTokenFailure( |
| 944 const OAuth2TokenService::Request* request, | 981 const OAuth2TokenService::Request* request, |
| 945 const GoogleServiceAuthError& error) { | 982 const GoogleServiceAuthError& error) { |
| 946 // If we fail to get an access token, kick the pending fetch and let it fall | 983 // If we fail to get an access token, kick the pending fetch and let it fall |
| 947 // back on cookies. | 984 // back on cookies. |
| 948 extension_fetcher_->Start(); | 985 extension_fetcher_->Start(); |
| 949 } | 986 } |
| 950 | 987 |
| 951 ManifestFetchData* ExtensionDownloader::CreateManifestFetchData( | 988 ManifestFetchData* ExtensionDownloader::CreateManifestFetchData( |
| 952 const GURL& update_url, | 989 const GURL& update_url, |
| 953 int request_id) { | 990 int request_id, |
| 991 ManifestFetchData::FetchPriority fetch_priority) { | |
| 954 ManifestFetchData::PingMode ping_mode = ManifestFetchData::NO_PING; | 992 ManifestFetchData::PingMode ping_mode = ManifestFetchData::NO_PING; |
| 955 if (update_url.DomainIs(ping_enabled_domain_.c_str())) | 993 if (update_url.DomainIs(ping_enabled_domain_.c_str())) |
| 956 ping_mode = ManifestFetchData::PING_WITH_ENABLED_STATE; | 994 ping_mode = ManifestFetchData::PING_WITH_ENABLED_STATE; |
| 957 return new ManifestFetchData( | 995 return new ManifestFetchData(update_url, request_id, brand_code_, |
| 958 update_url, request_id, brand_code_, manifest_query_params_, ping_mode); | 996 manifest_query_params_, ping_mode, |
| 997 fetch_priority); | |
| 959 } | 998 } |
| 960 | 999 |
| 961 } // namespace extensions | 1000 } // namespace extensions |
| OLD | NEW |