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

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

Issue 2053693002: WIP: Move 'Upgrade-Insecure-Requests' to the browser process. Base URL: https://chromium.googlesource.com/chromium/src.git@replicate
Patch Set: Rebase. :( Created 3 years, 10 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 | « net/url_request/url_request.h ('k') | net/url_request/url_request_http_job.h » ('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.h" 5 #include "net/url_request/url_request.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 DCHECK(!is_pending_); 463 DCHECK(!is_pending_);
464 first_party_for_cookies_ = first_party_for_cookies; 464 first_party_for_cookies_ = first_party_for_cookies;
465 } 465 }
466 466
467 void URLRequest::set_first_party_url_policy( 467 void URLRequest::set_first_party_url_policy(
468 FirstPartyURLPolicy first_party_url_policy) { 468 FirstPartyURLPolicy first_party_url_policy) {
469 DCHECK(!is_pending_); 469 DCHECK(!is_pending_);
470 first_party_url_policy_ = first_party_url_policy; 470 first_party_url_policy_ = first_party_url_policy;
471 } 471 }
472 472
473 void URLRequest::set_insecure_request_policy(
474 InsecureRequestPolicy insecure_request_policy) {
475 DCHECK(!is_pending_);
476 DCHECK(insecure_request_policy == DO_NOT_UPGRADE_INSECURE_REQUESTS ||
477 url().SchemeIsCryptographic() ||
478 (insecure_request_policy == UPGRADE_SAME_HOST_INSECURE_REQUESTS &&
479 initiator() && initiator()->host() == url().host()));
480 insecure_request_policy_ = insecure_request_policy;
481 }
482
473 void URLRequest::set_initiator(const base::Optional<url::Origin>& initiator) { 483 void URLRequest::set_initiator(const base::Optional<url::Origin>& initiator) {
474 DCHECK(!is_pending_); 484 DCHECK(!is_pending_);
475 DCHECK(!initiator.has_value() || initiator.value().unique() || 485 DCHECK(!initiator.has_value() || initiator.value().unique() ||
476 initiator.value().GetURL().is_valid()); 486 initiator.value().GetURL().is_valid());
477 initiator_ = initiator; 487 initiator_ = initiator;
478 } 488 }
479 489
480 void URLRequest::set_method(const std::string& method) { 490 void URLRequest::set_method(const std::string& method) {
481 DCHECK(!is_pending_); 491 DCHECK(!is_pending_);
482 method_ = method; 492 method_ = method;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 NetworkDelegate* network_delegate) 569 NetworkDelegate* network_delegate)
560 : context_(context), 570 : context_(context),
561 network_delegate_(network_delegate ? network_delegate 571 network_delegate_(network_delegate ? network_delegate
562 : context->network_delegate()), 572 : context->network_delegate()),
563 net_log_(NetLogWithSource::Make(context->net_log(), 573 net_log_(NetLogWithSource::Make(context->net_log(),
564 NetLogSourceType::URL_REQUEST)), 574 NetLogSourceType::URL_REQUEST)),
565 url_chain_(1, url), 575 url_chain_(1, url),
566 method_("GET"), 576 method_("GET"),
567 referrer_policy_(CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE), 577 referrer_policy_(CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE),
568 first_party_url_policy_(NEVER_CHANGE_FIRST_PARTY_URL), 578 first_party_url_policy_(NEVER_CHANGE_FIRST_PARTY_URL),
579 insecure_request_policy_(DO_NOT_UPGRADE_INSECURE_REQUESTS),
569 load_flags_(LOAD_NORMAL), 580 load_flags_(LOAD_NORMAL),
570 delegate_(delegate), 581 delegate_(delegate),
571 status_(URLRequestStatus::FromError(OK)), 582 status_(URLRequestStatus::FromError(OK)),
572 is_pending_(false), 583 is_pending_(false),
573 is_redirecting_(false), 584 is_redirecting_(false),
574 redirect_limit_(kMaxRedirects), 585 redirect_limit_(kMaxRedirects),
575 priority_(priority), 586 priority_(priority),
576 identifier_(GenerateURLRequestIdentifier()), 587 identifier_(GenerateURLRequestIdentifier()),
577 calling_delegate_(false), 588 calling_delegate_(false),
578 use_blocked_by_as_load_param_(false), 589 use_blocked_by_as_load_param_(false),
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 out->clear(); 1227 out->clear();
1217 } 1228 }
1218 1229
1219 void URLRequest::set_status(URLRequestStatus status) { 1230 void URLRequest::set_status(URLRequestStatus status) {
1220 DCHECK(status_.is_io_pending() || status_.is_success() || 1231 DCHECK(status_.is_io_pending() || status_.is_success() ||
1221 (!status.is_success() && !status.is_io_pending())); 1232 (!status.is_success() && !status.is_io_pending()));
1222 status_ = status; 1233 status_ = status;
1223 } 1234 }
1224 1235
1225 } // namespace net 1236 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request.h ('k') | net/url_request/url_request_http_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698