| 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_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 | 250 |
| 251 bool PasswordFormManager::IsNewLogin() const { | 251 bool PasswordFormManager::IsNewLogin() const { |
| 252 DCHECK_EQ(state_, POST_MATCHING_PHASE); | 252 DCHECK_EQ(state_, POST_MATCHING_PHASE); |
| 253 return is_new_login_; | 253 return is_new_login_; |
| 254 } | 254 } |
| 255 | 255 |
| 256 bool PasswordFormManager::IsPendingCredentialsPublicSuffixMatch() const { | 256 bool PasswordFormManager::IsPendingCredentialsPublicSuffixMatch() const { |
| 257 return pending_credentials_.IsPublicSuffixMatch(); | 257 return pending_credentials_.IsPublicSuffixMatch(); |
| 258 } | 258 } |
| 259 | 259 |
| 260 bool PasswordFormManager::HasValidPasswordForm() const { | |
| 261 DCHECK(state_ == MATCHING_PHASE || state_ == POST_MATCHING_PHASE) << state_; | |
| 262 // Non-HTML password forms (primarily HTTP and FTP autentication) | |
| 263 // do not contain username_element and password_element values. | |
| 264 if (observed_form_.scheme != PasswordForm::SCHEME_HTML) | |
| 265 return true; | |
| 266 return !observed_form_.password_element.empty() || | |
| 267 !observed_form_.new_password_element.empty(); | |
| 268 } | |
| 269 | |
| 270 void PasswordFormManager::ProvisionallySave( | 260 void PasswordFormManager::ProvisionallySave( |
| 271 const PasswordForm& credentials, | 261 const PasswordForm& credentials, |
| 272 OtherPossibleUsernamesAction action) { | 262 OtherPossibleUsernamesAction action) { |
| 273 DCHECK(state_ == MATCHING_PHASE || state_ == POST_MATCHING_PHASE) << state_; | 263 DCHECK(state_ == MATCHING_PHASE || state_ == POST_MATCHING_PHASE) << state_; |
| 274 DCHECK_NE(RESULT_NO_MATCH, DoesManage(credentials)); | 264 DCHECK_NE(RESULT_NO_MATCH, DoesManage(credentials)); |
| 275 provisionally_saved_form_.reset(new PasswordForm(credentials)); | 265 provisionally_saved_form_.reset(new PasswordForm(credentials)); |
| 276 other_possible_username_action_ = action; | 266 other_possible_username_action_ = action; |
| 277 | 267 |
| 278 if (HasCompletedMatching()) | 268 if (HasCompletedMatching()) |
| 279 CreatePendingCredentials(); | 269 CreatePendingCredentials(); |
| (...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1078 continue; | 1068 continue; |
| 1079 } | 1069 } |
| 1080 password_store->RemoveLogin(*credential_to_delete->second); | 1070 password_store->RemoveLogin(*credential_to_delete->second); |
| 1081 if (credential_to_delete->second == preferred_match_) | 1071 if (credential_to_delete->second == preferred_match_) |
| 1082 preferred_match_ = nullptr; | 1072 preferred_match_ = nullptr; |
| 1083 best_matches_.erase(credential_to_delete); | 1073 best_matches_.erase(credential_to_delete); |
| 1084 } | 1074 } |
| 1085 } | 1075 } |
| 1086 | 1076 |
| 1087 } // namespace password_manager | 1077 } // namespace password_manager |
| OLD | NEW |