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

Unified Diff: net/url_request/http_protocol_handler.cc

Issue 10702137: Replaced static URLRequestHTTPJob factory with non-static protocol handler for HTTP jobs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed nits Created 8 years, 5 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/http_protocol_handler.cc
diff --git a/net/url_request/http_protocol_handler.cc b/net/url_request/http_protocol_handler.cc
new file mode 100644
index 0000000000000000000000000000000000000000..53141ea81ca37025740b562565a16d97cccc3cd4
--- /dev/null
+++ b/net/url_request/http_protocol_handler.cc
@@ -0,0 +1,59 @@
+// Copyright (c) 2012 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 "net/url_request/http_protocol_handler.h"
+
+#include "base/logging.h"
+#include "net/base/net_errors.h"
+#include "net/url_request/url_request.h"
+#include "net/url_request/url_request_error_job.h"
+#include "net/url_request/url_request_http_job.h"
+#include "net/url_request/url_request_redirect_job.h"
+
+namespace net {
+
+HttpProtocolHandler::HttpProtocolHandler(
+ HttpTransactionFactory* http_transaction_factory,
+ NetworkDelegate* network_delegate,
+ URLRequestThrottlerManager* throttler_manager,
+ const std::string& accept_language,
+ const std::string& accept_charset,
+ CookieStore* cookie_store,
+ FraudulentCertificateReporter* fraudulent_certificate_reporter,
+ SSLConfigService* ssl_config_service,
+ TransportSecurityState* transport_security_state)
+ : http_transaction_factory_(http_transaction_factory),
+ network_delegate_(network_delegate),
+ throttler_manager_(throttler_manager),
+ accept_language_(accept_language),
+ accept_charset_(accept_charset),
+ cookie_store_(cookie_store),
+ fraudulent_certificate_reporter_(fraudulent_certificate_reporter),
+ ssl_config_service_(ssl_config_service),
+ transport_security_state_(transport_security_state) {
+}
+
+URLRequestJob* HttpProtocolHandler::MaybeCreateJob(
+ URLRequest* request) const {
+ if (!http_transaction_factory_) {
+ NOTREACHED() << "requires a valid context";
+ return new URLRequestErrorJob(request, ERR_INVALID_ARGUMENT);
+ }
+
+ GURL redirect_url;
+ if (request->GetHSTSRedirect(&redirect_url))
+ return new URLRequestRedirectJob(request, redirect_url);
+ return new URLRequestHttpJob(request,
+ http_transaction_factory_,
+ network_delegate_,
+ throttler_manager_,
+ accept_language_,
+ accept_charset_,
+ cookie_store_,
+ fraudulent_certificate_reporter_,
+ ssl_config_service_,
+ transport_security_state_);
+}
+
+} // namespace net

Powered by Google App Engine
This is Rietveld 408576698