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

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

Issue 215023002: Rename PrivateMode enum values: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 8 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
« no previous file with comments | « net/tools/quic/test_tools/quic_test_client.cc ('k') | net/websockets/websocket_job.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 (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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 request_info_.load_flags = request_->load_flags(); 255 request_info_.load_flags = request_->load_flags();
256 // Enable privacy mode if cookie settings or flags tell us not send or 256 // Enable privacy mode if cookie settings or flags tell us not send or
257 // save cookies. 257 // save cookies.
258 bool enable_privacy_mode = 258 bool enable_privacy_mode =
259 (request_info_.load_flags & LOAD_DO_NOT_SEND_COOKIES) || 259 (request_info_.load_flags & LOAD_DO_NOT_SEND_COOKIES) ||
260 (request_info_.load_flags & LOAD_DO_NOT_SAVE_COOKIES) || 260 (request_info_.load_flags & LOAD_DO_NOT_SAVE_COOKIES) ||
261 CanEnablePrivacyMode(); 261 CanEnablePrivacyMode();
262 // Privacy mode could still be disabled in OnCookiesLoaded if we are going 262 // Privacy mode could still be disabled in OnCookiesLoaded if we are going
263 // to send previously saved cookies. 263 // to send previously saved cookies.
264 request_info_.privacy_mode = enable_privacy_mode ? 264 request_info_.privacy_mode = enable_privacy_mode ?
265 kPrivacyModeEnabled : kPrivacyModeDisabled; 265 PRIVACY_MODE_ENABLED : PRIVACY_MODE_DISABLED;
266 266
267 // Strip Referer from request_info_.extra_headers to prevent, e.g., plugins 267 // Strip Referer from request_info_.extra_headers to prevent, e.g., plugins
268 // from overriding headers that are controlled using other means. Otherwise a 268 // from overriding headers that are controlled using other means. Otherwise a
269 // plugin could set a referrer although sending the referrer is inhibited. 269 // plugin could set a referrer although sending the referrer is inhibited.
270 request_info_.extra_headers.RemoveHeader(HttpRequestHeaders::kReferer); 270 request_info_.extra_headers.RemoveHeader(HttpRequestHeaders::kReferer);
271 271
272 // Our consumer should have made sure that this is a safe referrer. See for 272 // Our consumer should have made sure that this is a safe referrer. See for
273 // instance WebCore::FrameLoader::HideReferrer. 273 // instance WebCore::FrameLoader::HideReferrer.
274 if (referrer.is_valid()) { 274 if (referrer.is_valid()) {
275 request_info_.extra_headers.SetHeader(HttpRequestHeaders::kReferer, 275 request_info_.extra_headers.SetHeader(HttpRequestHeaders::kReferer,
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 DoLoadCookies(); 574 DoLoadCookies();
575 else 575 else
576 DoStartTransaction(); 576 DoStartTransaction();
577 } 577 }
578 578
579 void URLRequestHttpJob::OnCookiesLoaded(const std::string& cookie_line) { 579 void URLRequestHttpJob::OnCookiesLoaded(const std::string& cookie_line) {
580 if (!cookie_line.empty()) { 580 if (!cookie_line.empty()) {
581 request_info_.extra_headers.SetHeader( 581 request_info_.extra_headers.SetHeader(
582 HttpRequestHeaders::kCookie, cookie_line); 582 HttpRequestHeaders::kCookie, cookie_line);
583 // Disable privacy mode as we are sending cookies anyway. 583 // Disable privacy mode as we are sending cookies anyway.
584 request_info_.privacy_mode = kPrivacyModeDisabled; 584 request_info_.privacy_mode = PRIVACY_MODE_DISABLED;
585 } 585 }
586 DoStartTransaction(); 586 DoStartTransaction();
587 } 587 }
588 588
589 void URLRequestHttpJob::DoStartTransaction() { 589 void URLRequestHttpJob::DoStartTransaction() {
590 // We may have been canceled while retrieving cookies. 590 // We may have been canceled while retrieving cookies.
591 if (GetStatus().is_success()) { 591 if (GetStatus().is_success()) {
592 StartTransaction(); 592 StartTransaction();
593 } else { 593 } else {
594 NotifyCanceled(); 594 NotifyCanceled();
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after
1498 return override_response_headers_.get() ? 1498 return override_response_headers_.get() ?
1499 override_response_headers_.get() : 1499 override_response_headers_.get() :
1500 transaction_->GetResponseInfo()->headers.get(); 1500 transaction_->GetResponseInfo()->headers.get();
1501 } 1501 }
1502 1502
1503 void URLRequestHttpJob::NotifyURLRequestDestroyed() { 1503 void URLRequestHttpJob::NotifyURLRequestDestroyed() {
1504 awaiting_callback_ = false; 1504 awaiting_callback_ = false;
1505 } 1505 }
1506 1506
1507 } // namespace net 1507 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/test_tools/quic_test_client.cc ('k') | net/websockets/websocket_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698