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 |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 : kUpdateInteractivityBackground); | 482 : kUpdateInteractivityBackground); |
483 | 483 |
484 manifest_fetcher_ = | 484 manifest_fetcher_ = |
485 net::URLFetcher::Create(kManifestFetcherId, active_request->full_url(), | 485 net::URLFetcher::Create(kManifestFetcherId, active_request->full_url(), |
486 net::URLFetcher::GET, this); | 486 net::URLFetcher::GET, this); |
487 manifest_fetcher_->SetRequestContext(request_context_.get()); | 487 manifest_fetcher_->SetRequestContext(request_context_.get()); |
488 manifest_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | | 488 manifest_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |
489 net::LOAD_DO_NOT_SAVE_COOKIES | | 489 net::LOAD_DO_NOT_SAVE_COOKIES | |
490 net::LOAD_DISABLE_CACHE); | 490 net::LOAD_DISABLE_CACHE); |
491 | 491 |
492 // Send traffic-management headers. | 492 // Send traffic-management headers to the webstore. |
493 // https://bugs.chromium.org/p/chromium/issues/detail?id=647516 | 493 // https://bugs.chromium.org/p/chromium/issues/detail?id=647516 |
494 manifest_fetcher_->AddExtraRequestHeader(base::StringPrintf( | 494 if (extension_urls::IsWebstoreUpdateUrl(active_request->full_url())) { |
495 "%s: %s", kUpdateInteractivityHeader, | 495 manifest_fetcher_->AddExtraRequestHeader(base::StringPrintf( |
496 active_request->foreground_check() ? kUpdateInteractivityForeground | 496 "%s: %s", kUpdateInteractivityHeader, |
497 : kUpdateInteractivityBackground)); | 497 active_request->foreground_check() ? kUpdateInteractivityForeground |
498 manifest_fetcher_->AddExtraRequestHeader( | 498 : kUpdateInteractivityBackground)); |
499 base::StringPrintf("%s: %s", kUpdateAppIdHeader, id_list.c_str())); | 499 manifest_fetcher_->AddExtraRequestHeader( |
500 manifest_fetcher_->AddExtraRequestHeader(base::StringPrintf( | 500 base::StringPrintf("%s: %s", kUpdateAppIdHeader, id_list.c_str())); |
501 "%s: %s-%s", kUpdateUpdaterHeader, | 501 manifest_fetcher_->AddExtraRequestHeader(base::StringPrintf( |
502 UpdateQueryParams::GetProdIdString(UpdateQueryParams::CRX), | 502 "%s: %s-%s", kUpdateUpdaterHeader, |
503 UpdateQueryParams::GetProdVersion().c_str())); | 503 UpdateQueryParams::GetProdIdString(UpdateQueryParams::CRX), |
| 504 UpdateQueryParams::GetProdVersion().c_str())); |
| 505 } |
504 | 506 |
505 // Update checks can be interrupted if a network change is detected; this is | 507 // Update checks can be interrupted if a network change is detected; this is |
506 // common for the retail mode AppPack on ChromeOS. Retrying once should be | 508 // common for the retail mode AppPack on ChromeOS. Retrying once should be |
507 // enough to recover in those cases; let the fetcher retry up to 3 times | 509 // enough to recover in those cases; let the fetcher retry up to 3 times |
508 // just in case. http://crosbug.com/130602 | 510 // just in case. http://crosbug.com/130602 |
509 manifest_fetcher_->SetAutomaticallyRetryOnNetworkChanges(3); | 511 manifest_fetcher_->SetAutomaticallyRetryOnNetworkChanges(3); |
510 manifest_fetcher_->Start(); | 512 manifest_fetcher_->Start(); |
511 } | 513 } |
512 | 514 |
513 void ExtensionDownloader::OnURLFetchComplete(const net::URLFetcher* source) { | 515 void ExtensionDownloader::OnURLFetchComplete(const net::URLFetcher* source) { |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 ManifestFetchData::FetchPriority fetch_priority) { | 990 ManifestFetchData::FetchPriority fetch_priority) { |
989 ManifestFetchData::PingMode ping_mode = ManifestFetchData::NO_PING; | 991 ManifestFetchData::PingMode ping_mode = ManifestFetchData::NO_PING; |
990 if (update_url.DomainIs(ping_enabled_domain_.c_str())) | 992 if (update_url.DomainIs(ping_enabled_domain_.c_str())) |
991 ping_mode = ManifestFetchData::PING_WITH_ENABLED_STATE; | 993 ping_mode = ManifestFetchData::PING_WITH_ENABLED_STATE; |
992 return new ManifestFetchData(update_url, request_id, brand_code_, | 994 return new ManifestFetchData(update_url, request_id, brand_code_, |
993 manifest_query_params_, ping_mode, | 995 manifest_query_params_, ping_mode, |
994 fetch_priority); | 996 fetch_priority); |
995 } | 997 } |
996 | 998 |
997 } // namespace extensions | 999 } // namespace extensions |
OLD | NEW |