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

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

Issue 2697413003: [Chrome OS] Expose keyboard auto repeat delay/interval to login screen. (Closed)
Patch Set: Created 3 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
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> 7 #include <vector>
8 8
9 #include "ash/autoclick/autoclick_controller.h" 9 #include "ash/autoclick/autoclick_controller.h"
10 #include "ash/common/accessibility_types.h" 10 #include "ash/common/accessibility_types.h"
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 } 615 }
616 } 616 }
617 617
618 if (reason != REASON_PREF_CHANGED || 618 if (reason != REASON_PREF_CHANGED ||
619 pref_name == prefs::kLanguageXkbAutoRepeatEnabled) { 619 pref_name == prefs::kLanguageXkbAutoRepeatEnabled) {
620 if (user_is_active) { 620 if (user_is_active) {
621 const bool enabled = xkb_auto_repeat_enabled_.GetValue(); 621 const bool enabled = xkb_auto_repeat_enabled_.GetValue();
622 input_method::InputMethodManager::Get() 622 input_method::InputMethodManager::Get()
623 ->GetImeKeyboard() 623 ->GetImeKeyboard()
624 ->SetAutoRepeatEnabled(enabled); 624 ->SetAutoRepeatEnabled(enabled);
625
626 PrefService* const local_state = g_browser_process->local_state();
627 DictionaryPrefUpdate repeat_enabled_updater(
628 local_state, prefs::kLanguageXkbAutoRepeatEnabled);
629 repeat_enabled_updater->SetBooleanWithoutPathExpansion(
630 user_->GetAccountId().GetUserEmail(), enabled);
625 } 631 }
626 } 632 }
627 if (reason != REASON_PREF_CHANGED || 633 if (reason != REASON_PREF_CHANGED ||
628 pref_name == prefs::kLanguageXkbAutoRepeatDelay || 634 pref_name == prefs::kLanguageXkbAutoRepeatDelay ||
629 pref_name == prefs::kLanguageXkbAutoRepeatInterval) { 635 pref_name == prefs::kLanguageXkbAutoRepeatInterval) {
630 if (user_is_active) 636 if (user_is_active)
631 UpdateAutoRepeatRate(); 637 UpdateAutoRepeatRate();
632 } 638 }
633 639
634 if (reason == REASON_INITIALIZATION) 640 if (reason == REASON_INITIALIZATION)
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 785
780 void Preferences::UpdateAutoRepeatRate() { 786 void Preferences::UpdateAutoRepeatRate() {
781 input_method::AutoRepeatRate rate; 787 input_method::AutoRepeatRate rate;
782 rate.initial_delay_in_ms = xkb_auto_repeat_delay_pref_.GetValue(); 788 rate.initial_delay_in_ms = xkb_auto_repeat_delay_pref_.GetValue();
783 rate.repeat_interval_in_ms = xkb_auto_repeat_interval_pref_.GetValue(); 789 rate.repeat_interval_in_ms = xkb_auto_repeat_interval_pref_.GetValue();
784 DCHECK(rate.initial_delay_in_ms > 0); 790 DCHECK(rate.initial_delay_in_ms > 0);
785 DCHECK(rate.repeat_interval_in_ms > 0); 791 DCHECK(rate.repeat_interval_in_ms > 0);
786 input_method::InputMethodManager::Get() 792 input_method::InputMethodManager::Get()
787 ->GetImeKeyboard() 793 ->GetImeKeyboard()
788 ->SetAutoRepeatRate(rate); 794 ->SetAutoRepeatRate(rate);
795
796 PrefService* const local_state = g_browser_process->local_state();
797 DictionaryPrefUpdate repeat_delay_updater(local_state,
798 prefs::kLanguageXkbAutoRepeatDelay);
799 DictionaryPrefUpdate repeat_interval_updater(
800 local_state, prefs::kLanguageXkbAutoRepeatInterval);
801 repeat_delay_updater->SetIntegerWithoutPathExpansion(
802 user_->GetAccountId().GetUserEmail(), rate.initial_delay_in_ms);
Alexander Alekseev 2017/02/17 02:18:23 e-mail as storage key is deprecated. Could you use
xiyuan 2017/02/17 17:08:15 Did you mean AccountId::GetAccountIdKey()? If so,
803 repeat_interval_updater->SetIntegerWithoutPathExpansion(
804 user_->GetAccountId().GetUserEmail(), rate.repeat_interval_in_ms);
789 } 805 }
790 806
791 void Preferences::OnTouchHudProjectionToggled(bool enabled) { 807 void Preferences::OnTouchHudProjectionToggled(bool enabled) {
792 if (touch_hud_projection_enabled_.GetValue() == enabled) 808 if (touch_hud_projection_enabled_.GetValue() == enabled)
793 return; 809 return;
794 if (!user_->is_active()) 810 if (!user_->is_active())
795 return; 811 return;
796 touch_hud_projection_enabled_.SetValue(enabled); 812 touch_hud_projection_enabled_.SetValue(enabled);
797 } 813 }
798 814
799 void Preferences::ActiveUserChanged(const user_manager::User* active_user) { 815 void Preferences::ActiveUserChanged(const user_manager::User* active_user) {
800 if (active_user != user_) 816 if (active_user != user_)
801 return; 817 return;
802 ApplyPreferences(REASON_ACTIVE_USER_CHANGED, ""); 818 ApplyPreferences(REASON_ACTIVE_USER_CHANGED, "");
803 } 819 }
804 820
805 } // namespace chromeos 821 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698