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

Unified Diff: net/url_request/url_request_job_factory_impl.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: rebase (needs fixing) Created 4 years, 2 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
« no previous file with comments | « net/url_request/url_request_job_factory_impl.h ('k') | net/url_request/url_request_job_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_job_factory_impl.cc
diff --git a/net/url_request/url_request_job_factory_impl.cc b/net/url_request/url_request_job_factory_impl.cc
index 29e6a2c2fe7b3ba04da426127f3f3c73df7228b6..5d1442b2a2bb3aa0fd52b7c79c1f38dfba0ae584 100644
--- a/net/url_request/url_request_job_factory_impl.cc
+++ b/net/url_request/url_request_job_factory_impl.cc
@@ -4,11 +4,14 @@
#include "net/url_request/url_request_job_factory_impl.h"
+#include "base/memory/ptr_util.h"
#include "base/stl_util.h"
#include "net/base/load_flags.h"
+#include "net/url_request/http_protocol_handler.h"
#include "net/url_request/url_request_interceptor.h"
#include "net/url_request/url_request_job_manager.h"
#include "url/gurl.h"
+#include "url/url_constants.h"
namespace net {
@@ -22,6 +25,26 @@ URLRequestJobFactoryImpl::URLRequestJobFactoryImpl() {}
URLRequestJobFactoryImpl::~URLRequestJobFactoryImpl() {}
+// static
+std::unique_ptr<URLRequestJobFactoryImpl>
+URLRequestJobFactoryImpl::CreateWithHttpProtocolHandlers() {
+ std::unique_ptr<URLRequestJobFactoryImpl> job_factory(
+ new URLRequestJobFactoryImpl);
+ job_factory->SetProtocolHandler(url::kHttpScheme,
+ base::WrapUnique(new HttpProtocolHandler));
+ job_factory->SetProtocolHandler(url::kHttpsScheme,
+ base::WrapUnique(new HttpProtocolHandler));
+
+#if !defined(OS_IOS)
+ job_factory->SetProtocolHandler(url::kWsScheme,
+ base::WrapUnique(new HttpProtocolHandler));
+ job_factory->SetProtocolHandler(url::kWssScheme,
+ base::WrapUnique(new HttpProtocolHandler));
+#endif // !defined(OS_IOS)
+
+ return job_factory;
+}
+
bool URLRequestJobFactoryImpl::SetProtocolHandler(
const std::string& scheme,
std::unique_ptr<ProtocolHandler> protocol_handler) {
@@ -76,8 +99,7 @@ URLRequestJob* URLRequestJobFactoryImpl::MaybeInterceptResponse(
bool URLRequestJobFactoryImpl::IsHandledProtocol(
const std::string& scheme) const {
DCHECK(CalledOnValidThread());
- return base::ContainsKey(protocol_handler_map_, scheme) ||
- URLRequestJobManager::SupportsScheme(scheme);
+ return base::ContainsKey(protocol_handler_map_, scheme);
}
bool URLRequestJobFactoryImpl::IsHandledURL(const GURL& url) const {
« no previous file with comments | « net/url_request/url_request_job_factory_impl.h ('k') | net/url_request/url_request_job_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698