| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/password_manager/password_form_manager.h" | 5 #include "chrome/browser/password_manager/password_form_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/histogram.h" | 9 #include "base/histogram.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 SaveAsNewLogin(false); | 135 SaveAsNewLogin(false); |
| 136 } | 136 } |
| 137 | 137 |
| 138 bool PasswordFormManager::IsNewLogin() { | 138 bool PasswordFormManager::IsNewLogin() { |
| 139 DCHECK_EQ(state_, POST_MATCHING_PHASE); | 139 DCHECK_EQ(state_, POST_MATCHING_PHASE); |
| 140 return is_new_login_; | 140 return is_new_login_; |
| 141 } | 141 } |
| 142 | 142 |
| 143 bool PasswordFormManager::HasValidPasswordForm() { | 143 bool PasswordFormManager::HasValidPasswordForm() { |
| 144 DCHECK_EQ(state_, POST_MATCHING_PHASE); | 144 DCHECK_EQ(state_, POST_MATCHING_PHASE); |
| 145 // Non-HTML password forms (primarily HTTP and FTP autentication) |
| 146 // do not contain username_element and password_element values. |
| 147 if (observed_form_.scheme != PasswordForm::SCHEME_HTML) |
| 148 return true; |
| 145 return !observed_form_.username_element.empty() && | 149 return !observed_form_.username_element.empty() && |
| 146 !observed_form_.password_element.empty(); | 150 !observed_form_.password_element.empty(); |
| 147 } | 151 } |
| 148 | 152 |
| 149 void PasswordFormManager::ProvisionallySave(const PasswordForm& credentials) { | 153 void PasswordFormManager::ProvisionallySave(const PasswordForm& credentials) { |
| 150 DCHECK_EQ(state_, POST_MATCHING_PHASE); | 154 DCHECK_EQ(state_, POST_MATCHING_PHASE); |
| 151 DCHECK(DoesManage(credentials)); | 155 DCHECK(DoesManage(credentials)); |
| 152 | 156 |
| 153 // Make sure the important fields stay the same as the initially observed or | 157 // Make sure the important fields stay the same as the initially observed or |
| 154 // autofilled ones, as they may have changed if the user experienced a login | 158 // autofilled ones, as they may have changed if the user experienced a login |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 return score; | 478 return score; |
| 475 } | 479 } |
| 476 | 480 |
| 477 void PasswordFormManager::SubmitPassed() { | 481 void PasswordFormManager::SubmitPassed() { |
| 478 submit_result_ = kSubmitResultPassed; | 482 submit_result_ = kSubmitResultPassed; |
| 479 } | 483 } |
| 480 | 484 |
| 481 void PasswordFormManager::SubmitFailed() { | 485 void PasswordFormManager::SubmitFailed() { |
| 482 submit_result_ = kSubmitResultFailed; | 486 submit_result_ = kSubmitResultFailed; |
| 483 } | 487 } |
| OLD | NEW |