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

Unified Diff: chrome/browser/net/http_intercept_job_factory.cc

Issue 10836248: Turned job_factory into a pure virtual class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed nits Created 8 years, 4 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: chrome/browser/net/http_intercept_job_factory.cc
diff --git a/chrome/browser/net/http_intercept_job_factory.cc b/chrome/browser/net/http_intercept_job_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..221503b8dc13280c8dd309deb7ef3cbc53e99faa
--- /dev/null
+++ b/chrome/browser/net/http_intercept_job_factory.cc
@@ -0,0 +1,76 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/net/http_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 {
+
+const char* kHttpScheme = "http";
+const char* kHttpsScheme = "https";
+
+HttpInterceptJobFactory::HttpInterceptJobFactory(
+ const URLRequestJobFactory* job_factory,
+ ProtocolHandler* protocol_handler)
+ : job_factory_(job_factory),
+ protocol_handler_(protocol_handler) {
+}
+
+HttpInterceptJobFactory::~HttpInterceptJobFactory() {}
+
+bool HttpInterceptJobFactory::SetProtocolHandler(
+ const std::string& scheme, ProtocolHandler* protocol_handler) {
+ NOTREACHED();
+ return false;
+}
+
+void HttpInterceptJobFactory::AddInterceptor(Interceptor* interceptor) {
+ // Interceptor addition is not allowed.
+ NOTREACHED();
+}
+
+URLRequestJob* HttpInterceptJobFactory::MaybeCreateJobWithInterceptor(
+ URLRequest* request) const {
+ return job_factory_->MaybeCreateJobWithInterceptor(request);
+}
+
+URLRequestJob* HttpInterceptJobFactory::MaybeCreateJobWithProtocolHandler(
+ const std::string& scheme, URLRequest* request) const {
+ DCHECK(CalledOnValidThread());
+ if (scheme == kHttpScheme || scheme == kHttpsScheme)
+ return protocol_handler_->MaybeCreateJob(request);
+ return job_factory_->MaybeCreateJobWithProtocolHandler(scheme, request);
+}
+
+URLRequestJob* HttpInterceptJobFactory::MaybeInterceptRedirect(
+ const GURL& location, URLRequest* request) const {
+ return job_factory_->MaybeInterceptRedirect(location, request);
+}
+
+URLRequestJob* HttpInterceptJobFactory::MaybeInterceptResponse(
+ URLRequest* request) const {
+ return job_factory_->MaybeInterceptResponse(request);
+}
+
+bool HttpInterceptJobFactory::IsHandledProtocol(
+ const std::string& scheme) const {
+ DCHECK(CalledOnValidThread());
+ if (scheme == kHttpScheme || scheme == kHttpsScheme)
+ return true;
+ return job_factory_->IsHandledProtocol(scheme);
+}
+
+bool HttpInterceptJobFactory::IsHandledURL(const GURL& url) const {
+ if (url.scheme() == kHttpScheme || url.scheme() == kHttpsScheme)
+ return true;
+ return job_factory_->IsHandledURL(url);
+}
+
+} // namespace net

Powered by Google App Engine
This is Rietveld 408576698