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 422ddd729a27cf4dc9c24198c4dc30e0087cd60c..739f4ceab4a79e3b0f9fe5a0b89f821e9b033345 100644 |
--- a/net/http/http_auth_handler_negotiate.cc |
+++ b/net/http/http_auth_handler_negotiate.cc |
@@ -65,6 +65,19 @@ int HttpAuthHandlerNegotiate::Factory::CreateAuthHandler( |
return ERR_INVALID_RESPONSE; |
handler->swap(tmp_handler); |
return OK; |
+#elif defined(OS_ANDROID) |
+ if (is_unsupported_ || account_type_.empty()) |
+ return ERR_UNSUPPORTED_AUTH_SCHEME; |
+ // TODO(ahendrickson): Move towards model of parsing in the factory |
+ // method and only constructing when valid. |
+ scoped_ptr<HttpAuthHandler> tmp_handler(new HttpAuthHandlerNegotiate( |
+ account_type_, url_security_manager(), resolver_, disable_cname_lookup_, |
+ use_port_)); |
+ if (!tmp_handler->InitFromChallenge(challenge, target, origin, net_log)) |
+ return ERR_INVALID_RESPONSE; |
+ handler->swap(tmp_handler); |
+ return OK; |
+ |
#elif defined(OS_POSIX) |
if (is_unsupported_) |
return ERR_UNSUPPORTED_AUTH_SCHEME; |
@@ -86,7 +99,11 @@ int HttpAuthHandlerNegotiate::Factory::CreateAuthHandler( |
} |
HttpAuthHandlerNegotiate::HttpAuthHandlerNegotiate( |
+#if defined(OS_ANDROID) |
+ std::string account_type, |
+#else |
AuthLibrary* auth_library, |
+#endif |
#if defined(OS_WIN) |
ULONG max_token_length, |
#endif |
@@ -94,7 +111,9 @@ HttpAuthHandlerNegotiate::HttpAuthHandlerNegotiate( |
HostResolver* resolver, |
bool disable_cname_lookup, |
bool use_port) |
-#if defined(OS_WIN) |
+#if defined(OS_ANDROID) |
+ : auth_system_(account_type, "Negotiate"), |
+#elif defined(OS_WIN) |
: 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), |
@@ -316,7 +335,10 @@ int HttpAuthHandlerNegotiate::DoGenerateAuthToken() { |
next_state_ = STATE_GENERATE_AUTH_TOKEN_COMPLETE; |
AuthCredentials* credentials = has_credentials_ ? &credentials_ : NULL; |
// TODO(cbentzel): This should possibly be done async. |
- return auth_system_.GenerateAuthToken(credentials, spn_, auth_token_); |
+ return auth_system_.GenerateAuthToken( |
+ credentials, spn_, auth_token_, |
+ base::Bind(&HttpAuthHandlerNegotiate::OnIOComplete, |
+ base::Unretained(this))); |
} |
int HttpAuthHandlerNegotiate::DoGenerateAuthTokenComplete(int rv) { |