Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(684)

Side by Side Diff: chrome/browser/chromeos/preferences.cc

Issue 10913163: Honor owner tap-to-click and mouse buttons swap on login screen (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added comments Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 // Remember owner preference to use it on login screen.
401 if (chromeos::UserManager::Get()->IsCurrentUserOwner()) {
402 PrefService* prefs = g_browser_process->local_state();
403 if (prefs->GetBoolean(prefs::kOwnerTapToClickEnabled) != enabled)
404 prefs->SetBoolean(prefs::kOwnerTapToClickEnabled, enabled);
405 }
398 } 406 }
399 if (!pref_name || *pref_name == prefs::kEnableTouchpadThreeFingerClick) { 407 if (!pref_name || *pref_name == prefs::kEnableTouchpadThreeFingerClick) {
400 const bool enabled = three_finger_click_enabled_.GetValue(); 408 const bool enabled = three_finger_click_enabled_.GetValue();
401 system::touchpad_settings::SetThreeFingerClick(enabled); 409 system::touchpad_settings::SetThreeFingerClick(enabled);
402 if (pref_name) 410 if (pref_name)
403 UMA_HISTOGRAM_BOOLEAN("Touchpad.ThreeFingerClick.Changed", enabled); 411 UMA_HISTOGRAM_BOOLEAN("Touchpad.ThreeFingerClick.Changed", enabled);
404 else 412 else
405 UMA_HISTOGRAM_BOOLEAN("Touchpad.ThreeFingerClick.Started", enabled); 413 UMA_HISTOGRAM_BOOLEAN("Touchpad.ThreeFingerClick.Started", enabled);
406 } 414 }
407 if (!pref_name || *pref_name == prefs::kNaturalScroll) { 415 if (!pref_name || *pref_name == prefs::kNaturalScroll) {
(...skipping 26 matching lines...) Expand all
434 "Touchpad.Sensitivity.Started", sensitivity, 1, 5, 5); 442 "Touchpad.Sensitivity.Started", sensitivity, 1, 5, 5);
435 } 443 }
436 } 444 }
437 if (!pref_name || *pref_name == prefs::kPrimaryMouseButtonRight) { 445 if (!pref_name || *pref_name == prefs::kPrimaryMouseButtonRight) {
438 const bool right = primary_mouse_button_right_.GetValue(); 446 const bool right = primary_mouse_button_right_.GetValue();
439 system::mouse_settings::SetPrimaryButtonRight(right); 447 system::mouse_settings::SetPrimaryButtonRight(right);
440 if (pref_name) 448 if (pref_name)
441 UMA_HISTOGRAM_BOOLEAN("Mouse.PrimaryButtonRight.Changed", right); 449 UMA_HISTOGRAM_BOOLEAN("Mouse.PrimaryButtonRight.Changed", right);
442 else 450 else
443 UMA_HISTOGRAM_BOOLEAN("Mouse.PrimaryButtonRight.Started", right); 451 UMA_HISTOGRAM_BOOLEAN("Mouse.PrimaryButtonRight.Started", right);
452
453 // Remember owner preference to use it on login screen.
454 if (chromeos::UserManager::Get()->IsCurrentUserOwner()) {
455 PrefService* prefs = g_browser_process->local_state();
456 if (prefs->GetBoolean(prefs::kOwnerPrimaryMouseButtonRight) != right)
457 prefs->SetBoolean(prefs::kOwnerPrimaryMouseButtonRight, right);
458 }
444 } 459 }
445 460
446 if (!pref_name || *pref_name == prefs::kLanguagePreferredLanguages) { 461 if (!pref_name || *pref_name == prefs::kLanguagePreferredLanguages) {
447 // Unlike kLanguagePreloadEngines and some other input method 462 // Unlike kLanguagePreloadEngines and some other input method
448 // preferencs, we don't need to send this to ibus-daemon. 463 // preferencs, we don't need to send this to ibus-daemon.
449 } 464 }
450 465
451 if (!pref_name || *pref_name == prefs::kLanguageXkbAutoRepeatEnabled) { 466 if (!pref_name || *pref_name == prefs::kLanguageXkbAutoRepeatEnabled) {
452 const bool enabled = xkb_auto_repeat_enabled_.GetValue(); 467 const bool enabled = xkb_auto_repeat_enabled_.GetValue();
453 input_method::XKeyboard::SetAutoRepeatEnabled(enabled); 468 input_method::XKeyboard::SetAutoRepeatEnabled(enabled);
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 698
684 input_method::AutoRepeatRate rate; 699 input_method::AutoRepeatRate rate;
685 rate.initial_delay_in_ms = xkb_auto_repeat_delay_pref_.GetValue(); 700 rate.initial_delay_in_ms = xkb_auto_repeat_delay_pref_.GetValue();
686 rate.repeat_interval_in_ms = xkb_auto_repeat_interval_pref_.GetValue(); 701 rate.repeat_interval_in_ms = xkb_auto_repeat_interval_pref_.GetValue();
687 DCHECK(rate.initial_delay_in_ms > 0); 702 DCHECK(rate.initial_delay_in_ms > 0);
688 DCHECK(rate.repeat_interval_in_ms > 0); 703 DCHECK(rate.repeat_interval_in_ms > 0);
689 input_method::XKeyboard::SetAutoRepeatRate(rate); 704 input_method::XKeyboard::SetAutoRepeatRate(rate);
690 } 705 }
691 706
692 } // namespace chromeos 707 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698