| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/login/login_prompt.h" | 5 #include "chrome/browser/ui/login/login_prompt.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 DISALLOW_COPY_AND_ASSIGN(LoginHandlerHtml); | 190 DISALLOW_COPY_AND_ASSIGN(LoginHandlerHtml); |
| 191 }; | 191 }; |
| 192 | 192 |
| 193 void LoginHandlerHtmlDelegate::OnDialogClosed(const std::string& json_retval) { | 193 void LoginHandlerHtmlDelegate::OnDialogClosed(const std::string& json_retval) { |
| 194 if (closed_) | 194 if (closed_) |
| 195 return; | 195 return; |
| 196 closed_ = true; | 196 closed_ = true; |
| 197 | 197 |
| 198 scoped_ptr<Value> parsed_value(base::JSONReader::Read(json_retval, false)); | 198 scoped_ptr<Value> parsed_value(base::JSONReader::Read(json_retval, false)); |
| 199 | 199 |
| 200 if (!parsed_value.get() || !parsed_value->IsType(Value::TYPE_DICTIONARY)) { | 200 if (!parsed_value.get() || !parsed_value->IsDictionary()) { |
| 201 login_handler_->CancelAuth(); | 201 login_handler_->CancelAuth(); |
| 202 } else { | 202 } else { |
| 203 DictionaryValue* res = static_cast<DictionaryValue*>(parsed_value.get()); | 203 DictionaryValue* res = static_cast<DictionaryValue*>(parsed_value.get()); |
| 204 string16 username; | 204 string16 username; |
| 205 string16 password; | 205 string16 password; |
| 206 | 206 |
| 207 if (!res->GetString("username", &username) || | 207 if (!res->GetString("username", &username) || |
| 208 !res->GetString("password", &password)) { | 208 !res->GetString("password", &password)) { |
| 209 login_handler_->CancelAuth(); | 209 login_handler_->CancelAuth(); |
| 210 } else { | 210 } else { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 SetDialog(dialog); | 250 SetDialog(dialog); |
| 251 | 251 |
| 252 NotifyAuthNeeded(); | 252 NotifyAuthNeeded(); |
| 253 } | 253 } |
| 254 | 254 |
| 255 // static | 255 // static |
| 256 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, | 256 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, |
| 257 net::URLRequest* request) { | 257 net::URLRequest* request) { |
| 258 return new LoginHandlerHtml(auth_info, request); | 258 return new LoginHandlerHtml(auth_info, request); |
| 259 } | 259 } |
| OLD | NEW |