Chromium Code Reviews| 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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 388 } | 389 } |
| 389 | 390 |
| 390 void Preferences::NotifyPrefChanged(const std::string* pref_name) { | 391 void Preferences::NotifyPrefChanged(const std::string* pref_name) { |
| 391 if (!pref_name || *pref_name == prefs::kTapToClickEnabled) { | 392 if (!pref_name || *pref_name == prefs::kTapToClickEnabled) { |
| 392 const bool enabled = tap_to_click_enabled_.GetValue(); | 393 const bool enabled = tap_to_click_enabled_.GetValue(); |
| 393 system::touchpad_settings::SetTapToClick(enabled); | 394 system::touchpad_settings::SetTapToClick(enabled); |
| 394 if (pref_name) | 395 if (pref_name) |
| 395 UMA_HISTOGRAM_BOOLEAN("Touchpad.TapToClick.Changed", enabled); | 396 UMA_HISTOGRAM_BOOLEAN("Touchpad.TapToClick.Changed", enabled); |
| 396 else | 397 else |
| 397 UMA_HISTOGRAM_BOOLEAN("Touchpad.TapToClick.Started", enabled); | 398 UMA_HISTOGRAM_BOOLEAN("Touchpad.TapToClick.Started", enabled); |
| 399 | |
| 400 if (chromeos::UserManager::Get()->IsCurrentUserOwner()) { | |
|
achuithb
2012/09/10 18:07:30
Please add a comment here why this is necessary.
Dmitry Polukhin
2012/09/11 08:01:00
Done.
| |
| 401 PrefService* prefs = g_browser_process->local_state(); | |
| 402 if (prefs->GetBoolean(prefs::kOwnerTapToClickEnabled) != enabled) | |
| 403 prefs->SetBoolean(prefs::kOwnerTapToClickEnabled, enabled); | |
| 404 } | |
| 398 } | 405 } |
| 399 if (!pref_name || *pref_name == prefs::kEnableTouchpadThreeFingerClick) { | 406 if (!pref_name || *pref_name == prefs::kEnableTouchpadThreeFingerClick) { |
| 400 const bool enabled = three_finger_click_enabled_.GetValue(); | 407 const bool enabled = three_finger_click_enabled_.GetValue(); |
| 401 system::touchpad_settings::SetThreeFingerClick(enabled); | 408 system::touchpad_settings::SetThreeFingerClick(enabled); |
| 402 if (pref_name) | 409 if (pref_name) |
| 403 UMA_HISTOGRAM_BOOLEAN("Touchpad.ThreeFingerClick.Changed", enabled); | 410 UMA_HISTOGRAM_BOOLEAN("Touchpad.ThreeFingerClick.Changed", enabled); |
| 404 else | 411 else |
| 405 UMA_HISTOGRAM_BOOLEAN("Touchpad.ThreeFingerClick.Started", enabled); | 412 UMA_HISTOGRAM_BOOLEAN("Touchpad.ThreeFingerClick.Started", enabled); |
| 406 } | 413 } |
| 407 if (!pref_name || *pref_name == prefs::kNaturalScroll) { | 414 if (!pref_name || *pref_name == prefs::kNaturalScroll) { |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 434 "Touchpad.Sensitivity.Started", sensitivity, 1, 5, 5); | 441 "Touchpad.Sensitivity.Started", sensitivity, 1, 5, 5); |
| 435 } | 442 } |
| 436 } | 443 } |
| 437 if (!pref_name || *pref_name == prefs::kPrimaryMouseButtonRight) { | 444 if (!pref_name || *pref_name == prefs::kPrimaryMouseButtonRight) { |
| 438 const bool right = primary_mouse_button_right_.GetValue(); | 445 const bool right = primary_mouse_button_right_.GetValue(); |
| 439 system::mouse_settings::SetPrimaryButtonRight(right); | 446 system::mouse_settings::SetPrimaryButtonRight(right); |
| 440 if (pref_name) | 447 if (pref_name) |
| 441 UMA_HISTOGRAM_BOOLEAN("Mouse.PrimaryButtonRight.Changed", right); | 448 UMA_HISTOGRAM_BOOLEAN("Mouse.PrimaryButtonRight.Changed", right); |
| 442 else | 449 else |
| 443 UMA_HISTOGRAM_BOOLEAN("Mouse.PrimaryButtonRight.Started", right); | 450 UMA_HISTOGRAM_BOOLEAN("Mouse.PrimaryButtonRight.Started", right); |
| 451 | |
| 452 if (chromeos::UserManager::Get()->IsCurrentUserOwner()) { | |
|
achuithb
2012/09/10 18:07:30
here too.
Dmitry Polukhin
2012/09/11 08:01:00
Done.
| |
| 453 PrefService* prefs = g_browser_process->local_state(); | |
| 454 if (prefs->GetBoolean(prefs::kOwnerPrimaryMouseButtonRight) != right) | |
| 455 prefs->SetBoolean(prefs::kOwnerPrimaryMouseButtonRight, right); | |
| 456 } | |
| 444 } | 457 } |
| 445 | 458 |
| 446 if (!pref_name || *pref_name == prefs::kLanguagePreferredLanguages) { | 459 if (!pref_name || *pref_name == prefs::kLanguagePreferredLanguages) { |
| 447 // Unlike kLanguagePreloadEngines and some other input method | 460 // Unlike kLanguagePreloadEngines and some other input method |
| 448 // preferencs, we don't need to send this to ibus-daemon. | 461 // preferencs, we don't need to send this to ibus-daemon. |
| 449 } | 462 } |
| 450 | 463 |
| 451 if (!pref_name || *pref_name == prefs::kLanguageXkbAutoRepeatEnabled) { | 464 if (!pref_name || *pref_name == prefs::kLanguageXkbAutoRepeatEnabled) { |
| 452 const bool enabled = xkb_auto_repeat_enabled_.GetValue(); | 465 const bool enabled = xkb_auto_repeat_enabled_.GetValue(); |
| 453 input_method::XKeyboard::SetAutoRepeatEnabled(enabled); | 466 input_method::XKeyboard::SetAutoRepeatEnabled(enabled); |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 683 | 696 |
| 684 input_method::AutoRepeatRate rate; | 697 input_method::AutoRepeatRate rate; |
| 685 rate.initial_delay_in_ms = xkb_auto_repeat_delay_pref_.GetValue(); | 698 rate.initial_delay_in_ms = xkb_auto_repeat_delay_pref_.GetValue(); |
| 686 rate.repeat_interval_in_ms = xkb_auto_repeat_interval_pref_.GetValue(); | 699 rate.repeat_interval_in_ms = xkb_auto_repeat_interval_pref_.GetValue(); |
| 687 DCHECK(rate.initial_delay_in_ms > 0); | 700 DCHECK(rate.initial_delay_in_ms > 0); |
| 688 DCHECK(rate.repeat_interval_in_ms > 0); | 701 DCHECK(rate.repeat_interval_in_ms > 0); |
| 689 input_method::XKeyboard::SetAutoRepeatRate(rate); | 702 input_method::XKeyboard::SetAutoRepeatRate(rate); |
| 690 } | 703 } |
| 691 | 704 |
| 692 } // namespace chromeos | 705 } // namespace chromeos |
| OLD | NEW |