| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/string_split.h" | 10 #include "base/string_split.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 DCHECK_EQ(state_, POST_MATCHING_PHASE); | 141 DCHECK_EQ(state_, POST_MATCHING_PHASE); |
| 142 return is_new_login_; | 142 return is_new_login_; |
| 143 } | 143 } |
| 144 | 144 |
| 145 bool PasswordFormManager::HasValidPasswordForm() { | 145 bool PasswordFormManager::HasValidPasswordForm() { |
| 146 DCHECK_EQ(state_, POST_MATCHING_PHASE); | 146 DCHECK_EQ(state_, POST_MATCHING_PHASE); |
| 147 // Non-HTML password forms (primarily HTTP and FTP autentication) | 147 // Non-HTML password forms (primarily HTTP and FTP autentication) |
| 148 // do not contain username_element and password_element values. | 148 // do not contain username_element and password_element values. |
| 149 if (observed_form_.scheme != PasswordForm::SCHEME_HTML) | 149 if (observed_form_.scheme != PasswordForm::SCHEME_HTML) |
| 150 return true; | 150 return true; |
| 151 return !observed_form_.username_element.empty() && | 151 return !observed_form_.password_element.empty(); |
| 152 !observed_form_.password_element.empty(); | |
| 153 } | 152 } |
| 154 | 153 |
| 155 void PasswordFormManager::ProvisionallySave(const PasswordForm& credentials) { | 154 void PasswordFormManager::ProvisionallySave(const PasswordForm& credentials) { |
| 156 DCHECK_EQ(state_, POST_MATCHING_PHASE); | 155 DCHECK_EQ(state_, POST_MATCHING_PHASE); |
| 157 DCHECK(DoesManage(credentials)); | 156 DCHECK(DoesManage(credentials)); |
| 158 | 157 |
| 159 // Make sure the important fields stay the same as the initially observed or | 158 // Make sure the important fields stay the same as the initially observed or |
| 160 // autofilled ones, as they may have changed if the user experienced a login | 159 // autofilled ones, as they may have changed if the user experienced a login |
| 161 // failure. | 160 // failure. |
| 162 // Look for these credentials in the list containing auto-fill entries. | 161 // Look for these credentials in the list containing auto-fill entries. |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 return score; | 474 return score; |
| 476 } | 475 } |
| 477 | 476 |
| 478 void PasswordFormManager::SubmitPassed() { | 477 void PasswordFormManager::SubmitPassed() { |
| 479 submit_result_ = kSubmitResultPassed; | 478 submit_result_ = kSubmitResultPassed; |
| 480 } | 479 } |
| 481 | 480 |
| 482 void PasswordFormManager::SubmitFailed() { | 481 void PasswordFormManager::SubmitFailed() { |
| 483 submit_result_ = kSubmitResultFailed; | 482 submit_result_ = kSubmitResultFailed; |
| 484 } | 483 } |
| OLD | NEW |