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

Side by Side Diff: chrome/browser/password_manager/password_manager.cc

Issue 137783003: Password manager: improve the check for login failure (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/password_manager/password_manager_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/password_manager/password_manager.h" 5 #include "chrome/browser/password_manager/password_manager.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/field_trial.h" 8 #include "base/metrics/field_trial.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 !provisional_save_manager_->IsPendingCredentialsPublicSuffixMatch(); 343 !provisional_save_manager_->IsPendingCredentialsPublicSuffixMatch();
344 } 344 }
345 345
346 void PasswordManager::OnPasswordFormsRendered( 346 void PasswordManager::OnPasswordFormsRendered(
347 const std::vector<PasswordForm>& visible_forms) { 347 const std::vector<PasswordForm>& visible_forms) {
348 if (!provisional_save_manager_.get()) 348 if (!provisional_save_manager_.get())
349 return; 349 return;
350 350
351 DCHECK(IsSavingEnabled()); 351 DCHECK(IsSavingEnabled());
352 352
353 // We now assume that if there is at least one visible password form 353 // If we see the login form again, then the login failed.
354 // that means that the previous login attempt failed. 354 for (size_t i = 0; i < visible_forms.size(); ++i) {
355 if (!visible_forms.empty()) { 355 if (visible_forms[i].action.is_valid() &&
356 provisional_save_manager_->SubmitFailed(); 356 provisional_save_manager_->pending_credentials().action ==
357 provisional_save_manager_.reset(); 357 visible_forms[i].action) {
Garrett Casto 2014/01/15 02:28:27 One thing to note is that it looks like at some po
vabr (Chromium) 2014/01/15 08:37:53 I actually started this CL with DoesManage + ACTIO
358 return; 358 provisional_save_manager_->SubmitFailed();
359 provisional_save_manager_.reset();
360 return;
361 }
359 } 362 }
360 363
361 // Looks like a successful login attempt. Either show an infobar or 364 // Looks like a successful login attempt. Either show an infobar or
362 // automatically save the login data. We prompt when the user hasn't already 365 // automatically save the login data. We prompt when the user hasn't already
363 // given consent, either through previously accepting the infobar or by having 366 // given consent, either through previously accepting the infobar or by having
364 // the browser generate the password. 367 // the browser generate the password.
365 provisional_save_manager_->SubmitPassed(); 368 provisional_save_manager_->SubmitPassed();
366 if (provisional_save_manager_->HasGeneratedPassword()) 369 if (provisional_save_manager_->HasGeneratedPassword())
367 UMA_HISTOGRAM_COUNTS("PasswordGeneration.Submitted", 1); 370 UMA_HISTOGRAM_COUNTS("PasswordGeneration.Submitted", 1);
368 371
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 } 462 }
460 463
461 ManagePasswordsBubbleUIController* manage_passwords_bubble_ui_controller = 464 ManagePasswordsBubbleUIController* manage_passwords_bubble_ui_controller =
462 ManagePasswordsBubbleUIController::FromWebContents(web_contents()); 465 ManagePasswordsBubbleUIController::FromWebContents(web_contents());
463 if (manage_passwords_bubble_ui_controller && 466 if (manage_passwords_bubble_ui_controller &&
464 CommandLine::ForCurrentProcess()->HasSwitch( 467 CommandLine::ForCurrentProcess()->HasSwitch(
465 switches::kEnableSavePasswordBubble)) { 468 switches::kEnableSavePasswordBubble)) {
466 manage_passwords_bubble_ui_controller->OnPasswordAutofilled(best_matches); 469 manage_passwords_bubble_ui_controller->OnPasswordAutofilled(best_matches);
467 } 470 }
468 } 471 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/password_manager/password_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698