Commit 56d2539f authored by Matt Menke's avatar Matt Menke Committed by Commit Bot

Remove URLRequest::set_delegate()

This method is no longer used. It was added so that
ResourceDispatcherHost could create a URLRequest itself, and then
pass it over to ResourceLoader, which took ownership and set itself as
the delegate. It also allowed the downloads code to create its own
URLRequests before handing them off to the RDH.

Also make URLRequest::get_upload() a test-only method. It had been used
to allow extensions to poke at upload data, which is no longer done in
the network stack. We could remove this method entirely, reworking the
tests that use it, but that's probably not worth the effort.

Bug: 934009
Change-Id: I9b2fc70da7b7d9867c396760b26d583067802b50
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1814393Reviewed-by: default avatarEric Roman <eroman@chromium.org>
Commit-Queue: Matt Menke <mmenke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#698499}
parent 5493091e
......@@ -439,7 +439,7 @@ class URLRequestMockDohJob : public URLRequestJob, public AsyncSocket {
encoded_query, base::Base64UrlDecodePolicy::IGNORE_PADDING,
&decoded_query));
} else if (request->method() == "POST") {
const UploadDataStream* stream = request->get_upload();
const UploadDataStream* stream = request->get_upload_for_testing();
auto* readers = stream->GetElementReaders();
EXPECT_TRUE(readers);
EXPECT_FALSE(readers->empty());
......
......@@ -40,7 +40,7 @@ void MarkURLRequestDestroyed(bool* url_request_destroyed) {
// data. Erases the sent reports from |expect_reports|.
void CheckUploadData(const URLRequest& request,
std::set<std::string>* expect_reports) {
const UploadDataStream* upload = request.get_upload();
const UploadDataStream* upload = request.get_upload_for_testing();
ASSERT_TRUE(upload);
ASSERT_TRUE(upload->GetElementReaders());
ASSERT_EQ(1u, upload->GetElementReaders()->size());
......
......@@ -207,7 +207,7 @@ void URLRequest::set_upload(std::unique_ptr<UploadDataStream> upload) {
upload_data_stream_ = std::move(upload);
}
const UploadDataStream* URLRequest::get_upload() const {
const UploadDataStream* URLRequest::get_upload_for_testing() const {
return upload_data_stream_.get();
}
......@@ -515,12 +515,6 @@ void URLRequest::set_referrer_policy(ReferrerPolicy referrer_policy) {
referrer_policy_ = referrer_policy;
}
void URLRequest::set_delegate(Delegate* delegate) {
DCHECK(!delegate_);
DCHECK(delegate);
delegate_ = delegate;
}
void URLRequest::set_allow_credentials(bool allow_credentials) {
if (allow_credentials) {
load_flags_ &= ~(LOAD_DO_NOT_SAVE_COOKIES | LOAD_DO_NOT_SEND_COOKIES |
......
......@@ -373,11 +373,6 @@ class NET_EXPORT URLRequest : public base::SupportsUserData {
ReferrerPolicy referrer_policy() const { return referrer_policy_; }
void set_referrer_policy(ReferrerPolicy referrer_policy);
// Sets the delegate of the request. This is only to allow creating a request
// before creating its delegate. |delegate| must be non-NULL and the request
// must not yet have a Delegate set.
void set_delegate(Delegate* delegate);
// Sets whether credentials are allowed.
// If credentials are allowed, the request will send and save HTTP
// cookies, as well as authentication to the origin server. If not,
......@@ -392,7 +387,7 @@ class NET_EXPORT URLRequest : public base::SupportsUserData {
void set_upload(std::unique_ptr<UploadDataStream> upload);
// Gets the upload data.
const UploadDataStream* get_upload() const;
const UploadDataStream* get_upload_for_testing() const;
// Returns true if the request has a non-empty message body to upload.
bool has_upload() const;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment