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

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

Issue 548953002: [Password Manager] Modified to support saving passwords on forms without username fields. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporated review comments. Created 6 years, 2 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 8
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/metrics/user_metrics.h" 10 #include "base/metrics/user_metrics.h"
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 // has already given consent, so we treat these cases the same. 219 // has already given consent, so we treat these cases the same.
220 return has_generated_password_; 220 return has_generated_password_;
221 } 221 }
222 222
223 bool PasswordFormManager::HasValidPasswordForm() { 223 bool PasswordFormManager::HasValidPasswordForm() {
224 DCHECK_EQ(state_, POST_MATCHING_PHASE); 224 DCHECK_EQ(state_, POST_MATCHING_PHASE);
225 // Non-HTML password forms (primarily HTTP and FTP autentication) 225 // Non-HTML password forms (primarily HTTP and FTP autentication)
226 // do not contain username_element and password_element values. 226 // do not contain username_element and password_element values.
227 if (observed_form_.scheme != PasswordForm::SCHEME_HTML) 227 if (observed_form_.scheme != PasswordForm::SCHEME_HTML)
228 return true; 228 return true;
229 return !observed_form_.username_element.empty() && 229 return (!observed_form_.password_element.empty() ||
vabr (Chromium) 2014/09/24 09:47:44 nit: no need for the outer parentheses
Pritam Nikam 2014/09/24 12:57:55 Done.
230 (!observed_form_.password_element.empty() ||
231 !observed_form_.new_password_element.empty()); 230 !observed_form_.new_password_element.empty());
232 } 231 }
233 232
234 void PasswordFormManager::ProvisionallySave( 233 void PasswordFormManager::ProvisionallySave(
235 const PasswordForm& credentials, 234 const PasswordForm& credentials,
236 OtherPossibleUsernamesAction action) { 235 OtherPossibleUsernamesAction action) {
237 DCHECK_EQ(state_, POST_MATCHING_PHASE); 236 DCHECK_EQ(state_, POST_MATCHING_PHASE);
238 DCHECK_NE(RESULT_NO_MATCH, DoesManage(credentials)); 237 DCHECK_NE(RESULT_NO_MATCH, DoesManage(credentials));
239 238
240 // If this was a sign-up or change password form, we want to persist the new 239 // If this was a sign-up or change password form, we want to persist the new
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 LogPasswordGenerationSubmissionEvent(PASSWORD_SUBMITTED); 794 LogPasswordGenerationSubmissionEvent(PASSWORD_SUBMITTED);
796 } 795 }
797 796
798 void PasswordFormManager::SubmitFailed() { 797 void PasswordFormManager::SubmitFailed() {
799 submit_result_ = kSubmitResultFailed; 798 submit_result_ = kSubmitResultFailed;
800 if (has_generated_password_) 799 if (has_generated_password_)
801 LogPasswordGenerationSubmissionEvent(PASSWORD_SUBMISSION_FAILED); 800 LogPasswordGenerationSubmissionEvent(PASSWORD_SUBMISSION_FAILED);
802 } 801 }
803 802
804 } // namespace password_manager 803 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698