diff options
-rw-r--r-- | net/url_request/test_url_fetcher_factory.cc | 4 | ||||
-rw-r--r-- | net/url_request/test_url_fetcher_factory.h | 2 | ||||
-rw-r--r-- | net/url_request/url_fetcher.h | 5 | ||||
-rw-r--r-- | net/url_request/url_fetcher_core.cc | 8 | ||||
-rw-r--r-- | net/url_request/url_fetcher_core.h | 2 | ||||
-rw-r--r-- | net/url_request/url_fetcher_impl.cc | 5 | ||||
-rw-r--r-- | net/url_request/url_fetcher_impl.h | 2 |
7 files changed, 28 insertions, 0 deletions
diff --git a/net/url_request/test_url_fetcher_factory.cc b/net/url_request/test_url_fetcher_factory.cc index 19a4f71..d6c6611 100644 --- a/net/url_request/test_url_fetcher_factory.cc +++ b/net/url_request/test_url_fetcher_factory.cc @@ -92,6 +92,10 @@ int TestURLFetcher::GetLoadFlags() const { void TestURLFetcher::SetReferrer(const std::string& referrer) { } +void TestURLFetcher::SetReferrerPolicy( + URLRequest::ReferrerPolicy referrer_policy) { +} + void TestURLFetcher::SetExtraRequestHeaders( const std::string& extra_request_headers) { fake_extra_request_headers_.Clear(); diff --git a/net/url_request/test_url_fetcher_factory.h b/net/url_request/test_url_fetcher_factory.h index 76283c1..f2139d9 100644 --- a/net/url_request/test_url_fetcher_factory.h +++ b/net/url_request/test_url_fetcher_factory.h @@ -104,6 +104,8 @@ class TestURLFetcher : public URLFetcher { virtual void SetLoadFlags(int load_flags) OVERRIDE; virtual int GetLoadFlags() const OVERRIDE; virtual void SetReferrer(const std::string& referrer) OVERRIDE; + virtual void SetReferrerPolicy( + URLRequest::ReferrerPolicy referrer_policy) OVERRIDE; virtual void SetExtraRequestHeaders( const std::string& extra_request_headers) OVERRIDE; virtual void AddExtraRequestHeader(const std::string& header_line) OVERRIDE; diff --git a/net/url_request/url_fetcher.h b/net/url_request/url_fetcher.h index da94e34..a841ddd 100644 --- a/net/url_request/url_fetcher.h +++ b/net/url_request/url_fetcher.h @@ -171,6 +171,11 @@ class NET_EXPORT URLFetcher { // started. virtual void SetReferrer(const std::string& referrer) = 0; + // The referrer policy to apply when updating the referrer during redirects. + // The referrer policy may only be changed before Start() is called. + virtual void SetReferrerPolicy( + URLRequest::ReferrerPolicy referrer_policy) = 0; + // Set extra headers on the request. Must be called before the request // is started. // This replaces the entire extra request headers. diff --git a/net/url_request/url_fetcher_core.cc b/net/url_request/url_fetcher_core.cc index b3f742f..eb45ecf 100644 --- a/net/url_request/url_fetcher_core.cc +++ b/net/url_request/url_fetcher_core.cc @@ -82,6 +82,8 @@ URLFetcherCore::URLFetcherCore(URLFetcher* fetcher, upload_content_set_(false), upload_range_offset_(0), upload_range_length_(0), + referrer_policy_( + URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE), is_chunked_upload_(false), was_cancelled_(false), stop_on_redirect_(false), @@ -204,6 +206,11 @@ void URLFetcherCore::SetReferrer(const std::string& referrer) { referrer_ = referrer; } +void URLFetcherCore::SetReferrerPolicy( + URLRequest::ReferrerPolicy referrer_policy) { + referrer_policy_ = referrer_policy; +} + void URLFetcherCore::SetExtraRequestHeaders( const std::string& extra_request_headers) { extra_request_headers_.Clear(); @@ -510,6 +517,7 @@ void URLFetcherCore::StartURLRequest() { request_->EnableChunkedUpload(); request_->SetLoadFlags(flags); request_->SetReferrer(referrer_); + request_->set_referrer_policy(referrer_policy_); request_->set_first_party_for_cookies(first_party_for_cookies_.is_empty() ? original_url_ : first_party_for_cookies_); if (url_request_data_key_ && !url_request_create_data_callback_.is_null()) { diff --git a/net/url_request/url_fetcher_core.h b/net/url_request/url_fetcher_core.h index 535f479..abf42b5 100644 --- a/net/url_request/url_fetcher_core.h +++ b/net/url_request/url_fetcher_core.h @@ -77,6 +77,7 @@ class URLFetcherCore void SetLoadFlags(int load_flags); int GetLoadFlags() const; void SetReferrer(const std::string& referrer); + void SetReferrerPolicy(URLRequest::ReferrerPolicy referrer_policy); void SetExtraRequestHeaders(const std::string& extra_request_headers); void AddExtraRequestHeader(const std::string& header_line); void SetRequestContext(URLRequestContextGetter* request_context_getter); @@ -242,6 +243,7 @@ class URLFetcherCore // uploaded. std::string upload_content_type_; // MIME type of POST payload std::string referrer_; // HTTP Referer header value and policy + URLRequest::ReferrerPolicy referrer_policy_; bool is_chunked_upload_; // True if using chunked transfer encoding // Used to determine how long to wait before making a request or doing a diff --git a/net/url_request/url_fetcher_impl.cc b/net/url_request/url_fetcher_impl.cc index 200fbfc0..fc44551 100644 --- a/net/url_request/url_fetcher_impl.cc +++ b/net/url_request/url_fetcher_impl.cc @@ -57,6 +57,11 @@ void URLFetcherImpl::SetReferrer(const std::string& referrer) { core_->SetReferrer(referrer); } +void URLFetcherImpl::SetReferrerPolicy( + URLRequest::ReferrerPolicy referrer_policy) { + core_->SetReferrerPolicy(referrer_policy); +} + void URLFetcherImpl::SetLoadFlags(int load_flags) { core_->SetLoadFlags(load_flags); } diff --git a/net/url_request/url_fetcher_impl.h b/net/url_request/url_fetcher_impl.h index f9e5a98..174a978 100644 --- a/net/url_request/url_fetcher_impl.h +++ b/net/url_request/url_fetcher_impl.h @@ -50,6 +50,8 @@ class NET_EXPORT_PRIVATE URLFetcherImpl : public URLFetcher { virtual void SetLoadFlags(int load_flags) OVERRIDE; virtual int GetLoadFlags() const OVERRIDE; virtual void SetReferrer(const std::string& referrer) OVERRIDE; + virtual void SetReferrerPolicy( + URLRequest::ReferrerPolicy referrer_policy) OVERRIDE; virtual void SetExtraRequestHeaders( const std::string& extra_request_headers) OVERRIDE; virtual void AddExtraRequestHeader(const std::string& header_line) OVERRIDE; |