| OLD | NEW | 
|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <vector> | 7 #include <vector> | 
| 8 | 8 | 
| 9 #include "base/stl_util-inl.h" | 9 #include "base/stl_util-inl.h" | 
| 10 #include "base/threading/platform_thread.h" | 10 #include "base/threading/platform_thread.h" | 
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" | 
| 12 #include "chrome/browser/password_manager/password_form_manager.h" | 12 #include "chrome/browser/password_manager/password_form_manager.h" | 
| 13 #include "chrome/browser/password_manager/password_manager_delegate.h" | 13 #include "chrome/browser/password_manager/password_manager_delegate.h" | 
| 14 #include "chrome/browser/prefs/pref_service.h" | 14 #include "chrome/browser/prefs/pref_service.h" | 
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" | 
| 16 #include "chrome/common/autofill_messages.h" | 16 #include "chrome/common/autofill_messages.h" | 
| 17 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" | 
| 18 #include "content/browser/user_metrics.h" | 18 #include "content/browser/user_metrics.h" | 
| 19 #include "content/common/view_messages.h" | 19 #include "content/common/view_messages.h" | 
| 20 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" | 
| 21 | 21 | 
| 22 using webkit_glue::PasswordForm; | 22 using webkit_glue::PasswordForm; | 
| 23 using webkit_glue::PasswordFormMap; | 23 using webkit_glue::PasswordFormMap; | 
| 24 | 24 | 
| 25 // static | 25 // static | 
| 26 void PasswordManager::RegisterUserPrefs(PrefService* prefs) { | 26 void PasswordManager::RegisterUserPrefs(PrefService* prefs) { | 
| 27   prefs->RegisterBooleanPref(prefs::kPasswordManagerEnabled, true); | 27   prefs->RegisterBooleanPref(prefs::kPasswordManagerEnabled, | 
| 28   prefs->RegisterBooleanPref(prefs::kPasswordManagerAllowShowPasswords, true); | 28                              true, | 
|  | 29                              true /* sync pref */); | 
|  | 30   prefs->RegisterBooleanPref(prefs::kPasswordManagerAllowShowPasswords, | 
|  | 31                              true, | 
|  | 32                              false /* don't sync pref */); | 
| 29 } | 33 } | 
| 30 | 34 | 
| 31 // This routine is called when PasswordManagers are constructed. | 35 // This routine is called when PasswordManagers are constructed. | 
| 32 // | 36 // | 
| 33 // Currently we report metrics only once at startup. We require | 37 // Currently we report metrics only once at startup. We require | 
| 34 // that this is only ever called from a single thread in order to | 38 // that this is only ever called from a single thread in order to | 
| 35 // avoid needing to lock (a static boolean flag is then sufficient to | 39 // avoid needing to lock (a static boolean flag is then sufficient to | 
| 36 // guarantee running only once). | 40 // guarantee running only once). | 
| 37 static void ReportMetrics(bool password_manager_enabled) { | 41 static void ReportMetrics(bool password_manager_enabled) { | 
| 38   static base::PlatformThreadId initial_thread_id = | 42   static base::PlatformThreadId initial_thread_id = | 
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 231       return; | 235       return; | 
| 232     } | 236     } | 
| 233     default: | 237     default: | 
| 234       if (observer_) { | 238       if (observer_) { | 
| 235         observer_->OnAutofillDataAvailable( | 239         observer_->OnAutofillDataAvailable( | 
| 236             UTF16ToWideHack(preferred_match->username_value), | 240             UTF16ToWideHack(preferred_match->username_value), | 
| 237             UTF16ToWideHack(preferred_match->password_value)); | 241             UTF16ToWideHack(preferred_match->password_value)); | 
| 238       } | 242       } | 
| 239   } | 243   } | 
| 240 } | 244 } | 
| OLD | NEW | 
|---|