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

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

Issue 192283002: Revert 255858 "Simplify the user agent code some more since afte..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: 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() : std::string()); 273 http_user_agent_settings_->GetUserAgent(request_->url()) :
274 std::string());
274 275
275 AddExtraHeaders(); 276 AddExtraHeaders();
276 AddCookieHeaderAndStart(); 277 AddCookieHeaderAndStart();
277 } 278 }
278 279
279 void URLRequestHttpJob::Kill() { 280 void URLRequestHttpJob::Kill() {
280 if (!transaction_.get()) 281 if (!transaction_.get())
281 return; 282 return;
282 283
283 weak_factory_.InvalidateWeakPtrs(); 284 weak_factory_.InvalidateWeakPtrs();
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 return override_response_headers_.get() ? 1466 return override_response_headers_.get() ?
1466 override_response_headers_.get() : 1467 override_response_headers_.get() :
1467 transaction_->GetResponseInfo()->headers.get(); 1468 transaction_->GetResponseInfo()->headers.get();
1468 } 1469 }
1469 1470
1470 void URLRequestHttpJob::NotifyURLRequestDestroyed() { 1471 void URLRequestHttpJob::NotifyURLRequestDestroyed() {
1471 awaiting_callback_ = false; 1472 awaiting_callback_ = false;
1472 } 1473 }
1473 1474
1474 } // namespace net 1475 } // namespace net
OLDNEW
« no previous file with comments | « trunk/src/net/url_request/static_http_user_agent_settings.cc ('k') | trunk/src/net/url_request/url_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698