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 "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 Loading... | |
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 Loading... | |
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 } |
OLD | NEW |