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

Side by Side Diff: chrome/browser/chromeos/input_method/input_method_manager_impl.cc

Issue 23608003: Default keyboard layout should be set considering owners preference. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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 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/input_method/input_method_manager_impl.h" 5 #include "chrome/browser/chromeos/input_method/input_method_manager_impl.h"
6 6
7 #include <algorithm> // std::find 7 #include <algorithm> // std::find
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/prefs/pref_service.h"
13 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
14 #include "base/strings/stringprintf.h" 15 #include "base/strings/stringprintf.h"
16 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/chromeos/input_method/candidate_window_controller.h" 17 #include "chrome/browser/chromeos/input_method/candidate_window_controller.h"
16 #include "chrome/browser/chromeos/input_method/component_extension_ime_manager_i mpl.h" 18 #include "chrome/browser/chromeos/input_method/component_extension_ime_manager_i mpl.h"
17 #include "chrome/browser/chromeos/input_method/input_method_engine_ibus.h" 19 #include "chrome/browser/chromeos/input_method/input_method_engine_ibus.h"
18 #include "chrome/browser/chromeos/language_preferences.h" 20 #include "chrome/browser/chromeos/language_preferences.h"
19 #include "chromeos/dbus/dbus_thread_manager.h" 21 #include "chromeos/dbus/dbus_thread_manager.h"
20 #include "chromeos/dbus/ibus/ibus_client.h" 22 #include "chromeos/dbus/ibus/ibus_client.h"
21 #include "chromeos/dbus/ibus/ibus_input_context_client.h" 23 #include "chromeos/dbus/ibus/ibus_input_context_client.h"
22 #include "chromeos/ime/component_extension_ime_manager.h" 24 #include "chromeos/ime/component_extension_ime_manager.h"
23 #include "chromeos/ime/extension_ime_util.h" 25 #include "chromeos/ime/extension_ime_util.h"
24 #include "chromeos/ime/input_method_delegate.h" 26 #include "chromeos/ime/input_method_delegate.h"
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 if (active_imes_changed) { 663 if (active_imes_changed) {
662 MaybeInitializeCandidateWindowController(); 664 MaybeInitializeCandidateWindowController();
663 IBusDaemonController::GetInstance()->Start(); 665 IBusDaemonController::GetInstance()->Start();
664 666
665 // If |current_input_method| is no longer in |active_input_method_ids_|, 667 // If |current_input_method| is no longer in |active_input_method_ids_|,
666 // switch to the first one in |active_input_method_ids_|. 668 // switch to the first one in |active_input_method_ids_|.
667 ChangeInputMethod(current_input_method_.id()); 669 ChangeInputMethod(current_input_method_.id());
668 } 670 }
669 } 671 }
670 672
673 void InputMethodManagerImpl::SetInputMethodDefault() {
674 // Set up keyboards. For example, when |locale| is "en-US", enable US qwerty
675 // and US dvorak keyboard layouts.
676 if (g_browser_process && g_browser_process->local_state()) {
677 const std::string locale = g_browser_process->GetApplicationLocale();
678 // If the preferred keyboard for the login screen has been saved, use it.
679 PrefService* prefs = g_browser_process->local_state();
680 std::string initial_input_method_id =
681 prefs->GetString(chromeos::language_prefs::kPreferredKeyboardLayout);
682 if (initial_input_method_id.empty()) {
683 // If kPreferredKeyboardLayout is not specified, use the hardware layout.
684 initial_input_method_id =
685 GetInputMethodUtil()->GetHardwareInputMethodId();
686 }
687 EnableLayouts(locale, initial_input_method_id);
688 }
689 }
690
671 bool InputMethodManagerImpl::SwitchToNextInputMethod() { 691 bool InputMethodManagerImpl::SwitchToNextInputMethod() {
672 // Sanity checks. 692 // Sanity checks.
673 if (active_input_method_ids_.empty()) { 693 if (active_input_method_ids_.empty()) {
674 DVLOG(1) << "active input method is empty"; 694 DVLOG(1) << "active input method is empty";
675 return false; 695 return false;
676 } 696 }
677 if (current_input_method_.id().empty()) { 697 if (current_input_method_.id().empty()) {
678 DVLOG(1) << "current_input_method_ is unknown"; 698 DVLOG(1) << "current_input_method_ is unknown";
679 return false; 699 return false;
680 } 700 }
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 else 990 else
971 DVLOG(1) << "Failed to initialize the candidate window controller"; 991 DVLOG(1) << "Failed to initialize the candidate window controller";
972 } 992 }
973 993
974 bool InputMethodManagerImpl::IsIBusConnectionAlive() { 994 bool InputMethodManagerImpl::IsIBusConnectionAlive() {
975 return DBusThreadManager::Get() && DBusThreadManager::Get()->GetIBusClient(); 995 return DBusThreadManager::Get() && DBusThreadManager::Get()->GetIBusClient();
976 } 996 }
977 997
978 } // namespace input_method 998 } // namespace input_method
979 } // namespace chromeos 999 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698