| 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_manager.h" | 5 #include "components/password_manager/core/browser/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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 | 480 |
| 481 // Looks like a successful login attempt. Either show an infobar or | 481 // Looks like a successful login attempt. Either show an infobar or |
| 482 // automatically save the login data. We prompt when the user hasn't | 482 // automatically save the login data. We prompt when the user hasn't |
| 483 // already given consent, either through previously accepting the infobar | 483 // already given consent, either through previously accepting the infobar |
| 484 // or by having the browser generate the password. | 484 // or by having the browser generate the password. |
| 485 provisional_save_manager_->SubmitPassed(); | 485 provisional_save_manager_->SubmitPassed(); |
| 486 | 486 |
| 487 if (ShouldPromptUserToSavePassword()) { | 487 if (ShouldPromptUserToSavePassword()) { |
| 488 if (logger) | 488 if (logger) |
| 489 logger->LogMessage(Logger::STRING_DECISION_ASK); | 489 logger->LogMessage(Logger::STRING_DECISION_ASK); |
| 490 client_->PromptUserToSavePassword(provisional_save_manager_.Pass()); | 490 if (client_->PromptUserToSavePassword(provisional_save_manager_.Pass())) { |
| 491 if (logger) |
| 492 logger->LogMessage(Logger::STRING_SHOW_PASSWORD_PROMPT); |
| 493 } |
| 491 } else { | 494 } else { |
| 492 if (logger) | 495 if (logger) |
| 493 logger->LogMessage(Logger::STRING_DECISION_SAVE); | 496 logger->LogMessage(Logger::STRING_DECISION_SAVE); |
| 494 provisional_save_manager_->Save(); | 497 provisional_save_manager_->Save(); |
| 495 | 498 |
| 496 if (provisional_save_manager_->HasGeneratedPassword()) { | 499 if (provisional_save_manager_->HasGeneratedPassword()) { |
| 497 client_->AutomaticPasswordSave(provisional_save_manager_.Pass()); | 500 client_->AutomaticPasswordSave(provisional_save_manager_.Pass()); |
| 498 } else { | 501 } else { |
| 499 provisional_save_manager_.reset(); | 502 provisional_save_manager_.reset(); |
| 500 } | 503 } |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 observers_, | 583 observers_, |
| 581 OnAutofillDataAvailable(preferred_match.username_value, | 584 OnAutofillDataAvailable(preferred_match.username_value, |
| 582 preferred_match.password_value)); | 585 preferred_match.password_value)); |
| 583 break; | 586 break; |
| 584 } | 587 } |
| 585 | 588 |
| 586 client_->PasswordWasAutofilled(best_matches); | 589 client_->PasswordWasAutofilled(best_matches); |
| 587 } | 590 } |
| 588 | 591 |
| 589 } // namespace password_manager | 592 } // namespace password_manager |
| OLD | NEW |