| 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 "ash/magnifier/magnifier_constants.h" | 7 #include "ash/magnifier/magnifier_constants.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "base/chromeos/chromeos_version.h" | |
| 10 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 11 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
| 12 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 13 #include "base/prefs/pref_member.h" | 12 #include "base/prefs/pref_member.h" |
| 14 #include "base/prefs/pref_registry_simple.h" | 13 #include "base/prefs/pref_registry_simple.h" |
| 15 #include "base/strings/string_split.h" | 14 #include "base/strings/string_split.h" |
| 16 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 17 #include "base/sys_info.h" |
| 18 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
| 19 #include "chrome/browser/chrome_notification_types.h" | 19 #include "chrome/browser/chrome_notification_types.h" |
| 20 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | 20 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
| 21 #include "chrome/browser/chromeos/drive/file_system_util.h" | 21 #include "chrome/browser/chromeos/drive/file_system_util.h" |
| 22 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 22 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 23 #include "chrome/browser/chromeos/login/login_utils.h" | 23 #include "chrome/browser/chromeos/login/login_utils.h" |
| 24 #include "chrome/browser/chromeos/login/user_manager.h" | 24 #include "chrome/browser/chromeos/login/user_manager.h" |
| 25 #include "chrome/browser/chromeos/system/input_device_settings.h" | 25 #include "chrome/browser/chromeos/system/input_device_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_prefs.h" | 27 #include "chrome/browser/download/download_prefs.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 registry->RegisterBooleanPref(prefs::kOwnerPrimaryMouseButtonRight, false); | 78 registry->RegisterBooleanPref(prefs::kOwnerPrimaryMouseButtonRight, false); |
| 79 registry->RegisterBooleanPref(prefs::kOwnerTapToClickEnabled, true); | 79 registry->RegisterBooleanPref(prefs::kOwnerTapToClickEnabled, true); |
| 80 registry->RegisterBooleanPref(prefs::kVirtualKeyboardEnabled, false); | 80 registry->RegisterBooleanPref(prefs::kVirtualKeyboardEnabled, false); |
| 81 } | 81 } |
| 82 | 82 |
| 83 // static | 83 // static |
| 84 void Preferences::RegisterProfilePrefs( | 84 void Preferences::RegisterProfilePrefs( |
| 85 user_prefs::PrefRegistrySyncable* registry) { | 85 user_prefs::PrefRegistrySyncable* registry) { |
| 86 std::string hardware_keyboard_id; | 86 std::string hardware_keyboard_id; |
| 87 // TODO(yusukes): Remove the runtime hack. | 87 // TODO(yusukes): Remove the runtime hack. |
| 88 if (base::chromeos::IsRunningOnChromeOS()) { | 88 if (base::SysInfo::IsRunningOnChromeOS()) { |
| 89 input_method::InputMethodManager* manager = | 89 input_method::InputMethodManager* manager = |
| 90 input_method::InputMethodManager::Get(); | 90 input_method::InputMethodManager::Get(); |
| 91 if (manager) { | 91 if (manager) { |
| 92 hardware_keyboard_id = | 92 hardware_keyboard_id = |
| 93 manager->GetInputMethodUtil()->GetHardwareInputMethodId(); | 93 manager->GetInputMethodUtil()->GetHardwareInputMethodId(); |
| 94 } | 94 } |
| 95 } else { | 95 } else { |
| 96 hardware_keyboard_id = "xkb:us::eng"; // only for testing. | 96 hardware_keyboard_id = "xkb:us::eng"; // only for testing. |
| 97 } | 97 } |
| 98 | 98 |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 // which could have been modified by the SetLanguageConfigStringListAsCSV call | 620 // which could have been modified by the SetLanguageConfigStringListAsCSV call |
| 621 // above to the original state. | 621 // above to the original state. |
| 622 if (!previous_input_method_id.empty()) | 622 if (!previous_input_method_id.empty()) |
| 623 input_method_manager_->ChangeInputMethod(previous_input_method_id); | 623 input_method_manager_->ChangeInputMethod(previous_input_method_id); |
| 624 if (!current_input_method_id.empty()) | 624 if (!current_input_method_id.empty()) |
| 625 input_method_manager_->ChangeInputMethod(current_input_method_id); | 625 input_method_manager_->ChangeInputMethod(current_input_method_id); |
| 626 } | 626 } |
| 627 | 627 |
| 628 void Preferences::UpdateAutoRepeatRate() { | 628 void Preferences::UpdateAutoRepeatRate() { |
| 629 // Avoid setting repeat rate on desktop dev environment. | 629 // Avoid setting repeat rate on desktop dev environment. |
| 630 if (!base::chromeos::IsRunningOnChromeOS()) | 630 if (!base::SysInfo::IsRunningOnChromeOS()) |
| 631 return; | 631 return; |
| 632 | 632 |
| 633 input_method::AutoRepeatRate rate; | 633 input_method::AutoRepeatRate rate; |
| 634 rate.initial_delay_in_ms = xkb_auto_repeat_delay_pref_.GetValue(); | 634 rate.initial_delay_in_ms = xkb_auto_repeat_delay_pref_.GetValue(); |
| 635 rate.repeat_interval_in_ms = xkb_auto_repeat_interval_pref_.GetValue(); | 635 rate.repeat_interval_in_ms = xkb_auto_repeat_interval_pref_.GetValue(); |
| 636 DCHECK(rate.initial_delay_in_ms > 0); | 636 DCHECK(rate.initial_delay_in_ms > 0); |
| 637 DCHECK(rate.repeat_interval_in_ms > 0); | 637 DCHECK(rate.repeat_interval_in_ms > 0); |
| 638 input_method::XKeyboard::SetAutoRepeatRate(rate); | 638 input_method::XKeyboard::SetAutoRepeatRate(rate); |
| 639 } | 639 } |
| 640 | 640 |
| 641 void Preferences::OnTouchHudProjectionToggled(bool enabled) { | 641 void Preferences::OnTouchHudProjectionToggled(bool enabled) { |
| 642 if (touch_hud_projection_enabled_.GetValue() == enabled) | 642 if (touch_hud_projection_enabled_.GetValue() == enabled) |
| 643 return; | 643 return; |
| 644 | 644 |
| 645 touch_hud_projection_enabled_.SetValue(enabled); | 645 touch_hud_projection_enabled_.SetValue(enabled); |
| 646 } | 646 } |
| 647 | 647 |
| 648 } // namespace chromeos | 648 } // namespace chromeos |
| OLD | NEW |