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

Side by Side Diff: chrome/browser/profile_resetter/brandcode_config_fetcher.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
« no previous file with comments | « chrome/browser/net/sdch_browsertest.cc ('k') | chrome/browser/profiles/profile_downloader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/profile_resetter/brandcode_config_fetcher.h" 5 #include "chrome/browser/profile_resetter/brandcode_config_fetcher.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/profile_resetter/brandcoded_default_settings.h" 9 #include "chrome/browser/profile_resetter/brandcoded_default_settings.h"
10 #include "libxml/parser.h" 10 #include "libxml/parser.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 std::equal(elements_.begin(), elements_.end(), data_path); 135 std::equal(elements_.begin(), elements_.end(), data_path);
136 } 136 }
137 137
138 } // namespace 138 } // namespace
139 139
140 BrandcodeConfigFetcher::BrandcodeConfigFetcher(const FetchCallback& callback, 140 BrandcodeConfigFetcher::BrandcodeConfigFetcher(const FetchCallback& callback,
141 const GURL& url, 141 const GURL& url,
142 const std::string& brandcode) 142 const std::string& brandcode)
143 : fetch_callback_(callback) { 143 : fetch_callback_(callback) {
144 DCHECK(!brandcode.empty()); 144 DCHECK(!brandcode.empty());
145 config_fetcher_.reset(net::URLFetcher::Create(0 /* ID used for testing */, 145 config_fetcher_ = net::URLFetcher::Create(0 /* ID used for testing */, url,
146 url, 146 net::URLFetcher::POST, this);
147 net::URLFetcher::POST,
148 this));
149 config_fetcher_->SetRequestContext( 147 config_fetcher_->SetRequestContext(
150 g_browser_process->system_request_context()); 148 g_browser_process->system_request_context());
151 config_fetcher_->SetUploadData("text/xml", GetUploadData(brandcode)); 149 config_fetcher_->SetUploadData("text/xml", GetUploadData(brandcode));
152 config_fetcher_->AddExtraRequestHeader("Accept: text/xml"); 150 config_fetcher_->AddExtraRequestHeader("Accept: text/xml");
153 config_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | 151 config_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
154 net::LOAD_DO_NOT_SAVE_COOKIES | 152 net::LOAD_DO_NOT_SAVE_COOKIES |
155 net::LOAD_DISABLE_CACHE); 153 net::LOAD_DISABLE_CACHE);
156 config_fetcher_->Start(); 154 config_fetcher_->Start();
157 // Abort the download attempt if it takes too long. 155 // Abort the download attempt if it takes too long.
158 download_timer_.Start(FROM_HERE, 156 download_timer_.Start(FROM_HERE,
(...skipping 29 matching lines...) Expand all
188 download_timer_.Stop(); 186 download_timer_.Stop();
189 fetch_callback_.Run(); 187 fetch_callback_.Run();
190 } 188 }
191 189
192 void BrandcodeConfigFetcher::OnDownloadTimeout() { 190 void BrandcodeConfigFetcher::OnDownloadTimeout() {
193 if (config_fetcher_) { 191 if (config_fetcher_) {
194 config_fetcher_.reset(); 192 config_fetcher_.reset();
195 fetch_callback_.Run(); 193 fetch_callback_.Run();
196 } 194 }
197 } 195 }
OLDNEW
« no previous file with comments | « chrome/browser/net/sdch_browsertest.cc ('k') | chrome/browser/profiles/profile_downloader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698