OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/login_prompt.h" | 5 #include "chrome/browser/login_prompt.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 handler_->BuildViewForPasswordManager(password_manager, | 388 handler_->BuildViewForPasswordManager(password_manager, |
389 explanation); | 389 explanation); |
390 } | 390 } |
391 | 391 |
392 private: | 392 private: |
393 // Helper to create a PasswordForm and stuff it into a vector as input | 393 // Helper to create a PasswordForm and stuff it into a vector as input |
394 // for PasswordManager::PasswordFormsFound, the hook into PasswordManager. | 394 // for PasswordManager::PasswordFormsFound, the hook into PasswordManager. |
395 void MakeInputForPasswordManager( | 395 void MakeInputForPasswordManager( |
396 std::vector<PasswordForm>* password_manager_input) { | 396 std::vector<PasswordForm>* password_manager_input) { |
397 PasswordForm dialog_form; | 397 PasswordForm dialog_form; |
398 // username_element and password_element need to be set. The value | |
399 // for both do not matter, but if they are empty then the username+password | |
400 // will never be saved. | |
401 dialog_form.username_element = ASCIIToUTF16("username"); | |
402 dialog_form.password_element = ASCIIToUTF16("password"); | |
403 if (LowerCaseEqualsASCII(auth_info_->scheme, "basic")) { | 398 if (LowerCaseEqualsASCII(auth_info_->scheme, "basic")) { |
404 dialog_form.scheme = PasswordForm::SCHEME_BASIC; | 399 dialog_form.scheme = PasswordForm::SCHEME_BASIC; |
405 } else if (LowerCaseEqualsASCII(auth_info_->scheme, "digest")) { | 400 } else if (LowerCaseEqualsASCII(auth_info_->scheme, "digest")) { |
406 dialog_form.scheme = PasswordForm::SCHEME_DIGEST; | 401 dialog_form.scheme = PasswordForm::SCHEME_DIGEST; |
407 } else { | 402 } else { |
408 dialog_form.scheme = PasswordForm::SCHEME_OTHER; | 403 dialog_form.scheme = PasswordForm::SCHEME_OTHER; |
409 } | 404 } |
410 std::string host_and_port(WideToASCII(auth_info_->host_and_port)); | 405 std::string host_and_port(WideToASCII(auth_info_->host_and_port)); |
411 if (auth_info_->is_proxy) { | 406 if (auth_info_->is_proxy) { |
412 std::string origin = host_and_port; | 407 std::string origin = host_and_port; |
(...skipping 30 matching lines...) Expand all Loading... |
443 // Public API | 438 // Public API |
444 | 439 |
445 LoginHandler* CreateLoginPrompt(net::AuthChallengeInfo* auth_info, | 440 LoginHandler* CreateLoginPrompt(net::AuthChallengeInfo* auth_info, |
446 URLRequest* request) { | 441 URLRequest* request) { |
447 LoginHandler* handler = LoginHandler::Create(auth_info, request); | 442 LoginHandler* handler = LoginHandler::Create(auth_info, request); |
448 ChromeThread::PostTask( | 443 ChromeThread::PostTask( |
449 ChromeThread::UI, FROM_HERE, new LoginDialogTask( | 444 ChromeThread::UI, FROM_HERE, new LoginDialogTask( |
450 request->url(), auth_info, handler)); | 445 request->url(), auth_info, handler)); |
451 return handler; | 446 return handler; |
452 } | 447 } |
OLD | NEW |