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

Unified Diff: net/url_request/url_request_context_builder.cc

Issue 1888963004: Add HttpProtocolHandler and convert everything to use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-supports-scheme
Patch Set: even more rebase Created 4 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 side-by-side diff with in-line comments
Download patch
Index: net/url_request/url_request_context_builder.cc
diff --git a/net/url_request/url_request_context_builder.cc b/net/url_request/url_request_context_builder.cc
index a2f47704886543da56a4d47a1d39cd9c346c4723..1470be164149cbb7c276b590b583cac3808f8081 100644
--- a/net/url_request/url_request_context_builder.cc
+++ b/net/url_request/url_request_context_builder.cc
@@ -35,6 +35,7 @@
#include "net/ssl/default_channel_id_store.h"
#include "net/ssl/ssl_config_service_defaults.h"
#include "net/url_request/data_protocol_handler.h"
+#include "net/url_request/http_protocol_handler.h"
#include "net/url_request/static_http_user_agent_settings.h"
#include "net/url_request/url_request_backoff_manager.h"
#include "net/url_request/url_request_context.h"
@@ -476,15 +477,28 @@ std::unique_ptr<URLRequestContext> URLRequestContextBuilder::Build() {
}
storage->set_http_transaction_factory(std::move(http_transaction_factory));
- URLRequestJobFactoryImpl* job_factory = new URLRequestJobFactoryImpl;
+ std::unique_ptr<URLRequestJobFactoryImpl> job_factory =
+ base::WrapUnique(new URLRequestJobFactoryImpl);
// Adds caller-provided protocol handlers first so that these handlers are
- // used over data/file/ftp handlers below.
+ // used over http/ws/data/file/ftp handlers below.
for (auto& scheme_handler : protocol_handlers_) {
job_factory->SetProtocolHandler(scheme_handler.first,
std::move(scheme_handler.second));
}
protocol_handlers_.clear();
+ job_factory->SetProtocolHandler("http",
+ base::WrapUnique(new HttpProtocolHandler));
+ job_factory->SetProtocolHandler("https",
+ base::WrapUnique(new HttpProtocolHandler));
+
+#if !defined(OS_IOS)
+ job_factory->SetProtocolHandler("ws",
+ base::WrapUnique(new HttpProtocolHandler));
+ job_factory->SetProtocolHandler("wss",
+ base::WrapUnique(new HttpProtocolHandler));
+#endif // !defined(OS_IOS)
+
if (data_enabled_)
job_factory->SetProtocolHandler("data",
base::WrapUnique(new DataProtocolHandler));
@@ -507,7 +521,9 @@ std::unique_ptr<URLRequestContext> URLRequestContextBuilder::Build() {
}
#endif // !defined(DISABLE_FTP_SUPPORT)
- std::unique_ptr<net::URLRequestJobFactory> top_job_factory(job_factory);
+ std::unique_ptr<net::URLRequestJobFactory> top_job_factory =
+ std::move(job_factory);
+
if (!url_request_interceptors_.empty()) {
// Set up interceptors in the reverse order.

Powered by Google App Engine
This is Rietveld 408576698