Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Side by Side Diff: components/password_manager/core/browser/password_form_manager.cc

Issue 1286593003: [Password Manager] Store forms with field name and id attributes missing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed mac bot failure. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698