Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: extensions/browser/updater/extension_downloader.cc

Issue 1117703002: Adjust URLFetcher::Create API so that object is returned as scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unneeded Pass() calls Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 void ExtensionDownloader::CreateManifestFetcher() { 466 void ExtensionDownloader::CreateManifestFetcher() {
467 if (VLOG_IS_ON(2)) { 467 if (VLOG_IS_ON(2)) {
468 std::vector<std::string> id_vector( 468 std::vector<std::string> id_vector(
469 manifests_queue_.active_request()->extension_ids().begin(), 469 manifests_queue_.active_request()->extension_ids().begin(),
470 manifests_queue_.active_request()->extension_ids().end()); 470 manifests_queue_.active_request()->extension_ids().end());
471 std::string id_list = JoinString(id_vector, ','); 471 std::string id_list = JoinString(id_vector, ',');
472 VLOG(2) << "Fetching " << manifests_queue_.active_request()->full_url() 472 VLOG(2) << "Fetching " << manifests_queue_.active_request()->full_url()
473 << " for " << id_list; 473 << " for " << id_list;
474 } 474 }
475 475
476 manifest_fetcher_.reset( 476 manifest_fetcher_ = net::URLFetcher::Create(
477 net::URLFetcher::Create(kManifestFetcherId, 477 kManifestFetcherId, manifests_queue_.active_request()->full_url(),
478 manifests_queue_.active_request()->full_url(), 478 net::URLFetcher::GET, this);
479 net::URLFetcher::GET,
480 this));
481 manifest_fetcher_->SetRequestContext(request_context_.get()); 479 manifest_fetcher_->SetRequestContext(request_context_.get());
482 manifest_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | 480 manifest_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
483 net::LOAD_DO_NOT_SAVE_COOKIES | 481 net::LOAD_DO_NOT_SAVE_COOKIES |
484 net::LOAD_DISABLE_CACHE); 482 net::LOAD_DISABLE_CACHE);
485 // Update checks can be interrupted if a network change is detected; this is 483 // Update checks can be interrupted if a network change is detected; this is
486 // common for the retail mode AppPack on ChromeOS. Retrying once should be 484 // common for the retail mode AppPack on ChromeOS. Retrying once should be
487 // enough to recover in those cases; let the fetcher retry up to 3 times 485 // enough to recover in those cases; let the fetcher retry up to 3 times
488 // just in case. http://crosbug.com/130602 486 // just in case. http://crosbug.com/130602
489 manifest_fetcher_->SetAutomaticallyRetryOnNetworkChanges(3); 487 manifest_fetcher_->SetAutomaticallyRetryOnNetworkChanges(3);
490 manifest_fetcher_->Start(); 488 manifest_fetcher_->Start();
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 bool should_download) { 753 bool should_download) {
756 ping_results_.erase(fetch_data->id); 754 ping_results_.erase(fetch_data->id);
757 if (should_download) { 755 if (should_download) {
758 // Resume download from cached manifest data. 756 // Resume download from cached manifest data.
759 extensions_queue_.ScheduleRequest(fetch_data.Pass()); 757 extensions_queue_.ScheduleRequest(fetch_data.Pass());
760 } 758 }
761 } 759 }
762 760
763 void ExtensionDownloader::CreateExtensionFetcher() { 761 void ExtensionDownloader::CreateExtensionFetcher() {
764 const ExtensionFetch* fetch = extensions_queue_.active_request(); 762 const ExtensionFetch* fetch = extensions_queue_.active_request();
765 extension_fetcher_.reset(net::URLFetcher::Create( 763 extension_fetcher_ = net::URLFetcher::Create(kExtensionFetcherId, fetch->url,
766 kExtensionFetcherId, fetch->url, net::URLFetcher::GET, this)); 764 net::URLFetcher::GET, this);
767 extension_fetcher_->SetRequestContext(request_context_.get()); 765 extension_fetcher_->SetRequestContext(request_context_.get());
768 extension_fetcher_->SetAutomaticallyRetryOnNetworkChanges(3); 766 extension_fetcher_->SetAutomaticallyRetryOnNetworkChanges(3);
769 767
770 int load_flags = net::LOAD_DISABLE_CACHE; 768 int load_flags = net::LOAD_DISABLE_CACHE;
771 bool is_secure = fetch->url.SchemeIsSecure(); 769 bool is_secure = fetch->url.SchemeIsSecure();
772 if (fetch->credentials != ExtensionFetch::CREDENTIALS_COOKIES || !is_secure) { 770 if (fetch->credentials != ExtensionFetch::CREDENTIALS_COOKIES || !is_secure) {
773 load_flags |= net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES; 771 load_flags |= net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES;
774 } 772 }
775 extension_fetcher_->SetLoadFlags(load_flags); 773 extension_fetcher_->SetLoadFlags(load_flags);
776 774
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 const GURL& update_url, 968 const GURL& update_url,
971 int request_id) { 969 int request_id) {
972 ManifestFetchData::PingMode ping_mode = ManifestFetchData::NO_PING; 970 ManifestFetchData::PingMode ping_mode = ManifestFetchData::NO_PING;
973 if (update_url.DomainIs(ping_enabled_domain_.c_str())) 971 if (update_url.DomainIs(ping_enabled_domain_.c_str()))
974 ping_mode = ManifestFetchData::PING_WITH_ENABLED_STATE; 972 ping_mode = ManifestFetchData::PING_WITH_ENABLED_STATE;
975 return new ManifestFetchData( 973 return new ManifestFetchData(
976 update_url, request_id, brand_code_, manifest_query_params_, ping_mode); 974 update_url, request_id, brand_code_, manifest_query_params_, ping_mode);
977 } 975 }
978 976
979 } // namespace extensions 977 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698