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

Unified Diff: net/url_request/protocol_intercept_job_factory.cc

Issue 11293252: Change Interceptors into URLRequestJobFactory::ProtocolHandlers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync (including tedv's change) Created 8 years 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/protocol_intercept_job_factory.cc
diff --git a/net/url_request/protocol_intercept_job_factory.cc b/net/url_request/protocol_intercept_job_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1a1a95ff9867ac4e777fbf84adef82d6b7389441
--- /dev/null
+++ b/net/url_request/protocol_intercept_job_factory.cc
@@ -0,0 +1,74 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
mmenke 2012/12/18 20:32:15 Hmm...Should this be 2012? I have no idea.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/url_request/protocol_intercept_job_factory.h"
+
+#include "base/stl_util.h"
+#include "googleurl/src/gurl.h"
+#include "net/base/load_flags.h"
+#include "net/url_request/url_request_job_manager.h"
+
+class GURL;
+
+namespace net {
+
+ProtocolInterceptJobFactory::ProtocolInterceptJobFactory(
+ scoped_ptr<URLRequestJobFactory> job_factory,
+ scoped_ptr<ProtocolHandler> protocol_handler)
+ : job_factory_(job_factory.Pass()),
+ protocol_handler_(protocol_handler.Pass()) {
+}
+
+ProtocolInterceptJobFactory::~ProtocolInterceptJobFactory() {}
+
+bool ProtocolInterceptJobFactory::SetProtocolHandler(
+ const std::string& scheme, ProtocolHandler* protocol_handler) {
+ return job_factory_->SetProtocolHandler(scheme, protocol_handler);
+}
+
+void ProtocolInterceptJobFactory::AddInterceptor(Interceptor* interceptor) {
+ return job_factory_->AddInterceptor(interceptor);
+}
+
+URLRequestJob* ProtocolInterceptJobFactory::MaybeCreateJobWithInterceptor(
+ URLRequest* request, NetworkDelegate* network_delegate) const {
+ return job_factory_->MaybeCreateJobWithInterceptor(request, network_delegate);
+}
+
+URLRequestJob* ProtocolInterceptJobFactory::MaybeCreateJobWithProtocolHandler(
+ const std::string& scheme,
+ URLRequest* request,
+ NetworkDelegate* network_delegate) const {
+ DCHECK(CalledOnValidThread());
+ URLRequestJob* job = protocol_handler_->MaybeCreateJob(request,
+ network_delegate);
+ if (job)
+ return job;
+ return job_factory_->MaybeCreateJobWithProtocolHandler(
+ scheme, request, network_delegate);
+}
+
+URLRequestJob* ProtocolInterceptJobFactory::MaybeInterceptRedirect(
+ const GURL& location,
+ URLRequest* request,
+ NetworkDelegate* network_delegate) const {
+ return job_factory_->MaybeInterceptRedirect(
+ location, request, network_delegate);
+}
+
+URLRequestJob* ProtocolInterceptJobFactory::MaybeInterceptResponse(
+ URLRequest* request, NetworkDelegate* network_delegate) const {
+ return job_factory_->MaybeInterceptResponse(request, network_delegate);
+}
+
+bool ProtocolInterceptJobFactory::IsHandledProtocol(
+ const std::string& scheme) const {
+ return job_factory_->IsHandledProtocol(scheme);
+}
+
+bool ProtocolInterceptJobFactory::IsHandledURL(const GURL& url) const {
+ return job_factory_->IsHandledURL(url);
+}
+
+} // namespace net

Powered by Google App Engine
This is Rietveld 408576698