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/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/threading/platform_thread.h" | 10 #include "base/threading/platform_thread.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 ran_once = true; | 48 ran_once = true; |
49 | 49 |
50 // TODO(isherman): This does not actually measure a user action. It should be | 50 // TODO(isherman): This does not actually measure a user action. It should be |
51 // a boolean histogram. | 51 // a boolean histogram. |
52 if (password_manager_enabled) | 52 if (password_manager_enabled) |
53 content::RecordAction(UserMetricsAction("PasswordManager_Enabled")); | 53 content::RecordAction(UserMetricsAction("PasswordManager_Enabled")); |
54 else | 54 else |
55 content::RecordAction(UserMetricsAction("PasswordManager_Disabled")); | 55 content::RecordAction(UserMetricsAction("PasswordManager_Disabled")); |
56 } | 56 } |
57 | 57 |
58 } // anonymous namespace | 58 } // namespace |
59 | 59 |
60 // static | 60 // static |
61 void PasswordManager::RegisterUserPrefs(PrefRegistrySyncable* registry) { | 61 void PasswordManager::RegisterUserPrefs( |
62 registry->RegisterBooleanPref(prefs::kPasswordManagerEnabled, | 62 user_prefs::PrefRegistrySyncable* registry) { |
63 true, | 63 registry->RegisterBooleanPref( |
64 PrefRegistrySyncable::SYNCABLE_PREF); | 64 prefs::kPasswordManagerEnabled, |
65 registry->RegisterBooleanPref(prefs::kPasswordManagerAllowShowPasswords, | 65 true, |
66 true, | 66 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
67 PrefRegistrySyncable::UNSYNCABLE_PREF); | 67 registry->RegisterBooleanPref( |
| 68 prefs::kPasswordManagerAllowShowPasswords, |
| 69 true, |
| 70 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
68 } | 71 } |
69 | 72 |
70 // static | 73 // static |
71 void PasswordManager::CreateForWebContentsAndDelegate( | 74 void PasswordManager::CreateForWebContentsAndDelegate( |
72 content::WebContents* contents, | 75 content::WebContents* contents, |
73 PasswordManagerDelegate* delegate) { | 76 PasswordManagerDelegate* delegate) { |
74 if (FromWebContents(contents)) { | 77 if (FromWebContents(contents)) { |
75 DCHECK_EQ(delegate, FromWebContents(contents)->delegate_); | 78 DCHECK_EQ(delegate, FromWebContents(contents)->delegate_); |
76 return; | 79 return; |
77 } | 80 } |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 delegate_->FillPasswordForm(fill_data); | 317 delegate_->FillPasswordForm(fill_data); |
315 return; | 318 return; |
316 } | 319 } |
317 default: | 320 default: |
318 if (observer_) { | 321 if (observer_) { |
319 observer_->OnAutofillDataAvailable(preferred_match.username_value, | 322 observer_->OnAutofillDataAvailable(preferred_match.username_value, |
320 preferred_match.password_value); | 323 preferred_match.password_value); |
321 } | 324 } |
322 } | 325 } |
323 } | 326 } |
OLD | NEW |