| 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" |
| 11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/threading/platform_thread.h" | 13 #include "base/threading/platform_thread.h" |
| 14 #include "components/autofill/core/common/password_autofill_util.h" | 14 #include "components/autofill/core/common/password_autofill_util.h" |
| 15 #include "components/password_manager/core/browser/browser_save_password_progres
s_logger.h" | 15 #include "components/password_manager/core/browser/browser_save_password_progres
s_logger.h" |
| 16 #include "components/password_manager/core/browser/password_autofill_manager.h" | 16 #include "components/password_manager/core/browser/password_autofill_manager.h" |
| 17 #include "components/password_manager/core/browser/password_form_manager.h" | 17 #include "components/password_manager/core/browser/password_form_manager.h" |
| 18 #include "components/password_manager/core/browser/password_manager_client.h" | 18 #include "components/password_manager/core/browser/password_manager_client.h" |
| 19 #include "components/password_manager/core/browser/password_manager_driver.h" | 19 #include "components/password_manager/core/browser/password_manager_driver.h" |
| 20 #include "components/password_manager/core/browser/password_manager_metrics_util
.h" | 20 #include "components/password_manager/core/browser/password_manager_metrics_util
.h" |
| 21 #include "components/password_manager/core/common/password_manager_pref_names.h" | 21 #include "components/password_manager/core/common/password_manager_pref_names.h" |
| 22 #include "components/password_manager/core/common/password_manager_switches.h" | 22 #include "components/password_manager/core/common/password_manager_switches.h" |
| 23 #include "components/pref_registry/pref_registry_syncable.h" | 23 #include "components/pref_registry/pref_registry_syncable.h" |
| 24 | 24 |
| 25 #if defined(OS_WIN) |
| 26 #include "base/prefs/pref_registry_simple.h" |
| 27 #endif |
| 28 |
| 25 using autofill::PasswordForm; | 29 using autofill::PasswordForm; |
| 26 using autofill::PasswordFormMap; | 30 using autofill::PasswordFormMap; |
| 27 | 31 |
| 28 namespace password_manager { | 32 namespace password_manager { |
| 29 | 33 |
| 30 namespace { | 34 namespace { |
| 31 | 35 |
| 32 const char kSpdyProxyRealm[] = "/SpdyProxy"; | 36 const char kSpdyProxyRealm[] = "/SpdyProxy"; |
| 33 | 37 |
| 34 // Shorten the name to spare line breaks. The code provides enough context | 38 // Shorten the name to spare line breaks. The code provides enough context |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 true, | 102 true, |
| 99 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 103 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
| 100 registry->RegisterBooleanPref( | 104 registry->RegisterBooleanPref( |
| 101 prefs::kPasswordManagerAllowShowPasswords, | 105 prefs::kPasswordManagerAllowShowPasswords, |
| 102 true, | 106 true, |
| 103 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 107 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 104 registry->RegisterListPref(prefs::kPasswordManagerGroupsForDomains, | 108 registry->RegisterListPref(prefs::kPasswordManagerGroupsForDomains, |
| 105 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 109 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 106 } | 110 } |
| 107 | 111 |
| 112 #if defined(OS_WIN) |
| 113 // static |
| 114 void PasswordManager::RegisterLocalPrefs(PrefRegistrySimple* registry) { |
| 115 registry->RegisterInt64Pref(prefs::kOsPasswordLastChanged, 0); |
| 116 registry->RegisterBooleanPref(prefs::kOsPasswordBlank, false); |
| 117 } |
| 118 #endif |
| 119 |
| 108 PasswordManager::PasswordManager(PasswordManagerClient* client) | 120 PasswordManager::PasswordManager(PasswordManagerClient* client) |
| 109 : client_(client), driver_(client->GetDriver()) { | 121 : client_(client), driver_(client->GetDriver()) { |
| 110 DCHECK(client_); | 122 DCHECK(client_); |
| 111 DCHECK(driver_); | 123 DCHECK(driver_); |
| 112 saving_passwords_enabled_.Init(prefs::kPasswordManagerSavingEnabled, | 124 saving_passwords_enabled_.Init(prefs::kPasswordManagerSavingEnabled, |
| 113 client_->GetPrefs()); | 125 client_->GetPrefs()); |
| 114 | 126 |
| 115 ReportMetrics(*saving_passwords_enabled_); | 127 ReportMetrics(*saving_passwords_enabled_); |
| 116 } | 128 } |
| 117 | 129 |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 observers_, | 580 observers_, |
| 569 OnAutofillDataAvailable(preferred_match.username_value, | 581 OnAutofillDataAvailable(preferred_match.username_value, |
| 570 preferred_match.password_value)); | 582 preferred_match.password_value)); |
| 571 break; | 583 break; |
| 572 } | 584 } |
| 573 | 585 |
| 574 client_->PasswordWasAutofilled(best_matches); | 586 client_->PasswordWasAutofilled(best_matches); |
| 575 } | 587 } |
| 576 | 588 |
| 577 } // namespace password_manager | 589 } // namespace password_manager |
| OLD | NEW |