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" |
11 #include "base/string_split.h" | 11 #include "base/string_split.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "chrome/browser/api/prefs/pref_member.h" | 14 #include "chrome/browser/api/prefs/pref_member.h" |
15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
16 #include "chrome/browser/chromeos/display/display_preferences.h" | 16 #include "chrome/browser/chromeos/display/display_preferences.h" |
17 #include "chrome/browser/chromeos/gdata/drive_file_system_util.h" | 17 #include "chrome/browser/chromeos/gdata/drive_file_system_util.h" |
18 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 18 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
19 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 19 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
20 #include "chrome/browser/chromeos/input_method/xkeyboard.h" | 20 #include "chrome/browser/chromeos/input_method/xkeyboard.h" |
21 #include "chrome/browser/chromeos/login/login_utils.h" | 21 #include "chrome/browser/chromeos/login/login_utils.h" |
22 #include "chrome/browser/chromeos/login/user_manager.h" | |
22 #include "chrome/browser/chromeos/system/drm_settings.h" | 23 #include "chrome/browser/chromeos/system/drm_settings.h" |
23 #include "chrome/browser/chromeos/system/input_device_settings.h" | 24 #include "chrome/browser/chromeos/system/input_device_settings.h" |
24 #include "chrome/browser/chromeos/system/power_manager_settings.h" | 25 #include "chrome/browser/chromeos/system/power_manager_settings.h" |
25 #include "chrome/browser/chromeos/system/statistics_provider.h" | 26 #include "chrome/browser/chromeos/system/statistics_provider.h" |
26 #include "chrome/browser/download/download_util.h" | 27 #include "chrome/browser/download/download_util.h" |
27 #include "chrome/browser/prefs/pref_service.h" | 28 #include "chrome/browser/prefs/pref_service.h" |
28 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 29 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
29 #include "chrome/common/chrome_notification_types.h" | 30 #include "chrome/common/chrome_notification_types.h" |
30 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
31 #include "chrome/common/pref_names.h" | 32 #include "chrome/common/pref_names.h" |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
390 } | 391 } |
391 | 392 |
392 void Preferences::NotifyPrefChanged(const std::string* pref_name) { | 393 void Preferences::NotifyPrefChanged(const std::string* pref_name) { |
393 if (!pref_name || *pref_name == prefs::kTapToClickEnabled) { | 394 if (!pref_name || *pref_name == prefs::kTapToClickEnabled) { |
394 const bool enabled = tap_to_click_enabled_.GetValue(); | 395 const bool enabled = tap_to_click_enabled_.GetValue(); |
395 system::touchpad_settings::SetTapToClick(enabled); | 396 system::touchpad_settings::SetTapToClick(enabled); |
396 if (pref_name) | 397 if (pref_name) |
397 UMA_HISTOGRAM_BOOLEAN("Touchpad.TapToClick.Changed", enabled); | 398 UMA_HISTOGRAM_BOOLEAN("Touchpad.TapToClick.Changed", enabled); |
398 else | 399 else |
399 UMA_HISTOGRAM_BOOLEAN("Touchpad.TapToClick.Started", enabled); | 400 UMA_HISTOGRAM_BOOLEAN("Touchpad.TapToClick.Started", enabled); |
401 | |
402 // Remember owner preference to use it on login screen. | |
achuithb
2012/09/13 10:08:48
nit: Let's change this comment to:
// Save owner p
Dmitry Polukhin
2012/09/13 10:16:38
Done.
| |
403 if (chromeos::UserManager::Get()->IsCurrentUserOwner()) { | |
404 PrefService* prefs = g_browser_process->local_state(); | |
405 if (prefs->GetBoolean(prefs::kOwnerTapToClickEnabled) != enabled) | |
406 prefs->SetBoolean(prefs::kOwnerTapToClickEnabled, enabled); | |
407 } | |
400 } | 408 } |
401 if (!pref_name || *pref_name == prefs::kEnableTouchpadThreeFingerClick) { | 409 if (!pref_name || *pref_name == prefs::kEnableTouchpadThreeFingerClick) { |
402 const bool enabled = three_finger_click_enabled_.GetValue(); | 410 const bool enabled = three_finger_click_enabled_.GetValue(); |
403 system::touchpad_settings::SetThreeFingerClick(enabled); | 411 system::touchpad_settings::SetThreeFingerClick(enabled); |
404 if (pref_name) | 412 if (pref_name) |
405 UMA_HISTOGRAM_BOOLEAN("Touchpad.ThreeFingerClick.Changed", enabled); | 413 UMA_HISTOGRAM_BOOLEAN("Touchpad.ThreeFingerClick.Changed", enabled); |
406 else | 414 else |
407 UMA_HISTOGRAM_BOOLEAN("Touchpad.ThreeFingerClick.Started", enabled); | 415 UMA_HISTOGRAM_BOOLEAN("Touchpad.ThreeFingerClick.Started", enabled); |
408 } | 416 } |
409 if (!pref_name || *pref_name == prefs::kNaturalScroll) { | 417 if (!pref_name || *pref_name == prefs::kNaturalScroll) { |
(...skipping 26 matching lines...) Expand all Loading... | |
436 "Touchpad.Sensitivity.Started", sensitivity, 1, 5, 5); | 444 "Touchpad.Sensitivity.Started", sensitivity, 1, 5, 5); |
437 } | 445 } |
438 } | 446 } |
439 if (!pref_name || *pref_name == prefs::kPrimaryMouseButtonRight) { | 447 if (!pref_name || *pref_name == prefs::kPrimaryMouseButtonRight) { |
440 const bool right = primary_mouse_button_right_.GetValue(); | 448 const bool right = primary_mouse_button_right_.GetValue(); |
441 system::mouse_settings::SetPrimaryButtonRight(right); | 449 system::mouse_settings::SetPrimaryButtonRight(right); |
442 if (pref_name) | 450 if (pref_name) |
443 UMA_HISTOGRAM_BOOLEAN("Mouse.PrimaryButtonRight.Changed", right); | 451 UMA_HISTOGRAM_BOOLEAN("Mouse.PrimaryButtonRight.Changed", right); |
444 else | 452 else |
445 UMA_HISTOGRAM_BOOLEAN("Mouse.PrimaryButtonRight.Started", right); | 453 UMA_HISTOGRAM_BOOLEAN("Mouse.PrimaryButtonRight.Started", right); |
454 | |
455 // Remember owner preference to use it on login screen. | |
456 if (chromeos::UserManager::Get()->IsCurrentUserOwner()) { | |
457 PrefService* prefs = g_browser_process->local_state(); | |
458 if (prefs->GetBoolean(prefs::kOwnerPrimaryMouseButtonRight) != right) | |
459 prefs->SetBoolean(prefs::kOwnerPrimaryMouseButtonRight, right); | |
460 } | |
446 } | 461 } |
447 if (!pref_name || *pref_name == prefs::kDownloadDefaultDirectory) { | 462 if (!pref_name || *pref_name == prefs::kDownloadDefaultDirectory) { |
448 const bool default_download_to_drive = gdata::util::IsUnderDriveMountPoint( | 463 const bool default_download_to_drive = gdata::util::IsUnderDriveMountPoint( |
449 download_default_directory_.GetValue()); | 464 download_default_directory_.GetValue()); |
450 if (pref_name) | 465 if (pref_name) |
451 UMA_HISTOGRAM_BOOLEAN("FileBrowser.DownloadDestination.IsDrive.Changed", | 466 UMA_HISTOGRAM_BOOLEAN("FileBrowser.DownloadDestination.IsDrive.Changed", |
452 default_download_to_drive); | 467 default_download_to_drive); |
453 else | 468 else |
454 UMA_HISTOGRAM_BOOLEAN("FileBrowser.DownloadDestination.IsDrive.Started", | 469 UMA_HISTOGRAM_BOOLEAN("FileBrowser.DownloadDestination.IsDrive.Started", |
455 default_download_to_drive); | 470 default_download_to_drive); |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
694 | 709 |
695 input_method::AutoRepeatRate rate; | 710 input_method::AutoRepeatRate rate; |
696 rate.initial_delay_in_ms = xkb_auto_repeat_delay_pref_.GetValue(); | 711 rate.initial_delay_in_ms = xkb_auto_repeat_delay_pref_.GetValue(); |
697 rate.repeat_interval_in_ms = xkb_auto_repeat_interval_pref_.GetValue(); | 712 rate.repeat_interval_in_ms = xkb_auto_repeat_interval_pref_.GetValue(); |
698 DCHECK(rate.initial_delay_in_ms > 0); | 713 DCHECK(rate.initial_delay_in_ms > 0); |
699 DCHECK(rate.repeat_interval_in_ms > 0); | 714 DCHECK(rate.repeat_interval_in_ms > 0); |
700 input_method::XKeyboard::SetAutoRepeatRate(rate); | 715 input_method::XKeyboard::SetAutoRepeatRate(rate); |
701 } | 716 } |
702 | 717 |
703 } // namespace chromeos | 718 } // namespace chromeos |
OLD | NEW |