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 // Save owner preference in local state to use on login screen. |
| 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 // Save owner preference in local state to use 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( | 466 UMA_HISTOGRAM_BOOLEAN( |
452 "FileBrowser.DownloadDestination.IsGoogleDrive.Changed", | 467 "FileBrowser.DownloadDestination.IsGoogleDrive.Changed", |
453 default_download_to_drive); | 468 default_download_to_drive); |
454 else | 469 else |
455 UMA_HISTOGRAM_BOOLEAN( | 470 UMA_HISTOGRAM_BOOLEAN( |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 | 711 |
697 input_method::AutoRepeatRate rate; | 712 input_method::AutoRepeatRate rate; |
698 rate.initial_delay_in_ms = xkb_auto_repeat_delay_pref_.GetValue(); | 713 rate.initial_delay_in_ms = xkb_auto_repeat_delay_pref_.GetValue(); |
699 rate.repeat_interval_in_ms = xkb_auto_repeat_interval_pref_.GetValue(); | 714 rate.repeat_interval_in_ms = xkb_auto_repeat_interval_pref_.GetValue(); |
700 DCHECK(rate.initial_delay_in_ms > 0); | 715 DCHECK(rate.initial_delay_in_ms > 0); |
701 DCHECK(rate.repeat_interval_in_ms > 0); | 716 DCHECK(rate.repeat_interval_in_ms > 0); |
702 input_method::XKeyboard::SetAutoRepeatRate(rate); | 717 input_method::XKeyboard::SetAutoRepeatRate(rate); |
703 } | 718 } |
704 | 719 |
705 } // namespace chromeos | 720 } // namespace chromeos |
OLD | NEW |