| 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/chromeos/preferences.h" | 5 #include "chrome/browser/chromeos/preferences.h" | 
| 6 | 6 | 
| 7 #include "base/chromeos/chromeos_version.h" | 7 #include "base/chromeos/chromeos_version.h" | 
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" | 
| 9 #include "base/i18n/time_formatting.h" | 9 #include "base/i18n/time_formatting.h" | 
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" | 
| (...skipping 12 matching lines...) Expand all  Loading... | 
| 23 #include "chrome/browser/chromeos/system/drm_settings.h" | 23 #include "chrome/browser/chromeos/system/drm_settings.h" | 
| 24 #include "chrome/browser/chromeos/system/input_device_settings.h" | 24 #include "chrome/browser/chromeos/system/input_device_settings.h" | 
| 25 #include "chrome/browser/chromeos/system/power_manager_settings.h" | 25 #include "chrome/browser/chromeos/system/power_manager_settings.h" | 
| 26 #include "chrome/browser/chromeos/system/statistics_provider.h" | 26 #include "chrome/browser/chromeos/system/statistics_provider.h" | 
| 27 #include "chrome/browser/download/download_util.h" | 27 #include "chrome/browser/download/download_util.h" | 
| 28 #include "chrome/browser/prefs/pref_service.h" | 28 #include "chrome/browser/prefs/pref_service.h" | 
| 29 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 29 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 
| 30 #include "chrome/common/chrome_notification_types.h" | 30 #include "chrome/common/chrome_notification_types.h" | 
| 31 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" | 
| 32 #include "chrome/common/pref_names.h" | 32 #include "chrome/common/pref_names.h" | 
| 33 #include "content/public/browser/notification_details.h" |  | 
| 34 #include "content/public/browser/notification_source.h" |  | 
| 35 #include "googleurl/src/gurl.h" | 33 #include "googleurl/src/gurl.h" | 
| 36 #include "ui/base/events/event_constants.h" | 34 #include "ui/base/events/event_constants.h" | 
| 37 #include "unicode/timezone.h" | 35 #include "unicode/timezone.h" | 
| 38 | 36 | 
| 39 namespace chromeos { | 37 namespace chromeos { | 
| 40 | 38 | 
| 41 static const char kFallbackInputMethodLocale[] = "en-US"; | 39 static const char kFallbackInputMethodLocale[] = "en-US"; | 
| 42 | 40 | 
| 43 Preferences::Preferences() | 41 Preferences::Preferences() | 
| 44     : prefs_(NULL), | 42     : prefs_(NULL), | 
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 379 } | 377 } | 
| 380 | 378 | 
| 381 void Preferences::InitUserPrefsForTesting(PrefService* prefs) { | 379 void Preferences::InitUserPrefsForTesting(PrefService* prefs) { | 
| 382   InitUserPrefs(prefs); | 380   InitUserPrefs(prefs); | 
| 383 } | 381 } | 
| 384 | 382 | 
| 385 void Preferences::SetInputMethodListForTesting() { | 383 void Preferences::SetInputMethodListForTesting() { | 
| 386   SetInputMethodList(); | 384   SetInputMethodList(); | 
| 387 } | 385 } | 
| 388 | 386 | 
| 389 void Preferences::Observe(int type, | 387 void Preferences::OnPreferenceChanged(PrefServiceBase* service, | 
| 390                           const content::NotificationSource& source, | 388                                       const std::string& pref_name) { | 
| 391                           const content::NotificationDetails& details) { | 389   NotifyPrefChanged(&pref_name); | 
| 392   if (type == chrome::NOTIFICATION_PREF_CHANGED) |  | 
| 393     NotifyPrefChanged(content::Details<std::string>(details).ptr()); |  | 
| 394 } | 390 } | 
| 395 | 391 | 
| 396 void Preferences::NotifyPrefChanged(const std::string* pref_name) { | 392 void Preferences::NotifyPrefChanged(const std::string* pref_name) { | 
| 397   if (!pref_name || *pref_name == prefs::kTapToClickEnabled) { | 393   if (!pref_name || *pref_name == prefs::kTapToClickEnabled) { | 
| 398     const bool enabled = tap_to_click_enabled_.GetValue(); | 394     const bool enabled = tap_to_click_enabled_.GetValue(); | 
| 399     system::touchpad_settings::SetTapToClick(enabled); | 395     system::touchpad_settings::SetTapToClick(enabled); | 
| 400     if (pref_name) | 396     if (pref_name) | 
| 401       UMA_HISTOGRAM_BOOLEAN("Touchpad.TapToClick.Changed", enabled); | 397       UMA_HISTOGRAM_BOOLEAN("Touchpad.TapToClick.Changed", enabled); | 
| 402     else | 398     else | 
| 403       UMA_HISTOGRAM_BOOLEAN("Touchpad.TapToClick.Started", enabled); | 399       UMA_HISTOGRAM_BOOLEAN("Touchpad.TapToClick.Started", enabled); | 
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 744 | 740 | 
| 745   input_method::AutoRepeatRate rate; | 741   input_method::AutoRepeatRate rate; | 
| 746   rate.initial_delay_in_ms = xkb_auto_repeat_delay_pref_.GetValue(); | 742   rate.initial_delay_in_ms = xkb_auto_repeat_delay_pref_.GetValue(); | 
| 747   rate.repeat_interval_in_ms = xkb_auto_repeat_interval_pref_.GetValue(); | 743   rate.repeat_interval_in_ms = xkb_auto_repeat_interval_pref_.GetValue(); | 
| 748   DCHECK(rate.initial_delay_in_ms > 0); | 744   DCHECK(rate.initial_delay_in_ms > 0); | 
| 749   DCHECK(rate.repeat_interval_in_ms > 0); | 745   DCHECK(rate.repeat_interval_in_ms > 0); | 
| 750   input_method::XKeyboard::SetAutoRepeatRate(rate); | 746   input_method::XKeyboard::SetAutoRepeatRate(rate); | 
| 751 } | 747 } | 
| 752 | 748 | 
| 753 }  // namespace chromeos | 749 }  // namespace chromeos | 
| OLD | NEW | 
|---|