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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 | 228 |
229 bool PasswordFormManager::IsNewLogin() const { | 229 bool PasswordFormManager::IsNewLogin() const { |
230 DCHECK_EQ(state_, POST_MATCHING_PHASE); | 230 DCHECK_EQ(state_, POST_MATCHING_PHASE); |
231 return is_new_login_; | 231 return is_new_login_; |
232 } | 232 } |
233 | 233 |
234 bool PasswordFormManager::IsPendingCredentialsPublicSuffixMatch() const { | 234 bool PasswordFormManager::IsPendingCredentialsPublicSuffixMatch() const { |
235 return pending_credentials_.IsPublicSuffixMatch(); | 235 return pending_credentials_.IsPublicSuffixMatch(); |
236 } | 236 } |
237 | 237 |
238 bool PasswordFormManager::HasValidPasswordForm() const { | |
239 DCHECK(state_ == MATCHING_PHASE || state_ == POST_MATCHING_PHASE) << state_; | |
240 // Non-HTML password forms (primarily HTTP and FTP autentication) | |
241 // do not contain username_element and password_element values. | |
242 if (observed_form_.scheme != PasswordForm::SCHEME_HTML) | |
243 return true; | |
244 return !observed_form_.password_element.empty() || | |
245 !observed_form_.new_password_element.empty(); | |
246 } | |
247 | |
248 void PasswordFormManager::ProvisionallySave( | 238 void PasswordFormManager::ProvisionallySave( |
249 const PasswordForm& credentials, | 239 const PasswordForm& credentials, |
250 OtherPossibleUsernamesAction action) { | 240 OtherPossibleUsernamesAction action) { |
251 DCHECK(state_ == MATCHING_PHASE || state_ == POST_MATCHING_PHASE) << state_; | 241 DCHECK(state_ == MATCHING_PHASE || state_ == POST_MATCHING_PHASE) << state_; |
252 DCHECK_NE(RESULT_NO_MATCH, DoesManage(credentials)); | 242 DCHECK_NE(RESULT_NO_MATCH, DoesManage(credentials)); |
253 provisionally_saved_form_.reset(new PasswordForm(credentials)); | 243 provisionally_saved_form_.reset(new PasswordForm(credentials)); |
254 other_possible_username_action_ = action; | 244 other_possible_username_action_ = action; |
255 | 245 |
256 if (HasCompletedMatching()) | 246 if (HasCompletedMatching()) |
257 CreatePendingCredentials(); | 247 CreatePendingCredentials(); |
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 continue; | 1049 continue; |
1060 } | 1050 } |
1061 password_store->RemoveLogin(*credential_to_delete->second); | 1051 password_store->RemoveLogin(*credential_to_delete->second); |
1062 if (credential_to_delete->second == preferred_match_) | 1052 if (credential_to_delete->second == preferred_match_) |
1063 preferred_match_ = nullptr; | 1053 preferred_match_ = nullptr; |
1064 best_matches_.erase(credential_to_delete); | 1054 best_matches_.erase(credential_to_delete); |
1065 } | 1055 } |
1066 } | 1056 } |
1067 | 1057 |
1068 } // namespace password_manager | 1058 } // namespace password_manager |
OLD | NEW |