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 "components/password_manager/core/browser/password_form_manager.h" | 5 #include "components/password_manager/core/browser/password_form_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 // has already given consent, so we treat these cases the same. | 220 // has already given consent, so we treat these cases the same. |
221 return has_generated_password_; | 221 return has_generated_password_; |
222 } | 222 } |
223 | 223 |
224 bool PasswordFormManager::HasValidPasswordForm() { | 224 bool PasswordFormManager::HasValidPasswordForm() { |
225 DCHECK_EQ(state_, POST_MATCHING_PHASE); | 225 DCHECK_EQ(state_, POST_MATCHING_PHASE); |
226 // Non-HTML password forms (primarily HTTP and FTP autentication) | 226 // Non-HTML password forms (primarily HTTP and FTP autentication) |
227 // do not contain username_element and password_element values. | 227 // do not contain username_element and password_element values. |
228 if (observed_form_.scheme != PasswordForm::SCHEME_HTML) | 228 if (observed_form_.scheme != PasswordForm::SCHEME_HTML) |
229 return true; | 229 return true; |
230 return !observed_form_.username_element.empty() && | 230 return !observed_form_.password_element.empty() || |
231 (!observed_form_.password_element.empty() || | 231 !observed_form_.new_password_element.empty(); |
232 !observed_form_.new_password_element.empty()); | |
233 } | 232 } |
234 | 233 |
235 void PasswordFormManager::ProvisionallySave( | 234 void PasswordFormManager::ProvisionallySave( |
236 const PasswordForm& credentials, | 235 const PasswordForm& credentials, |
237 OtherPossibleUsernamesAction action) { | 236 OtherPossibleUsernamesAction action) { |
238 DCHECK_EQ(state_, POST_MATCHING_PHASE); | 237 DCHECK_EQ(state_, POST_MATCHING_PHASE); |
239 DCHECK_NE(RESULT_NO_MATCH, DoesManage(credentials)); | 238 DCHECK_NE(RESULT_NO_MATCH, DoesManage(credentials)); |
240 | 239 |
241 // If this was a sign-up or change password form, we want to persist the new | 240 // If this was a sign-up or change password form, we want to persist the new |
242 // password; if this was a login form, then the current password (which might | 241 // password; if this was a login form, then the current password (which might |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 LogPasswordGenerationSubmissionEvent(PASSWORD_SUBMITTED); | 795 LogPasswordGenerationSubmissionEvent(PASSWORD_SUBMITTED); |
797 } | 796 } |
798 | 797 |
799 void PasswordFormManager::SubmitFailed() { | 798 void PasswordFormManager::SubmitFailed() { |
800 submit_result_ = kSubmitResultFailed; | 799 submit_result_ = kSubmitResultFailed; |
801 if (has_generated_password_) | 800 if (has_generated_password_) |
802 LogPasswordGenerationSubmissionEvent(PASSWORD_SUBMISSION_FAILED); | 801 LogPasswordGenerationSubmissionEvent(PASSWORD_SUBMISSION_FAILED); |
803 } | 802 } |
804 | 803 |
805 } // namespace password_manager | 804 } // namespace password_manager |
OLD | NEW |