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

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

Issue 139803010: Support comma separated hardware keyboard layout. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: /EnableInputMethods/ReplaceEnabeldInputMethods/ Created 6 years, 10 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 <vector>
8
7 #include "ash/autoclick/autoclick_controller.h" 9 #include "ash/autoclick/autoclick_controller.h"
8 #include "ash/magnifier/magnifier_constants.h" 10 #include "ash/magnifier/magnifier_constants.h"
9 #include "ash/shell.h" 11 #include "ash/shell.h"
10 #include "base/command_line.h" 12 #include "base/command_line.h"
11 #include "base/i18n/time_formatting.h" 13 #include "base/i18n/time_formatting.h"
12 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
13 #include "base/prefs/pref_member.h" 15 #include "base/prefs/pref_member.h"
14 #include "base/prefs/pref_registry_simple.h" 16 #include "base/prefs/pref_registry_simple.h"
15 #include "base/prefs/scoped_user_pref_update.h" 17 #include "base/prefs/scoped_user_pref_update.h"
16 #include "base/strings/string_split.h" 18 #include "base/strings/string_split.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 registry->RegisterBooleanPref(prefs::kOwnerTapToClickEnabled, true); 82 registry->RegisterBooleanPref(prefs::kOwnerTapToClickEnabled, true);
81 registry->RegisterBooleanPref(prefs::kVirtualKeyboardEnabled, false); 83 registry->RegisterBooleanPref(prefs::kVirtualKeyboardEnabled, false);
82 } 84 }
83 85
84 // static 86 // static
85 void Preferences::RegisterProfilePrefs( 87 void Preferences::RegisterProfilePrefs(
86 user_prefs::PrefRegistrySyncable* registry) { 88 user_prefs::PrefRegistrySyncable* registry) {
87 std::string hardware_keyboard_id; 89 std::string hardware_keyboard_id;
88 // TODO(yusukes): Remove the runtime hack. 90 // TODO(yusukes): Remove the runtime hack.
89 if (base::SysInfo::IsRunningOnChromeOS()) { 91 if (base::SysInfo::IsRunningOnChromeOS()) {
90 input_method::InputMethodManager* manager = 92 DCHECK(g_browser_process);
91 input_method::InputMethodManager::Get(); 93 PrefService* local_state = g_browser_process->local_state();
92 if (manager) { 94 DCHECK(local_state);
93 hardware_keyboard_id = 95 hardware_keyboard_id =
94 manager->GetInputMethodUtil()->GetHardwareInputMethodId(); 96 local_state->GetString(prefs::kHardwareKeyboardLayout);
95 }
96 } else { 97 } else {
97 hardware_keyboard_id = "xkb:us::eng"; // only for testing. 98 hardware_keyboard_id = "xkb:us::eng"; // only for testing.
98 } 99 }
99 100
100 registry->RegisterBooleanPref( 101 registry->RegisterBooleanPref(
101 prefs::kPerformanceTracingEnabled, 102 prefs::kPerformanceTracingEnabled,
102 false, 103 false,
103 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 104 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
104 105
105 registry->RegisterBooleanPref( 106 registry->RegisterBooleanPref(
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 const char* name, 576 const char* name,
576 const std::string& value) { 577 const std::string& value) {
577 VLOG(1) << "Setting " << name << " to '" << value << "'"; 578 VLOG(1) << "Setting " << name << " to '" << value << "'";
578 579
579 std::vector<std::string> split_values; 580 std::vector<std::string> split_values;
580 if (!value.empty()) 581 if (!value.empty())
581 base::SplitString(value, ',', &split_values); 582 base::SplitString(value, ',', &split_values);
582 583
583 if (section == std::string(language_prefs::kGeneralSectionName) && 584 if (section == std::string(language_prefs::kGeneralSectionName) &&
584 name == std::string(language_prefs::kPreloadEnginesConfigName)) { 585 name == std::string(language_prefs::kPreloadEnginesConfigName)) {
585 input_method_manager_->EnableInputMethods(split_values); 586 input_method_manager_->ReplaceEnabledInputMethods(split_values);
586 return; 587 return;
587 } 588 }
588 } 589 }
589 590
590 void Preferences::SetInputMethodList() { 591 void Preferences::SetInputMethodList() {
591 // When |preload_engines_| are set, InputMethodManager::ChangeInputMethod() 592 // When |preload_engines_| are set, InputMethodManager::ChangeInputMethod()
592 // might be called to change the current input method to the first one in the 593 // might be called to change the current input method to the first one in the
593 // |preload_engines_| list. This also updates previous/current input method 594 // |preload_engines_| list. This also updates previous/current input method
594 // prefs. That's why GetValue() calls are placed before the 595 // prefs. That's why GetValue() calls are placed before the
595 // SetLanguageConfigStringListAsCSV() call below. 596 // SetLanguageConfigStringListAsCSV() call below.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 touch_hud_projection_enabled_.SetValue(enabled); 631 touch_hud_projection_enabled_.SetValue(enabled);
631 } 632 }
632 633
633 void Preferences::ActiveUserChanged(const User* active_user) { 634 void Preferences::ActiveUserChanged(const User* active_user) {
634 if (active_user != user_) 635 if (active_user != user_)
635 return; 636 return;
636 ApplyPreferences(REASON_ACTIVE_USER_CHANGED, ""); 637 ApplyPreferences(REASON_ACTIVE_USER_CHANGED, "");
637 } 638 }
638 639
639 } // namespace chromeos 640 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698