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

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

Issue 7493077: Add pref entry for virtual keyboard (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 4 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
« no previous file with comments | « chrome/browser/chromeos/preferences.h ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/i18n/time_formatting.h" 7 #include "base/i18n/time_formatting.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/string_split.h" 9 #include "base/string_split.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 prefs->RegisterBooleanPref(prefs::kLanguageXkbAutoRepeatEnabled, 167 prefs->RegisterBooleanPref(prefs::kLanguageXkbAutoRepeatEnabled,
168 true, 168 true,
169 PrefService::UNSYNCABLE_PREF); 169 PrefService::UNSYNCABLE_PREF);
170 prefs->RegisterIntegerPref(prefs::kLanguageXkbAutoRepeatDelay, 170 prefs->RegisterIntegerPref(prefs::kLanguageXkbAutoRepeatDelay,
171 language_prefs::kXkbAutoRepeatDelayInMs, 171 language_prefs::kXkbAutoRepeatDelayInMs,
172 PrefService::UNSYNCABLE_PREF); 172 PrefService::UNSYNCABLE_PREF);
173 prefs->RegisterIntegerPref(prefs::kLanguageXkbAutoRepeatInterval, 173 prefs->RegisterIntegerPref(prefs::kLanguageXkbAutoRepeatInterval,
174 language_prefs::kXkbAutoRepeatIntervalInMs, 174 language_prefs::kXkbAutoRepeatIntervalInMs,
175 PrefService::UNSYNCABLE_PREF); 175 PrefService::UNSYNCABLE_PREF);
176 176
177 prefs->RegisterDictionaryPref(prefs::kLanguagePreferredVirtualKeyboard,
178 PrefService::SYNCABLE_PREF);
179
177 // Screen lock default to off. 180 // Screen lock default to off.
178 prefs->RegisterBooleanPref(prefs::kEnableScreenLock, 181 prefs->RegisterBooleanPref(prefs::kEnableScreenLock,
179 false, 182 false,
180 PrefService::SYNCABLE_PREF); 183 PrefService::SYNCABLE_PREF);
181 184
182 // Mobile plan notifications default to on. 185 // Mobile plan notifications default to on.
183 prefs->RegisterBooleanPref(prefs::kShowPlanNotifications, 186 prefs->RegisterBooleanPref(prefs::kShowPlanNotifications,
184 true, 187 true,
185 PrefService::SYNCABLE_PREF); 188 PrefService::SYNCABLE_PREF);
186 189
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 language_xkb_auto_repeat_interval_pref_.Init( 276 language_xkb_auto_repeat_interval_pref_.Init(
274 prefs::kLanguageXkbAutoRepeatInterval, prefs, this); 277 prefs::kLanguageXkbAutoRepeatInterval, prefs, this);
275 278
276 enable_screen_lock_.Init(prefs::kEnableScreenLock, prefs, this); 279 enable_screen_lock_.Init(prefs::kEnableScreenLock, prefs, this);
277 280
278 use_shared_proxies_.Init(prefs::kUseSharedProxies, prefs, this); 281 use_shared_proxies_.Init(prefs::kUseSharedProxies, prefs, this);
279 282
280 // Initialize preferences to currently saved state. 283 // Initialize preferences to currently saved state.
281 NotifyPrefChanged(NULL); 284 NotifyPrefChanged(NULL);
282 285
286 // Initialize virtual keyboard settings to currently saved state.
287 UpdateVirturalKeyboardPreference(prefs);
288
283 // If a guest is logged in, initialize the prefs as if this is the first 289 // If a guest is logged in, initialize the prefs as if this is the first
284 // login. 290 // login.
285 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) { 291 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) {
286 LoginUtils::Get()->SetFirstLoginPrefs(prefs); 292 LoginUtils::Get()->SetFirstLoginPrefs(prefs);
287 } 293 }
288 } 294 }
289 295
290 void Preferences::Observe(int type, 296 void Preferences::Observe(int type,
291 const NotificationSource& source, 297 const NotificationSource& source,
292 const NotificationDetails& details) { 298 const NotificationDetails& details) {
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 void Preferences::UpdateAutoRepeatRate() { 569 void Preferences::UpdateAutoRepeatRate() {
564 input_method::AutoRepeatRate rate; 570 input_method::AutoRepeatRate rate;
565 rate.initial_delay_in_ms = language_xkb_auto_repeat_delay_pref_.GetValue(); 571 rate.initial_delay_in_ms = language_xkb_auto_repeat_delay_pref_.GetValue();
566 rate.repeat_interval_in_ms = 572 rate.repeat_interval_in_ms =
567 language_xkb_auto_repeat_interval_pref_.GetValue(); 573 language_xkb_auto_repeat_interval_pref_.GetValue();
568 DCHECK(rate.initial_delay_in_ms > 0); 574 DCHECK(rate.initial_delay_in_ms > 0);
569 DCHECK(rate.repeat_interval_in_ms > 0); 575 DCHECK(rate.repeat_interval_in_ms > 0);
570 input_method::SetAutoRepeatRate(rate); 576 input_method::SetAutoRepeatRate(rate);
571 } 577 }
572 578
579 void Preferences::UpdateVirturalKeyboardPreference(PrefService* prefs) {
580 const DictionaryValue* virtual_keyboard_pref =
581 prefs->GetDictionary(prefs::kLanguagePreferredVirtualKeyboard);
582 DCHECK(virtual_keyboard_pref);
583
584 input_method::InputMethodManager* input_method_manager =
585 input_method::InputMethodManager::GetInstance();
586 input_method_manager->ClearAllVirtualKeyboardPreferences();
587
588 std::string url;
589 for (DictionaryValue::key_iterator iter = virtual_keyboard_pref->begin_keys();
590 iter != virtual_keyboard_pref->end_keys();
591 ++iter) {
592 const std::string& input_method_id = *iter;
593 if (!virtual_keyboard_pref->GetString(input_method_id, &url))
594 continue;
595 input_method_manager->SetVirtualKeyboardPreference(
596 input_method_id, GURL(url));
597 }
598 }
599
573 } // namespace chromeos 600 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/preferences.h ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698