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 void PasswordManager::RegisterLocalPrefs(PrefRegistrySimple* registry) { | |
vabr (Chromium)
2014/10/15 15:10:46
nit: Put the following line above the current one:
Jitu( very slow this week)
2014/10/16 04:14:11
Done.
| |
114 registry->RegisterInt64Pref(prefs::kOsPasswordLastChanged, 0); | |
115 registry->RegisterBooleanPref(prefs::kOsPasswordBlank, false); | |
116 } | |
117 #endif | |
118 | |
108 PasswordManager::PasswordManager(PasswordManagerClient* client) | 119 PasswordManager::PasswordManager(PasswordManagerClient* client) |
109 : client_(client), driver_(client->GetDriver()) { | 120 : client_(client), driver_(client->GetDriver()) { |
110 DCHECK(client_); | 121 DCHECK(client_); |
111 DCHECK(driver_); | 122 DCHECK(driver_); |
112 saving_passwords_enabled_.Init(prefs::kPasswordManagerSavingEnabled, | 123 saving_passwords_enabled_.Init(prefs::kPasswordManagerSavingEnabled, |
113 client_->GetPrefs()); | 124 client_->GetPrefs()); |
114 | 125 |
115 ReportMetrics(*saving_passwords_enabled_); | 126 ReportMetrics(*saving_passwords_enabled_); |
116 } | 127 } |
117 | 128 |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
568 observers_, | 579 observers_, |
569 OnAutofillDataAvailable(preferred_match.username_value, | 580 OnAutofillDataAvailable(preferred_match.username_value, |
570 preferred_match.password_value)); | 581 preferred_match.password_value)); |
571 break; | 582 break; |
572 } | 583 } |
573 | 584 |
574 client_->PasswordWasAutofilled(best_matches); | 585 client_->PasswordWasAutofilled(best_matches); |
575 } | 586 } |
576 | 587 |
577 } // namespace password_manager | 588 } // namespace password_manager |
OLD | NEW |