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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 DCHECK_EQ(state_, POST_MATCHING_PHASE); | 140 DCHECK_EQ(state_, POST_MATCHING_PHASE); |
141 return is_new_login_; | 141 return is_new_login_; |
142 } | 142 } |
143 | 143 |
144 bool PasswordFormManager::HasValidPasswordForm() { | 144 bool PasswordFormManager::HasValidPasswordForm() { |
145 DCHECK_EQ(state_, POST_MATCHING_PHASE); | 145 DCHECK_EQ(state_, POST_MATCHING_PHASE); |
146 // Non-HTML password forms (primarily HTTP and FTP autentication) | 146 // Non-HTML password forms (primarily HTTP and FTP autentication) |
147 // do not contain username_element and password_element values. | 147 // do not contain username_element and password_element values. |
148 if (observed_form_.scheme != PasswordForm::SCHEME_HTML) | 148 if (observed_form_.scheme != PasswordForm::SCHEME_HTML) |
149 return true; | 149 return true; |
150 return !observed_form_.username_element.empty() && | 150 return !observed_form_.password_element.empty(); |
151 !observed_form_.password_element.empty(); | |
152 } | 151 } |
153 | 152 |
154 void PasswordFormManager::ProvisionallySave(const PasswordForm& credentials) { | 153 void PasswordFormManager::ProvisionallySave(const PasswordForm& credentials) { |
155 DCHECK_EQ(state_, POST_MATCHING_PHASE); | 154 DCHECK_EQ(state_, POST_MATCHING_PHASE); |
156 DCHECK(DoesManage(credentials)); | 155 DCHECK(DoesManage(credentials)); |
157 | 156 |
158 // 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 |
159 // 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 |
160 // failure. | 159 // failure. |
161 // Look for these credentials in the list containing auto-fill entries. | 160 // Look for these credentials in the list containing auto-fill entries. |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 return score; | 473 return score; |
475 } | 474 } |
476 | 475 |
477 void PasswordFormManager::SubmitPassed() { | 476 void PasswordFormManager::SubmitPassed() { |
478 submit_result_ = kSubmitResultPassed; | 477 submit_result_ = kSubmitResultPassed; |
479 } | 478 } |
480 | 479 |
481 void PasswordFormManager::SubmitFailed() { | 480 void PasswordFormManager::SubmitFailed() { |
482 submit_result_ = kSubmitResultFailed; | 481 submit_result_ = kSubmitResultFailed; |
483 } | 482 } |
OLD | NEW |