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

Unified Diff: net/url_request/url_fetcher_core.cc

Issue 2480203002: ui: Cleanup class/struct forward declarations (Closed)
Patch Set: Sync CL to position 430550 Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/url_request/url_fetcher_core.h ('k') | net/url_request/url_fetcher_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_fetcher_core.cc
diff --git a/net/url_request/url_fetcher_core.cc b/net/url_request/url_fetcher_core.cc
index 2337cb5b4256703b7d7a6abf489151561e6da8ed..e5ae45dc258f04c7045a34c0be2f49db810d6490 100644
--- a/net/url_request/url_fetcher_core.cc
+++ b/net/url_request/url_fetcher_core.cc
@@ -31,6 +31,7 @@
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_getter.h"
#include "net/url_request/url_request_throttler_manager.h"
+#include "url/origin.h"
namespace {
@@ -246,8 +247,9 @@ void URLFetcherCore::SetRequestContext(
request_context_getter_ = request_context_getter;
}
-void URLFetcherCore::SetInitiatorURL(const GURL& initiator) {
- DCHECK(initiator_.is_empty());
+void URLFetcherCore::SetInitiator(
+ const base::Optional<url::Origin>& initiator) {
+ DCHECK(!initiator_.has_value());
initiator_ = initiator;
}
@@ -559,10 +561,11 @@ void URLFetcherCore::StartURLRequest() {
request_->SetLoadFlags(flags);
request_->SetReferrer(referrer_);
request_->set_referrer_policy(referrer_policy_);
- request_->set_first_party_for_cookies(initiator_.is_empty() ? original_url_
- : initiator_);
- request_->set_initiator(initiator_.is_empty() ? url::Origin(original_url_)
- : url::Origin(initiator_));
+ request_->set_first_party_for_cookies(initiator_.has_value() &&
+ !initiator_.value().unique()
+ ? initiator_.value().GetURL()
+ : original_url_);
+ request_->set_initiator(initiator_);
if (url_request_data_key_ && !url_request_create_data_callback_.is_null()) {
request_->SetUserData(url_request_data_key_,
url_request_create_data_callback_.Run());
@@ -699,7 +702,7 @@ void URLFetcherCore::CancelURLRequest(int error) {
// delete the object, but we cannot delay the destruction of the request
// context.
request_context_getter_ = NULL;
- initiator_ = GURL();
+ initiator_.reset();
url_request_data_key_ = NULL;
url_request_create_data_callback_.Reset();
was_cancelled_ = true;
@@ -790,7 +793,7 @@ void URLFetcherCore::RetryOrCompleteUrlFetch() {
}
request_context_getter_ = NULL;
- initiator_ = GURL();
+ initiator_.reset();
url_request_data_key_ = NULL;
url_request_create_data_callback_.Reset();
bool posted = delegate_task_runner_->PostTask(
« no previous file with comments | « net/url_request/url_fetcher_core.h ('k') | net/url_request/url_fetcher_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698