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

Unified Diff: chrome/browser/chromeos/input_method/input_method_persistence.cc

Issue 484353005: ChromeOS: "Add New User" screen should enable all hardware keyboards. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests. Created 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/input_method/input_method_persistence.cc
diff --git a/chrome/browser/chromeos/input_method/input_method_persistence.cc b/chrome/browser/chromeos/input_method/input_method_persistence.cc
index b5d648396f13ec37e4f51b3753a495b69a547290..a139b92a39f3a7841b1df33568f160499ac5b684 100644
--- a/chrome/browser/chromeos/input_method/input_method_persistence.cc
+++ b/chrome/browser/chromeos/input_method/input_method_persistence.cc
@@ -27,24 +27,10 @@ void PersistSystemInputMethod(const std::string& input_method) {
language_prefs::kPreferredKeyboardLayout, input_method);
}
-// Update user LRU keyboard layout for login screen
-static void SetUserLRUInputMethod(
- const std::string& input_method,
- const chromeos::input_method::InputMethodManager* const manager,
- Profile* profile) {
- // Skip if it's not a keyboard layout. Drop input methods including
- // extension ones.
- if (!manager->IsLoginKeyboard(input_method))
- return;
-
- PrefService* const local_state = g_browser_process->local_state();
-
- if (profile == NULL)
- return;
-
- const std::string username = profile->GetProfileName();
- if (base::SysInfo::IsRunningOnChromeOS() && !username.empty() &&
- !local_state->ReadOnly()) {
+static void SetUserLRUInputMethodPreference(const std::string& username,
+ const std::string& input_method,
+ PrefService* local_state) {
+ if (!username.empty() && !local_state->ReadOnly()) {
bool update_succeed = false;
{
// Updater may have side-effects, therefore we do not replace
@@ -77,6 +63,25 @@ static void SetUserLRUInputMethod(
}
}
+// Update user LRU keyboard layout for login screen
+static void SetUserLRUInputMethod(
+ const std::string& input_method,
+ const chromeos::input_method::InputMethodManager* const manager,
+ Profile* profile) {
+ // Skip if it's not a keyboard layout. Drop input methods including
+ // extension ones.
+ if (!manager->IsLoginKeyboard(input_method))
+ return;
+
+ if (profile == NULL)
+ return;
+
+ PrefService* const local_state = g_browser_process->local_state();
+
+ SetUserLRUInputMethodPreference(
+ profile->GetProfileName(), input_method, local_state);
+}
+
void PersistUserInputMethod(const std::string& input_method,
InputMethodManager* const manager) {
PrefService* user_prefs = NULL;
@@ -146,5 +151,11 @@ void InputMethodPersistence::OnSessionStateChange(
ui_session_ = new_ui_session;
}
+void SetUserLRUInputMethodPreferenceForTesting(const std::string& username,
+ const std::string& input_method,
+ PrefService* const local_state) {
+ SetUserLRUInputMethodPreference(username, input_method, local_state);
+}
+
} // namespace input_method
} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/input_method/input_method_persistence.h ('k') | chrome/browser/chromeos/login/login_manager_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698