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

Side by Side Diff: net/url_request/url_request_http_job.cc

Issue 191093002: Simplify the user agent code some more since after r255534 it's not affected by the site's URL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: patchset 15 which works Created 6 years, 9 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 | Annotate | Revision Log
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 "net/url_request/url_request_http_job.h" 5 #include "net/url_request/url_request_http_job.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 // Our consumer should have made sure that this is a safe referrer. See for 263 // Our consumer should have made sure that this is a safe referrer. See for
264 // instance WebCore::FrameLoader::HideReferrer. 264 // instance WebCore::FrameLoader::HideReferrer.
265 if (referrer.is_valid()) { 265 if (referrer.is_valid()) {
266 request_info_.extra_headers.SetHeader(HttpRequestHeaders::kReferer, 266 request_info_.extra_headers.SetHeader(HttpRequestHeaders::kReferer,
267 referrer.spec()); 267 referrer.spec());
268 } 268 }
269 269
270 request_info_.extra_headers.SetHeaderIfMissing( 270 request_info_.extra_headers.SetHeaderIfMissing(
271 HttpRequestHeaders::kUserAgent, 271 HttpRequestHeaders::kUserAgent,
272 http_user_agent_settings_ ? 272 http_user_agent_settings_ ?
273 http_user_agent_settings_->GetUserAgent(request_->url()) : 273 http_user_agent_settings_->GetUserAgent() : std::string());
274 std::string());
275 274
276 AddExtraHeaders(); 275 AddExtraHeaders();
277 AddCookieHeaderAndStart(); 276 AddCookieHeaderAndStart();
278 } 277 }
279 278
280 void URLRequestHttpJob::Kill() { 279 void URLRequestHttpJob::Kill() {
281 if (!transaction_.get()) 280 if (!transaction_.get())
282 return; 281 return;
283 282
284 weak_factory_.InvalidateWeakPtrs(); 283 weak_factory_.InvalidateWeakPtrs();
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1466 return override_response_headers_.get() ? 1465 return override_response_headers_.get() ?
1467 override_response_headers_.get() : 1466 override_response_headers_.get() :
1468 transaction_->GetResponseInfo()->headers.get(); 1467 transaction_->GetResponseInfo()->headers.get();
1469 } 1468 }
1470 1469
1471 void URLRequestHttpJob::NotifyURLRequestDestroyed() { 1470 void URLRequestHttpJob::NotifyURLRequestDestroyed() {
1472 awaiting_callback_ = false; 1471 awaiting_callback_ = false;
1473 } 1472 }
1474 1473
1475 } // namespace net 1474 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/static_http_user_agent_settings.cc ('k') | net/url_request/url_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698