Index: net/http/http_auth_handler_negotiate.cc |
diff --git a/net/http/http_auth_handler_negotiate.cc b/net/http/http_auth_handler_negotiate.cc |
index 1c175b5b16487167619293c6fbad1a87fae07da1..a183238faf4420704070ed66aa0bff57c7bbaecf 100644 |
--- a/net/http/http_auth_handler_negotiate.cc |
+++ b/net/http/http_auth_handler_negotiate.cc |
@@ -17,6 +17,8 @@ |
#include "net/http/http_auth_filter.h" |
#include "net/http/url_security_manager.h" |
+// TODO(asanka): This file is a mess of platform dependent code. We should break |
+// it up. |
namespace net { |
HttpAuthHandlerNegotiate::Factory::Factory() |
@@ -37,58 +39,58 @@ void HttpAuthHandlerNegotiate::Factory::set_host_resolver( |
resolver_ = resolver; |
} |
-int HttpAuthHandlerNegotiate::Factory::CreateAuthHandler( |
- const HttpAuthChallengeTokenizer& challenge, |
+scoped_ptr<HttpAuthHandler> |
+HttpAuthHandlerNegotiate::Factory::CreateAndInitPreemptiveAuthHandler( |
+ HttpAuthCache::Entry* cache_entry, |
+ const HttpAuthChallengeTokenizer& tokenizer, |
HttpAuth::Target target, |
- const GURL& origin, |
- CreateReason reason, |
- int digest_nonce_count, |
- const BoundNetLog& net_log, |
- scoped_ptr<HttpAuthHandler>* handler) { |
+ const BoundNetLog& net_log) { |
+ return scoped_ptr<HttpAuthHandler>(); |
+} |
+ |
+scoped_ptr<HttpAuthHandler> |
+HttpAuthHandlerNegotiate::Factory::CreateAuthHandlerForScheme( |
+ const std::string& scheme) { |
+ DCHECK(HttpAuth::IsValidNormalizedScheme(scheme)); |
+ if (scheme != "negotiate") |
+ return scoped_ptr<HttpAuthHandler>(); |
#if defined(OS_WIN) |
- if (is_unsupported_ || reason == CREATE_PREEMPTIVE) |
- return ERR_UNSUPPORTED_AUTH_SCHEME; |
+ if (is_unsupported_) |
+ return scoped_ptr<HttpAuthHandler>(); |
if (max_token_length_ == 0) { |
int rv = DetermineMaxTokenLength(auth_library_.get(), NEGOSSP_NAME, |
&max_token_length_); |
if (rv == ERR_UNSUPPORTED_AUTH_SCHEME) |
is_unsupported_ = true; |
if (rv != OK) |
- return rv; |
+ return scoped_ptr<HttpAuthHandler>(); |
} |
// TODO(cbentzel): Move towards model of parsing in the factory |
// method and only constructing when valid. |
- scoped_ptr<HttpAuthHandler> tmp_handler( |
- new HttpAuthHandlerNegotiate(auth_library_.get(), max_token_length_, |
- url_security_manager(), resolver_, |
- disable_cname_lookup_, use_port_)); |
+ return make_scoped_ptr(new HttpAuthHandlerNegotiate( |
+ auth_library_.get(), max_token_length_, url_security_manager(), resolver_, |
+ disable_cname_lookup_, use_port_)); |
#elif defined(OS_ANDROID) |
- if (is_unsupported_ || auth_library_->empty() || reason == CREATE_PREEMPTIVE) |
- return ERR_UNSUPPORTED_AUTH_SCHEME; |
+ if (is_unsupported_ || auth_library_->empty()) |
+ return scoped_ptr<HttpAuthHandler>(); |
// TODO(cbentzel): Move towards model of parsing in the factory |
// method and only constructing when valid. |
- scoped_ptr<HttpAuthHandler> tmp_handler(new HttpAuthHandlerNegotiate( |
+ return make_scoped_ptr(new HttpAuthHandlerNegotiate( |
auth_library_.get(), url_security_manager(), resolver_, |
disable_cname_lookup_, use_port_)); |
#elif defined(OS_POSIX) |
if (is_unsupported_) |
- return ERR_UNSUPPORTED_AUTH_SCHEME; |
+ return scoped_ptr<HttpAuthHandler>(); |
if (!auth_library_->Init()) { |
is_unsupported_ = true; |
- return ERR_UNSUPPORTED_AUTH_SCHEME; |
+ return scoped_ptr<HttpAuthHandler>(); |
} |
// TODO(ahendrickson): Move towards model of parsing in the factory |
// method and only constructing when valid. |
- scoped_ptr<HttpAuthHandler> tmp_handler( |
- new HttpAuthHandlerNegotiate(auth_library_.get(), url_security_manager(), |
- resolver_, disable_cname_lookup_, |
- use_port_)); |
+ return make_scoped_ptr(new HttpAuthHandlerNegotiate( |
+ auth_library_.get(), url_security_manager(), resolver_, |
+ disable_cname_lookup_, use_port_)); |
#endif |
- int result = |
- tmp_handler->HandleInitialChallenge(challenge, target, origin, net_log); |
- if (result == OK) |
- handler->swap(tmp_handler); |
- return result; |
} |
HttpAuthHandlerNegotiate::HttpAuthHandlerNegotiate( |
@@ -100,12 +102,13 @@ HttpAuthHandlerNegotiate::HttpAuthHandlerNegotiate( |
HostResolver* resolver, |
bool disable_cname_lookup, |
bool use_port) |
+ : HttpAuthHandler("negotiate"), |
#if defined(OS_ANDROID) |
- : auth_system_(*auth_library), |
+ auth_system_(*auth_library), |
#elif defined(OS_WIN) |
- : auth_system_(auth_library, "Negotiate", NEGOSSP_NAME, max_token_length), |
+ auth_system_(auth_library, "Negotiate", NEGOSSP_NAME, max_token_length), |
#elif defined(OS_POSIX) |
- : auth_system_(auth_library, "Negotiate", CHROME_GSS_SPNEGO_MECH_OID_DESC), |
+ auth_system_(auth_library, "Negotiate", CHROME_GSS_SPNEGO_MECH_OID_DESC), |
#endif |
disable_cname_lookup_(disable_cname_lookup), |
use_port_(use_port), |