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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 | 215 |
216 bool PasswordFormManager::IsNewLogin() const { | 216 bool PasswordFormManager::IsNewLogin() const { |
217 DCHECK_EQ(state_, POST_MATCHING_PHASE); | 217 DCHECK_EQ(state_, POST_MATCHING_PHASE); |
218 return is_new_login_; | 218 return is_new_login_; |
219 } | 219 } |
220 | 220 |
221 bool PasswordFormManager::IsPendingCredentialsPublicSuffixMatch() const { | 221 bool PasswordFormManager::IsPendingCredentialsPublicSuffixMatch() const { |
222 return pending_credentials_.IsPublicSuffixMatch(); | 222 return pending_credentials_.IsPublicSuffixMatch(); |
223 } | 223 } |
224 | 224 |
225 bool PasswordFormManager::HasValidPasswordForm() const { | |
226 DCHECK(state_ == MATCHING_PHASE || state_ == POST_MATCHING_PHASE) << state_; | |
227 // Non-HTML password forms (primarily HTTP and FTP autentication) | |
228 // do not contain username_element and password_element values. | |
229 if (observed_form_.scheme != PasswordForm::SCHEME_HTML) | |
230 return true; | |
231 return !observed_form_.password_element.empty() || | |
232 !observed_form_.new_password_element.empty(); | |
233 } | |
234 | |
235 void PasswordFormManager::ProvisionallySave( | 225 void PasswordFormManager::ProvisionallySave( |
236 const PasswordForm& credentials, | 226 const PasswordForm& credentials, |
237 OtherPossibleUsernamesAction action) { | 227 OtherPossibleUsernamesAction action) { |
238 DCHECK(state_ == MATCHING_PHASE || state_ == POST_MATCHING_PHASE) << state_; | 228 DCHECK(state_ == MATCHING_PHASE || state_ == POST_MATCHING_PHASE) << state_; |
239 DCHECK_NE(RESULT_NO_MATCH, DoesManage(credentials)); | 229 DCHECK_NE(RESULT_NO_MATCH, DoesManage(credentials)); |
240 provisionally_saved_form_.reset(new PasswordForm(credentials)); | 230 provisionally_saved_form_.reset(new PasswordForm(credentials)); |
241 other_possible_username_action_ = action; | 231 other_possible_username_action_ = action; |
242 | 232 |
243 if (HasCompletedMatching()) | 233 if (HasCompletedMatching()) |
244 CreatePendingCredentials(); | 234 CreatePendingCredentials(); |
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 continue; | 1044 continue; |
1055 } | 1045 } |
1056 password_store->RemoveLogin(*credential_to_delete->second); | 1046 password_store->RemoveLogin(*credential_to_delete->second); |
1057 if (credential_to_delete->second == preferred_match_) | 1047 if (credential_to_delete->second == preferred_match_) |
1058 preferred_match_ = nullptr; | 1048 preferred_match_ = nullptr; |
1059 best_matches_.erase(credential_to_delete); | 1049 best_matches_.erase(credential_to_delete); |
1060 } | 1050 } |
1061 } | 1051 } |
1062 | 1052 |
1063 } // namespace password_manager | 1053 } // namespace password_manager |
OLD | NEW |