diff options
35 files changed, 166 insertions, 128 deletions
diff --git a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc index 2a0ac03..0fc08e5 100644 --- a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc +++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc @@ -30,6 +30,7 @@ #include "chrome/browser/chromeos/extensions/default_app_order.h" #include "chrome/browser/chromeos/external_metrics.h" #include "chrome/browser/chromeos/imageburner/burn_manager.h" +#include "chrome/browser/chromeos/input_method/input_method_configuration.h" #include "chrome/browser/chromeos/input_method/input_method_manager.h" #include "chrome/browser/chromeos/input_method/xkeyboard.h" #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_idle_logout.h" @@ -245,7 +246,7 @@ class DBusServices { CrosDBusService::Initialize(); // This function and SystemKeyEventListener use InputMethodManager. - input_method::InputMethodManager::Initialize(); + chromeos::input_method::Initialize(); disks::DiskMountManager::Initialize(); cryptohome::AsyncMethodCaller::Initialize(); @@ -260,8 +261,8 @@ class DBusServices { if (base::chromeos::IsRunningOnChromeOS()) { // Disable Num Lock on X start up for http://crosbug.com/29169. - input_method::InputMethodManager::GetInstance()-> - GetXKeyboard()->SetNumLockEnabled(false); + input_method::GetInputMethodManager()->GetXKeyboard()-> + SetNumLockEnabled(false); } // Initialize the device settings service so that we'll take actions per @@ -304,7 +305,7 @@ class DBusServices { cryptohome::AsyncMethodCaller::Shutdown(); disks::DiskMountManager::Shutdown(); - input_method::InputMethodManager::Shutdown(); + input_method::Shutdown(); CrosDBusService::Shutdown(); // NOTE: This must only be called if Initialize() was called. DBusThreadManager::Shutdown(); diff --git a/chrome/browser/chromeos/extensions/input_method_api.cc b/chrome/browser/chromeos/extensions/input_method_api.cc index a0567b4..1c7f7a7 100644 --- a/chrome/browser/chromeos/extensions/input_method_api.cc +++ b/chrome/browser/chromeos/extensions/input_method_api.cc @@ -5,6 +5,7 @@ #include "chrome/browser/chromeos/extensions/input_method_api.h" #include "base/values.h" +#include "chrome/browser/chromeos/input_method/input_method_configuration.h" #include "chrome/browser/chromeos/input_method/input_method_manager.h" #include "chrome/browser/chromeos/extensions/input_method_event_router.h" #include "chrome/browser/extensions/extension_service.h" @@ -28,7 +29,7 @@ bool GetInputMethodFunction::RunImpl() { extensions::ExtensionSystem::Get(profile_)->extension_service()-> input_method_event_router(); chromeos::input_method::InputMethodManager* manager = - chromeos::input_method::InputMethodManager::GetInstance(); + chromeos::input_method::GetInputMethodManager(); const std::string input_method = router->GetInputMethodForXkb(manager->GetCurrentInputMethod().id()); SetResult(Value::CreateStringValue(input_method)); diff --git a/chrome/browser/chromeos/extensions/input_method_apitest_chromeos.cc b/chrome/browser/chromeos/extensions/input_method_apitest_chromeos.cc index 31a07bb..29166e2 100644 --- a/chrome/browser/chromeos/extensions/input_method_apitest_chromeos.cc +++ b/chrome/browser/chromeos/extensions/input_method_apitest_chromeos.cc @@ -7,6 +7,7 @@ #include "base/command_line.h" #include "base/stringprintf.h" #include "chrome/browser/chromeos/extensions/input_method_event_router.h" +#include "chrome/browser/chromeos/input_method/input_method_configuration.h" #include "chrome/browser/chromeos/input_method/input_method_manager.h" #include "chrome/browser/extensions/api/test/test_api.h" #include "chrome/common/chrome_notification_types.h" @@ -32,7 +33,7 @@ class SetInputMethodListener : public content::NotificationObserver { explicit SetInputMethodListener(int count) : count_(count) { registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_TEST_MESSAGE, content::NotificationService::AllSources()); - chromeos::input_method::InputMethodManager::GetInstance()-> + chromeos::input_method::GetInputMethodManager()-> EnableLayouts(kLoginScreenUILanguage, kInitialInputMethodOnLoginScreen); } @@ -49,7 +50,7 @@ class SetInputMethodListener : public content::NotificationObserver { kSetInputMethodMessage, kNewInputMethod); if (content == expected_message) { - chromeos::input_method::InputMethodManager::GetInstance()-> + chromeos::input_method::GetInputMethodManager()-> ChangeInputMethod(StringPrintf("xkb:%s", kNewInputMethod)); extensions::TestSendMessageFunction* function = diff --git a/chrome/browser/chromeos/extensions/input_method_event_router.cc b/chrome/browser/chromeos/extensions/input_method_event_router.cc index 1dff75e..b7202b8 100644 --- a/chrome/browser/chromeos/extensions/input_method_event_router.cc +++ b/chrome/browser/chromeos/extensions/input_method_event_router.cc @@ -8,6 +8,7 @@ #include "base/json/json_writer.h" #include "base/values.h" +#include "chrome/browser/chromeos/input_method/input_method_configuration.h" #include "chrome/browser/chromeos/web_socket_proxy_controller.h" #include "chrome/browser/extensions/event_names.h" #include "chrome/browser/extensions/event_router.h" @@ -25,11 +26,11 @@ const char kXkbPrefix[] = "xkb:"; namespace chromeos { ExtensionInputMethodEventRouter::ExtensionInputMethodEventRouter() { - input_method::InputMethodManager::GetInstance()->AddObserver(this); + input_method::GetInputMethodManager()->AddObserver(this); } ExtensionInputMethodEventRouter::~ExtensionInputMethodEventRouter() { - input_method::InputMethodManager::GetInstance()->RemoveObserver(this); + input_method::GetInputMethodManager()->RemoveObserver(this); } void ExtensionInputMethodEventRouter::InputMethodChanged( diff --git a/chrome/browser/chromeos/input_method/ibus_ui_controller.cc b/chrome/browser/chromeos/input_method/ibus_ui_controller.cc index dce2aa3..fdb54d9 100644 --- a/chrome/browser/chromeos/input_method/ibus_ui_controller.cc +++ b/chrome/browser/chromeos/input_method/ibus_ui_controller.cc @@ -11,6 +11,7 @@ #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/string_util.h" +#include "chrome/browser/chromeos/input_method/input_method_configuration.h" #include "chrome/browser/chromeos/input_method/input_method_descriptor.h" #include "chrome/browser/chromeos/input_method/input_method_manager.h" #include "chrome/browser/chromeos/input_method/input_method_util.h" @@ -51,7 +52,7 @@ class IBusChromeOSClientImpl : public ui::internal::IBusClient { // ui::IBusClient override. virtual InputMethodType GetInputMethodType() OVERRIDE { - InputMethodManager* manager = InputMethodManager::GetInstance(); + InputMethodManager* manager = GetInputMethodManager(); DCHECK(manager); return InputMethodUtil::IsKeyboardLayout( manager->GetCurrentInputMethod().id()) ? diff --git a/chrome/browser/chromeos/input_method/input_method_manager.cc b/chrome/browser/chromeos/input_method/input_method_configuration.cc index 1abf167..647cf3b 100644 --- a/chrome/browser/chromeos/input_method/input_method_manager.cc +++ b/chrome/browser/chromeos/input_method/input_method_configuration.cc @@ -2,8 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/input_method/input_method_manager.h" +#include "chrome/browser/chromeos/input_method/input_method_configuration.h" +#include "base/logging.h" +#include "base/memory/scoped_ptr.h" #include "chrome/browser/chromeos/input_method/input_method_delegate_impl.h" #include "chrome/browser/chromeos/input_method/input_method_manager_impl.h" @@ -14,33 +16,31 @@ namespace { InputMethodManager* g_input_method_manager = NULL; } // namespace -// static -void InputMethodManager::Initialize() { + +void Initialize() { DCHECK(!g_input_method_manager); + InputMethodManagerImpl* impl = new InputMethodManagerImpl( scoped_ptr<InputMethodDelegate>(new InputMethodDelegateImpl)); impl->Init(); g_input_method_manager = impl; + DVLOG(1) << "InputMethodManager initialized"; } -// static -void InputMethodManager::InitializeForTesting( - InputMethodManager* mock_manager) { +void InitializeForTesting(InputMethodManager* mock_manager) { DCHECK(!g_input_method_manager); g_input_method_manager = mock_manager; DVLOG(1) << "InputMethodManager for testing initialized"; } -// static -void InputMethodManager::Shutdown() { +void Shutdown() { delete g_input_method_manager; g_input_method_manager = NULL; DVLOG(1) << "InputMethodManager shutdown"; } -// static -InputMethodManager* InputMethodManager::GetInstance() { +InputMethodManager* GetInputMethodManager() { DCHECK(g_input_method_manager); return g_input_method_manager; } diff --git a/chrome/browser/chromeos/input_method/input_method_configuration.h b/chrome/browser/chromeos/input_method/input_method_configuration.h new file mode 100644 index 0000000..d1fc12c --- /dev/null +++ b/chrome/browser/chromeos/input_method/input_method_configuration.h @@ -0,0 +1,34 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_CONFIGURATION_H_ +#define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_CONFIGURATION_H_ + +namespace chromeos { +namespace input_method { + +class InputMethodManager; + +// Initializes the InputMethodManager. Must be called before any calls to +// GetInstance(). We explicitly initialize and shut down the global instance, +// rather than making it a Singleton, to ensure clean startup and shutdown. +void Initialize(); + +// Similar to Initialize(), but can inject an alternative +// InputMethodManager such as MockInputMethodManager for testing. +// The injected object will be owned by the internal pointer and deleted +// by Shutdown(). +void InitializeForTesting(InputMethodManager* mock_manager); + +// Destroys the global InputMethodManager instance. +void Shutdown(); + +// Gets the global InputMethodManager. Initialize() or InitializeForTesting() +// must be called first. +InputMethodManager* GetInputMethodManager(); + +} // namespace input_method +} // namespace chromeos + +#endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_CONFIGURATION_H_ diff --git a/chrome/browser/chromeos/input_method/input_method_configuration_unittest.cc b/chrome/browser/chromeos/input_method/input_method_configuration_unittest.cc new file mode 100644 index 0000000..3f6d33f --- /dev/null +++ b/chrome/browser/chromeos/input_method/input_method_configuration_unittest.cc @@ -0,0 +1,27 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/chromeos/input_method/input_method_configuration.h" +#include "chrome/browser/chromeos/input_method/mock_input_method_manager.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace chromeos { +namespace input_method { + +TEST(InputMethodConfigurationTest, TestInitialize) { + Initialize(); + InputMethodManager* manager = GetInputMethodManager(); + EXPECT_TRUE(manager); + Shutdown(); +} + +TEST(InputMethodConfigurationTest, TestInitializeForTesting) { + InitializeForTesting(new MockInputMethodManager); + InputMethodManager* manager = GetInputMethodManager(); + EXPECT_TRUE(manager); + Shutdown(); +} + +} // namespace input_method +} // namespace chromeos diff --git a/chrome/browser/chromeos/input_method/input_method_engine_ibus.cc b/chrome/browser/chromeos/input_method/input_method_engine_ibus.cc index 8d22e8c..cdced7a 100644 --- a/chrome/browser/chromeos/input_method/input_method_engine_ibus.cc +++ b/chrome/browser/chromeos/input_method/input_method_engine_ibus.cc @@ -11,6 +11,7 @@ #include "base/string_number_conversions.h" #include "base/string_util.h" #include "chrome/browser/chromeos/input_method/ibus_keymap.h" +#include "chrome/browser/chromeos/input_method/input_method_configuration.h" #include "chrome/browser/chromeos/input_method/input_method_manager.h" #include "chrome/browser/chromeos/input_method/input_method_util.h" #include "chromeos/dbus/dbus_thread_manager.h" @@ -57,8 +58,7 @@ InputMethodEngineIBus::InputMethodEngineIBus() InputMethodEngineIBus::~InputMethodEngineIBus() { GetCurrentService()->UnsetEngine(); - input_method::InputMethodManager::GetInstance()-> - RemoveInputMethodExtension(ibus_id_); + input_method::GetInputMethodManager()->RemoveInputMethodExtension(ibus_id_); } void InputMethodEngineIBus::Initialize( @@ -79,13 +79,11 @@ void InputMethodEngineIBus::Initialize( ibus_id_ += engine_id; input_method::InputMethodManager* manager = - input_method::InputMethodManager::GetInstance(); + input_method::GetInputMethodManager(); std::string layout; if (!layouts.empty()) { layout = JoinString(layouts, ','); } else { - input_method::InputMethodManager* manager = - input_method::InputMethodManager::GetInstance(); const std::string fallback_id = manager->GetInputMethodUtil()->GetHardwareInputMethodId(); const input_method::InputMethodDescriptor* fallback_desc = diff --git a/chrome/browser/chromeos/input_method/input_method_manager.h b/chrome/browser/chromeos/input_method/input_method_manager.h index b911bb9..510b9fc 100644 --- a/chrome/browser/chromeos/input_method/input_method_manager.h +++ b/chrome/browser/chromeos/input_method/input_method_manager.h @@ -13,7 +13,6 @@ #include "chrome/browser/chromeos/input_method/input_method_config.h" #include "chrome/browser/chromeos/input_method/input_method_descriptor.h" #include "chrome/browser/chromeos/input_method/input_method_property.h" -#include "chrome/browser/chromeos/input_method/input_method_util.h" namespace ui { class Accelerator; @@ -23,11 +22,12 @@ namespace chromeos { class InputMethodEngine; namespace input_method { +class InputMethodUtil; class XKeyboard; // This class manages input methodshandles. Classes can add themselves as // observers. Clients can get an instance of this library class by: -// InputMethodManager::GetInstance(). +// GetInputMethodManager(). class InputMethodManager { public: enum State { @@ -158,24 +158,6 @@ class InputMethodManager { // Switches to an input method (or keyboard layout) which is associated with // the |accelerator|. virtual bool SwitchInputMethod(const ui::Accelerator& accelerator) = 0; - - // Sets the global instance. Must be called before any calls to GetInstance(). - // We explicitly initialize and shut down the global object, rather than - // making it a Singleton, to ensure clean startup and shutdown. - static void Initialize(); - - // Similar to Initialize(), but can inject an alternative - // InputMethodManager such as MockInputMethodManager for testing. - // The injected object will be owned by the internal pointer and deleted - // by Shutdown(). - static void InitializeForTesting(InputMethodManager* mock_manager); - - // Destroys the global instance. - static void Shutdown(); - - // Gets the global instance. Initialize() or InitializeForTesting() must be - // called first. - static InputMethodManager* GetInstance(); }; } // namespace input_method diff --git a/chrome/browser/chromeos/input_method/input_method_manager_impl.h b/chrome/browser/chromeos/input_method/input_method_manager_impl.h index 49f4dde..ba634d5 100644 --- a/chrome/browser/chromeos/input_method/input_method_manager_impl.h +++ b/chrome/browser/chromeos/input_method/input_method_manager_impl.h @@ -32,6 +32,12 @@ class InputMethodManagerImpl : public InputMethodManager, explicit InputMethodManagerImpl(scoped_ptr<InputMethodDelegate> delegate); virtual ~InputMethodManagerImpl(); + // Attach IBusController, CandidateWindowController, and XKeyboard objects + // to the InputMethodManagerImpl object. You don't have to call this function + // if you attach them yourself (e.g. in unit tests) using the protected + // setters. + void Init(); + // InputMethodManager override: virtual void AddObserver(InputMethodManager::Observer* observer) OVERRIDE; virtual void AddCandidateWindowObserver( @@ -83,8 +89,6 @@ class InputMethodManagerImpl : public InputMethodManager, void SetXKeyboardForTesting(XKeyboard* xkeyboard); private: - friend class InputMethodManager; - // IBusController overrides: virtual void PropertyChanged() OVERRIDE; virtual void OnConnected() OVERRIDE; @@ -95,11 +99,6 @@ class InputMethodManagerImpl : public InputMethodManager, virtual void CandidateWindowOpened() OVERRIDE; virtual void CandidateWindowClosed() OVERRIDE; - // Attach IBusController, CandidateWindowController, and XKeyboard objects - // to the InputMethodManagerImpl object. You don't have to call this function - // if you attach them yourself (e.g. in unit tests) using the setters above. - void Init(); - // Temporarily deactivates all input methods (e.g. Chinese, Japanese, Arabic) // since they are not necessary to input a login password. Users are still // able to use/switch active keyboard layouts (e.g. US qwerty, US dvorak, diff --git a/chrome/browser/chromeos/input_method/input_method_manager_unittest.cc b/chrome/browser/chromeos/input_method/input_method_manager_unittest.cc deleted file mode 100644 index 27f0caf..0000000 --- a/chrome/browser/chromeos/input_method/input_method_manager_unittest.cc +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/chromeos/input_method/input_method_manager.h" -#include "chrome/browser/chromeos/input_method/mock_input_method_manager.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace chromeos { -namespace input_method { - -TEST(InputMethodManagerTest, TestInitialize) { - InputMethodManager::Initialize(); - InputMethodManager* manager = InputMethodManager::GetInstance(); - EXPECT_TRUE(manager); - InputMethodManager::Shutdown(); -} - -TEST(InputMethodManagerTest, TestInitializeForTesting) { - InputMethodManager::InitializeForTesting(new MockInputMethodManager); - InputMethodManager* manager = InputMethodManager::GetInstance(); - EXPECT_TRUE(manager); - InputMethodManager::Shutdown(); -} - -} // namespace input_method -} // namespace chromeos diff --git a/chrome/browser/chromeos/login/base_login_display_host.cc b/chrome/browser/chromeos/login/base_login_display_host.cc index 44c9cfe..cae593d 100644 --- a/chrome/browser/chromeos/login/base_login_display_host.cc +++ b/chrome/browser/chromeos/login/base_login_display_host.cc @@ -17,6 +17,7 @@ #include "chrome/browser/browser_shutdown.h" #include "chrome/browser/chromeos/cros/cros_library.h" #include "chrome/browser/chromeos/customization_document.h" +#include "chrome/browser/chromeos/input_method/input_method_configuration.h" #include "chrome/browser/chromeos/input_method/input_method_manager.h" #include "chrome/browser/chromeos/input_method/input_method_util.h" #include "chrome/browser/chromeos/language_preferences.h" @@ -71,7 +72,7 @@ void DetermineAndSaveHardwareKeyboard(const std::string& locale, layout = oem_layout; } else { chromeos::input_method::InputMethodManager* manager = - chromeos::input_method::InputMethodManager::GetInstance(); + chromeos::input_method::GetInputMethodManager(); // Otherwise, determine the hardware keyboard from the locale. std::vector<std::string> input_method_ids; if (manager->GetInputMethodUtil()->GetInputMethodIdsFromLanguageCode( @@ -376,7 +377,7 @@ void ShowLoginWizard(const std::string& first_screen_name, VLOG(1) << "Showing OOBE screen: " << first_screen_name; chromeos::input_method::InputMethodManager* manager = - chromeos::input_method::InputMethodManager::GetInstance(); + chromeos::input_method::GetInputMethodManager(); // Set up keyboards. For example, when |locale| is "en-US", enable US qwerty // and US dvorak keyboard layouts. diff --git a/chrome/browser/chromeos/login/language_switch_menu.cc b/chrome/browser/chromeos/login/language_switch_menu.cc index 8312390..e067245 100644 --- a/chrome/browser/chromeos/login/language_switch_menu.cc +++ b/chrome/browser/chromeos/login/language_switch_menu.cc @@ -10,6 +10,7 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chromeos/cros/cros_library.h" +#include "chrome/browser/chromeos/input_method/input_method_configuration.h" #include "chrome/browser/chromeos/input_method/input_method_manager.h" #include "chrome/browser/chromeos/input_method/input_method_util.h" #include "chrome/browser/chromeos/login/language_list.h" @@ -157,7 +158,7 @@ void LanguageSwitchMenu::SwitchLanguageAndEnableKeyboardLayouts( // to the hardware keyboard layout since the input method currently in // use may not be supported by the new locale (3rd parameter). input_method::InputMethodManager* manager = - input_method::InputMethodManager::GetInstance(); + input_method::GetInputMethodManager(); manager->EnableLayouts( locale, manager->GetInputMethodUtil()->GetHardwareInputMethodId()); diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc index f552fe1..fd329e7 100644 --- a/chrome/browser/chromeos/login/login_utils.cc +++ b/chrome/browser/chromeos/login/login_utils.cc @@ -33,6 +33,7 @@ #include "chrome/browser/chromeos/cros/cros_library.h" #include "chrome/browser/chromeos/cros/cryptohome_library.h" #include "chrome/browser/chromeos/cros/network_library.h" +#include "chrome/browser/chromeos/input_method/input_method_configuration.h" #include "chrome/browser/chromeos/input_method/input_method_manager.h" #include "chrome/browser/chromeos/input_method/input_method_util.h" #include "chrome/browser/chromeos/login/language_switch_menu.h" @@ -881,7 +882,7 @@ void LoginUtilsImpl::SetFirstLoginPrefs(PrefService* prefs) { // First, we'll set kLanguagePreloadEngines. input_method::InputMethodManager* manager = - input_method::InputMethodManager::GetInstance(); + input_method::GetInputMethodManager(); std::vector<std::string> input_method_ids; manager->GetInputMethodUtil()->GetFirstLoginInputMethodIds( locale, manager->GetCurrentInputMethod(), &input_method_ids); diff --git a/chrome/browser/chromeos/login/login_utils_browsertest.cc b/chrome/browser/chromeos/login/login_utils_browsertest.cc index 1237b5b..ab90a32 100644 --- a/chrome/browser/chromeos/login/login_utils_browsertest.cc +++ b/chrome/browser/chromeos/login/login_utils_browsertest.cc @@ -16,6 +16,7 @@ #include "base/threading/thread.h" #include "chrome/browser/chromeos/cros/cros_library.h" #include "chrome/browser/chromeos/cros/mock_cryptohome_library.h" +#include "chrome/browser/chromeos/input_method/input_method_configuration.h" #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h" #include "chrome/browser/chromeos/login/authenticator.h" #include "chrome/browser/chromeos/login/login_status_consumer.h" @@ -183,7 +184,7 @@ class LoginUtilsTest : public testing::Test, // which is part of io_thread_state_. DBusThreadManager::InitializeForTesting(&mock_dbus_thread_manager_); - input_method::InputMethodManager::InitializeForTesting( + input_method::InitializeForTesting( &mock_input_method_manager_); // Likewise, SessionManagerClient should also be initialized before diff --git a/chrome/browser/chromeos/login/registration_screen.cc b/chrome/browser/chromeos/login/registration_screen.cc index c156159..c57851f 100644 --- a/chrome/browser/chromeos/login/registration_screen.cc +++ b/chrome/browser/chromeos/login/registration_screen.cc @@ -7,6 +7,7 @@ #include "base/logging.h" #include "base/string_util.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/chromeos/input_method/input_method_configuration.h" #include "chrome/browser/chromeos/input_method/input_method_manager.h" #include "chrome/browser/chromeos/input_method/input_method_util.h" #include "chrome/browser/chromeos/login/wizard_controller.h" @@ -131,7 +132,7 @@ void RegistrationScreen::CloseScreen(ScreenObserver::ExitCodes code) { if (g_browser_process) { const std::string locale = g_browser_process->GetApplicationLocale(); input_method::InputMethodManager* manager = - input_method::InputMethodManager::GetInstance(); + input_method::GetInputMethodManager(); manager->EnableLayouts(locale, ""); } delegate()->GetObserver()->OnExit(code); diff --git a/chrome/browser/chromeos/login/webui_login_display.cc b/chrome/browser/chromeos/login/webui_login_display.cc index 8576eb5..9842711 100644 --- a/chrome/browser/chromeos/login/webui_login_display.cc +++ b/chrome/browser/chromeos/login/webui_login_display.cc @@ -5,6 +5,7 @@ #include "chrome/browser/chromeos/login/webui_login_display.h" #include "chrome/browser/chromeos/accessibility/accessibility_util.h" +#include "chrome/browser/chromeos/input_method/input_method_configuration.h" #include "chrome/browser/chromeos/input_method/input_method_manager.h" #include "chrome/browser/chromeos/input_method/xkeyboard.h" #include "chrome/browser/chromeos/login/screen_locker.h" @@ -137,7 +138,7 @@ void WebUILoginDisplay::ShowError(int error_msg_id, error_msg_id != IDS_LOGIN_ERROR_OWNER_REQUIRED) { // Display a warning if Caps Lock is on. input_method::InputMethodManager* ime_manager = - input_method::InputMethodManager::GetInstance(); + input_method::GetInputMethodManager(); if (ime_manager->GetXKeyboard()->CapsLockIsEnabled()) { // TODO(ivankr): use a format string instead of concatenation. error_text += "\n" + diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc index 49a9553..9428fd4 100644 --- a/chrome/browser/chromeos/preferences.cc +++ b/chrome/browser/chromeos/preferences.cc @@ -14,6 +14,7 @@ #include "chrome/browser/api/prefs/pref_member.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chromeos/drive/drive_file_system_util.h" +#include "chrome/browser/chromeos/input_method/input_method_configuration.h" #include "chrome/browser/chromeos/input_method/input_method_manager.h" #include "chrome/browser/chromeos/input_method/input_method_util.h" #include "chrome/browser/chromeos/input_method/xkeyboard.h" @@ -40,7 +41,7 @@ static const char kFallbackInputMethodLocale[] = "en-US"; Preferences::Preferences() : prefs_(NULL), - input_method_manager_(input_method::InputMethodManager::GetInstance()) { + input_method_manager_(input_method::GetInputMethodManager()) { } Preferences::Preferences(input_method::InputMethodManager* input_method_manager) @@ -55,7 +56,7 @@ void Preferences::RegisterUserPrefs(PrefService* prefs) { // TODO(yusukes): Remove the runtime hack. if (base::chromeos::IsRunningOnChromeOS()) { input_method::InputMethodManager* manager = - input_method::InputMethodManager::GetInstance(); + input_method::GetInputMethodManager(); if (manager) { hardware_keyboard_id = manager->GetInputMethodUtil()->GetHardwareInputMethodId(); diff --git a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc index 0b19b42..8f99c9e 100644 --- a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc +++ b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc @@ -38,6 +38,7 @@ #include "chrome/browser/chromeos/cros/cros_library.h" #include "chrome/browser/chromeos/cros/network_library.h" #include "chrome/browser/chromeos/drive/drive_system_service.h" +#include "chrome/browser/chromeos/input_method/input_method_configuration.h" #include "chrome/browser/chromeos/input_method/input_method_manager.h" #include "chrome/browser/chromeos/input_method/input_method_util.h" #include "chrome/browser/chromeos/input_method/xkeyboard.h" @@ -216,7 +217,7 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate, crosnet->AddNetworkManagerObserver(this); OnNetworkManagerChanged(crosnet); - input_method::InputMethodManager::GetInstance()->AddObserver(this); + input_method::GetInputMethodManager()->AddObserver(this); system::TimezoneSettings::GetInstance()->AddObserver(this); @@ -255,7 +256,7 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate, NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); if (crosnet) crosnet->RemoveNetworkManagerObserver(this); - input_method::InputMethodManager::GetInstance()->RemoveObserver(this); + input_method::GetInputMethodManager()->RemoveObserver(this); system::TimezoneSettings::GetInstance()->RemoveObserver(this); if (SystemKeyEventListener::GetInstance()) SystemKeyEventListener::GetInstance()->RemoveCapsLockObserver(this); @@ -437,7 +438,7 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate, virtual void GetCurrentIME(ash::IMEInfo* info) OVERRIDE { input_method::InputMethodManager* manager = - input_method::InputMethodManager::GetInstance(); + input_method::GetInputMethodManager(); input_method::InputMethodUtil* util = manager->GetInputMethodUtil(); input_method::InputMethodDescriptor ime = manager->GetCurrentInputMethod(); ExtractIMEInfo(ime, *util, info); @@ -446,7 +447,7 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate, virtual void GetAvailableIMEList(ash::IMEInfoList* list) OVERRIDE { input_method::InputMethodManager* manager = - input_method::InputMethodManager::GetInstance(); + input_method::GetInputMethodManager(); input_method::InputMethodUtil* util = manager->GetInputMethodUtil(); scoped_ptr<input_method::InputMethodDescriptors> ime_descriptors( manager->GetActiveInputMethods()); @@ -463,7 +464,7 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate, virtual void GetCurrentIMEProperties( ash::IMEPropertyInfoList* list) OVERRIDE { input_method::InputMethodManager* manager = - input_method::InputMethodManager::GetInstance(); + input_method::GetInputMethodManager(); input_method::InputMethodUtil* util = manager->GetInputMethodUtil(); input_method::InputMethodPropertyList properties = manager->GetCurrentInputMethodProperties(); @@ -477,11 +478,11 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate, } virtual void SwitchIME(const std::string& ime_id) OVERRIDE { - input_method::InputMethodManager::GetInstance()->ChangeInputMethod(ime_id); + input_method::GetInputMethodManager()->ChangeInputMethod(ime_id); } virtual void ActivateIMEProperty(const std::string& key) OVERRIDE { - input_method::InputMethodManager::GetInstance()-> + input_method::GetInputMethodManager()-> ActivateInputMethodProperty(key); } diff --git a/chrome/browser/chromeos/system_key_event_listener.cc b/chrome/browser/chromeos/system_key_event_listener.cc index 3149592..bedeec6 100644 --- a/chrome/browser/chromeos/system_key_event_listener.cc +++ b/chrome/browser/chromeos/system_key_event_listener.cc @@ -11,6 +11,7 @@ #undef Status #include "base/message_loop.h" +#include "chrome/browser/chromeos/input_method/input_method_configuration.h" #include "chrome/browser/chromeos/input_method/input_method_manager.h" #include "chrome/browser/chromeos/input_method/xkeyboard.h" #include "ui/base/x/x11_util.h" @@ -46,7 +47,7 @@ SystemKeyEventListener::SystemKeyEventListener() num_lock_mask_(0), xkb_event_base_(0) { input_method::XKeyboard* xkeyboard = - input_method::InputMethodManager::GetInstance()->GetXKeyboard(); + input_method::GetInputMethodManager()->GetXKeyboard(); num_lock_mask_ = xkeyboard->GetNumLockMask(); xkeyboard->GetLockedModifiers(&caps_lock_is_on_, NULL); @@ -107,7 +108,7 @@ void SystemKeyEventListener::OnCapsLock(bool enabled) { bool SystemKeyEventListener::ProcessedXEvent(XEvent* xevent) { input_method::InputMethodManager* input_method_manager = - input_method::InputMethodManager::GetInstance(); + input_method::GetInputMethodManager(); if (xevent->type == xkb_event_base_) { // TODO(yusukes): Move this part to aura::RootWindowHost. diff --git a/chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.cc b/chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.cc index 9a1d5c7..bd48f83 100644 --- a/chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.cc +++ b/chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.cc @@ -7,6 +7,7 @@ #include <X11/Xlib.h> #include <X11/extensions/XInput2.h> +#include "chrome/browser/chromeos/input_method/input_method_configuration.h" #include "chrome/browser/chromeos/input_method/input_method_manager.h" #include "chrome/browser/chromeos/input_method/xkeyboard.h" #include "ui/base/x/x11_util.h" @@ -54,7 +55,7 @@ void HandleHierarchyChangedEvent( if (update_keyboard_status) { chromeos::input_method::InputMethodManager* input_method_manager = - chromeos::input_method::InputMethodManager::GetInstance(); + chromeos::input_method::GetInputMethodManager(); chromeos::input_method::XKeyboard* xkeyboard = input_method_manager->GetXKeyboard(); xkeyboard->ReapplyCurrentModifierLockStatus(); diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.cc b/chrome/browser/ui/ash/chrome_shell_delegate.cc index 050e1ca..9d2bc42 100644 --- a/chrome/browser/ui/ash/chrome_shell_delegate.cc +++ b/chrome/browser/ui/ash/chrome_shell_delegate.cc @@ -50,6 +50,7 @@ #include "chrome/browser/chromeos/accessibility/accessibility_util.h" #include "chrome/browser/chromeos/background/ash_user_wallpaper_delegate.h" #include "chrome/browser/chromeos/extensions/media_player_event_router.h" +#include "chrome/browser/chromeos/input_method/input_method_configuration.h" #include "chrome/browser/chromeos/input_method/input_method_manager.h" #include "chrome/browser/chromeos/login/user_manager.h" #include "chrome/browser/chromeos/login/webui_login_display_host.h" @@ -421,7 +422,7 @@ ash::UserWallpaperDelegate* ChromeShellDelegate::CreateUserWallpaperDelegate() { ash::CapsLockDelegate* ChromeShellDelegate::CreateCapsLockDelegate() { #if defined(OS_CHROMEOS) chromeos::input_method::XKeyboard* xkeyboard = - chromeos::input_method::InputMethodManager::GetInstance()->GetXKeyboard(); + chromeos::input_method::GetInputMethodManager()->GetXKeyboard(); return new CapsLockHandler(xkeyboard); #else return new CapsLockHandler; diff --git a/chrome/browser/ui/ash/event_rewriter.cc b/chrome/browser/ui/ash/event_rewriter.cc index 629a85e..74d71d9 100644 --- a/chrome/browser/ui/ash/event_rewriter.cc +++ b/chrome/browser/ui/ash/event_rewriter.cc @@ -27,6 +27,7 @@ #include "base/chromeos/chromeos_version.h" #include "base/command_line.h" +#include "chrome/browser/chromeos/input_method/input_method_configuration.h" #include "chrome/browser/chromeos/input_method/input_method_manager.h" #include "chrome/browser/chromeos/input_method/xkeyboard.h" #include "chrome/browser/chromeos/login/base_login_display_host.h" @@ -37,7 +38,7 @@ #include "ui/base/keycodes/keyboard_code_conversion_x.h" #include "ui/base/x/x11_util.h" -using chromeos::input_method::InputMethodManager; +using chromeos::input_method::GetInputMethodManager; #endif namespace { @@ -126,8 +127,7 @@ bool IsMod3UsedByCurrentInputMethod() { // it's not possible to make both features work. For now, we don't remap // Mod3Mask when Neo2 is in use. // TODO(yusukes): Remove the restriction. - return InputMethodManager::GetInstance()->GetCurrentInputMethod().id() == - kNeo2LayoutId; + return GetInputMethodManager()->GetCurrentInputMethod().id() == kNeo2LayoutId; } #endif @@ -524,8 +524,8 @@ bool EventRewriter::RewriteModifiers(ui::KeyEvent* event) { if ((event->type() == ui::ET_KEY_PRESSED) && (event->key_code() != ui::VKEY_CAPITAL) && (remapped_keycode == ui::VKEY_CAPITAL)) { - chromeos::input_method::XKeyboard* xkeyboard = xkeyboard_ ? - xkeyboard_ : InputMethodManager::GetInstance()->GetXKeyboard(); + chromeos::input_method::XKeyboard* xkeyboard = + xkeyboard_ ? xkeyboard_ : GetInputMethodManager()->GetXKeyboard(); xkeyboard->SetCapsLockEnabled(!xkeyboard->CapsLockIsEnabled()); } diff --git a/chrome/browser/ui/ash/event_rewriter_unittest.cc b/chrome/browser/ui/ash/event_rewriter_unittest.cc index 7662b36..2440cb8 100644 --- a/chrome/browser/ui/ash/event_rewriter_unittest.cc +++ b/chrome/browser/ui/ash/event_rewriter_unittest.cc @@ -19,6 +19,7 @@ #include <X11/XF86keysym.h> #include <X11/Xlib.h> +#include "chrome/browser/chromeos/input_method/input_method_configuration.h" #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h" #include "chrome/browser/chromeos/input_method/mock_xkeyboard.h" #include "chrome/browser/chromeos/login/mock_user_manager.h" @@ -168,13 +169,13 @@ class EventRewriterTest : public testing::Test { .WillRepeatedly(testing::Return(false)); input_method_manager_mock_ = new chromeos::input_method::MockInputMethodManager; - chromeos::input_method::InputMethodManager::InitializeForTesting( + chromeos::input_method::InitializeForTesting( input_method_manager_mock_); // pass ownership } virtual void TearDown() { // Shutdown() deletes the IME mock object. - chromeos::input_method::InputMethodManager::Shutdown(); + chromeos::input_method::Shutdown(); } protected: diff --git a/chrome/browser/ui/ash/ime_controller_chromeos.cc b/chrome/browser/ui/ash/ime_controller_chromeos.cc index 480d4af..8669922 100644 --- a/chrome/browser/ui/ash/ime_controller_chromeos.cc +++ b/chrome/browser/ui/ash/ime_controller_chromeos.cc @@ -4,24 +4,25 @@ #include "chrome/browser/ui/ash/ime_controller_chromeos.h" +#include "chrome/browser/chromeos/input_method/input_method_configuration.h" #include "chrome/browser/chromeos/input_method/input_method_manager.h" #include "ui/base/accelerators/accelerator.h" bool ImeController::HandleNextIme() { chromeos::input_method::InputMethodManager* manager = - chromeos::input_method::InputMethodManager::GetInstance(); + chromeos::input_method::GetInputMethodManager(); return manager->SwitchToNextInputMethod(); } bool ImeController::HandlePreviousIme() { chromeos::input_method::InputMethodManager* manager = - chromeos::input_method::InputMethodManager::GetInstance(); + chromeos::input_method::GetInputMethodManager(); return manager->SwitchToPreviousInputMethod(); } bool ImeController::HandleSwitchIme(const ui::Accelerator& accelerator) { chromeos::input_method::InputMethodManager* manager = - chromeos::input_method::InputMethodManager::GetInstance(); + chromeos::input_method::GetInputMethodManager(); return manager->SwitchInputMethod(accelerator); } @@ -48,7 +49,7 @@ ui::Accelerator ImeController::RemapAccelerator( bool ImeController::UsingFrenchInputMethod() const { chromeos::input_method::InputMethodManager* manager = - chromeos::input_method::InputMethodManager::GetInstance(); + chromeos::input_method::GetInputMethodManager(); const chromeos::input_method::InputMethodDescriptor& descriptor = manager->GetCurrentInputMethod(); const std::string& layout = descriptor.id(); diff --git a/chrome/browser/ui/ash/ime_controller_chromeos_unittest.cc b/chrome/browser/ui/ash/ime_controller_chromeos_unittest.cc index 5cfd10e..5716d26 100644 --- a/chrome/browser/ui/ash/ime_controller_chromeos_unittest.cc +++ b/chrome/browser/ui/ash/ime_controller_chromeos_unittest.cc @@ -5,6 +5,7 @@ #include "chrome/browser/ui/ash/ime_controller_chromeos.h" #include "base/basictypes.h" +#include "chrome/browser/chromeos/input_method/input_method_configuration.h" #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/accelerators/accelerator.h" @@ -19,12 +20,12 @@ class ImeControllerTest : public testing::Test { virtual void SetUp() OVERRIDE { mock_input_method_manager_ = new chromeos::input_method::MockInputMethodManager; - chromeos::input_method::InputMethodManager::InitializeForTesting( + chromeos::input_method::InitializeForTesting( mock_input_method_manager_); } virtual void TearDown() OVERRIDE { - chromeos::input_method::InputMethodManager::Shutdown(); + chromeos::input_method::Shutdown(); mock_input_method_manager_ = NULL; } diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc index 7fbabe3..cd5a16f 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc @@ -11,6 +11,7 @@ #include "chrome/browser/autocomplete/autocomplete_input.h" #include "chrome/browser/autocomplete/autocomplete_match.h" #include "chrome/browser/bookmarks/bookmark_node_data.h" +#include "chrome/browser/chromeos/input_method/input_method_configuration.h" #include "chrome/browser/command_updater.h" #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" @@ -223,7 +224,7 @@ OmniboxViewViews::OmniboxViewViews(OmniboxEditController* controller, OmniboxViewViews::~OmniboxViewViews() { #if defined(OS_CHROMEOS) - chromeos::input_method::InputMethodManager::GetInstance()-> + chromeos::input_method::GetInputMethodManager()-> RemoveCandidateWindowObserver(this); #endif @@ -264,7 +265,7 @@ void OmniboxViewViews::Init() { set_border(views::Border::CreateEmptyBorder(vertical_margin, 0, vertical_margin, 0)); #if defined(OS_CHROMEOS) - chromeos::input_method::InputMethodManager::GetInstance()-> + chromeos::input_method::GetInputMethodManager()-> AddCandidateWindowObserver(this); #endif } diff --git a/chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc b/chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc index e4116e6..aeba897 100644 --- a/chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc +++ b/chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc @@ -10,6 +10,7 @@ #include "base/memory/weak_ptr.h" #include "base/utf_string_conversions.h" #include "base/values.h" +#include "chrome/browser/chromeos/input_method/input_method_configuration.h" #include "chrome/browser/chromeos/input_method/input_method_manager.h" #include "chrome/browser/chromeos/input_method/xkeyboard.h" #include "chrome/browser/prefs/pref_service.h" @@ -315,7 +316,7 @@ void KeyboardOverlayHandler::RegisterMessages() { void KeyboardOverlayHandler::GetInputMethodId(const ListValue* args) { chromeos::input_method::InputMethodManager* manager = - chromeos::input_method::InputMethodManager::GetInstance(); + chromeos::input_method::GetInputMethodManager(); const chromeos::input_method::InputMethodDescriptor& descriptor = manager->GetCurrentInputMethod(); StringValue param(descriptor.id()); diff --git a/chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc index 03b98a8..967f799 100644 --- a/chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc @@ -11,6 +11,7 @@ #include "base/values.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chromeos/cros/cros_library.h" +#include "chrome/browser/chromeos/input_method/input_method_configuration.h" #include "chrome/browser/chromeos/input_method/input_method_manager.h" #include "chrome/browser/chromeos/input_method/input_method_util.h" #include "chrome/browser/chromeos/login/language_switch_menu.h" @@ -183,13 +184,13 @@ void NetworkScreenHandler::HandleOnInputMethodChanged(const ListValue* args) { std::string id; if (!args->GetString(0, &id)) NOTREACHED(); - input_method::InputMethodManager::GetInstance()->ChangeInputMethod(id); + input_method::GetInputMethodManager()->ChangeInputMethod(id); } ListValue* NetworkScreenHandler::GetLanguageList() { const std::string app_locale = g_browser_process->GetApplicationLocale(); input_method::InputMethodManager* manager = - input_method::InputMethodManager::GetInstance(); + input_method::GetInputMethodManager(); // GetSupportedInputMethods() never returns NULL. scoped_ptr<input_method::InputMethodDescriptors> descriptors( manager->GetSupportedInputMethods()); @@ -222,7 +223,7 @@ ListValue* NetworkScreenHandler::GetLanguageList() { ListValue* NetworkScreenHandler::GetInputMethods() { ListValue* input_methods_list = new ListValue; input_method::InputMethodManager* manager = - input_method::InputMethodManager::GetInstance(); + input_method::GetInputMethodManager(); input_method::InputMethodUtil* util = manager->GetInputMethodUtil(); scoped_ptr<input_method::InputMethodDescriptors> input_methods( manager->GetActiveInputMethods()); diff --git a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc index 84530d7..8929388 100644 --- a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc @@ -14,6 +14,7 @@ #include "chrome/browser/browser_shutdown.h" #include "chrome/browser/browsing_data/browsing_data_helper.h" #include "chrome/browser/browsing_data/browsing_data_remover.h" +#include "chrome/browser/chromeos/input_method/input_method_configuration.h" #include "chrome/browser/chromeos/input_method/input_method_manager.h" #include "chrome/browser/chromeos/input_method/xkeyboard.h" #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" @@ -227,7 +228,7 @@ void SigninScreenHandler::Show(bool oobe_ui) { SendUserList(false); // Reset Caps Lock state when login screen is shown. - input_method::InputMethodManager::GetInstance()->GetXKeyboard()-> + input_method::GetInputMethodManager()->GetXKeyboard()-> SetCapsLockEnabled(false); DictionaryValue params; diff --git a/chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.cc index 86588df..abba997 100644 --- a/chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.cc +++ b/chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.cc @@ -16,6 +16,7 @@ #include "base/values.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/chromeos/input_method/input_method_configuration.h" #include "chrome/browser/chromeos/input_method/input_method_manager.h" #include "chrome/browser/chromeos/input_method/input_method_util.h" #include "chrome/browser/lifetime/application_lifetime.h" @@ -75,7 +76,7 @@ void CrosLanguageOptionsHandler::GetLocalizedValues( IDS_OPTIONS_SETTINGS_LANGUAGES_INPUT_METHOD_EXTENSION_DESCRIPTION)); input_method::InputMethodManager* manager = - input_method::InputMethodManager::GetInstance(); + input_method::GetInputMethodManager(); // GetSupportedInputMethods() never return NULL. scoped_ptr<input_method::InputMethodDescriptors> descriptors( manager->GetSupportedInputMethods()); @@ -104,7 +105,7 @@ void CrosLanguageOptionsHandler::RegisterMessages() { ListValue* CrosLanguageOptionsHandler::GetInputMethodList( const input_method::InputMethodDescriptors& descriptors) { input_method::InputMethodManager* manager = - input_method::InputMethodManager::GetInstance(); + input_method::GetInputMethodManager(); ListValue* input_method_list = new ListValue(); @@ -173,7 +174,7 @@ ListValue* CrosLanguageOptionsHandler::GetLanguageList( for (std::set<std::string>::const_iterator iter = language_codes.begin(); iter != language_codes.end(); ++iter) { input_method::InputMethodUtil* input_method_util = - input_method::InputMethodManager::GetInstance()->GetInputMethodUtil(); + input_method::GetInputMethodManager()->GetInputMethodUtil(); const string16 display_name = input_method_util->GetLanguageDisplayNameFromCode(*iter); const string16 native_display_name = @@ -214,7 +215,7 @@ ListValue* CrosLanguageOptionsHandler::GetLanguageList( base::ListValue* CrosLanguageOptionsHandler::GetExtensionImeList() { input_method::InputMethodManager* manager = - input_method::InputMethodManager::GetInstance(); + input_method::GetInputMethodManager(); input_method::InputMethodDescriptors descriptors; manager->GetInputMethodExtensions(&descriptors); diff --git a/chrome/browser/ui/webui/options/language_options_handler_unittest.cc b/chrome/browser/ui/webui/options/language_options_handler_unittest.cc index 42204cc..0db2287 100644 --- a/chrome/browser/ui/webui/options/language_options_handler_unittest.cc +++ b/chrome/browser/ui/webui/options/language_options_handler_unittest.cc @@ -10,13 +10,13 @@ #include "testing/gtest/include/gtest/gtest.h" #if defined(OS_CHROMEOS) +#include "chrome/browser/chromeos/input_method/input_method_configuration.h" #include "chrome/browser/chromeos/input_method/input_method_descriptor.h" #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h" #include "chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.h" using chromeos::input_method::InputMethodDescriptor; using chromeos::input_method::InputMethodDescriptors; -using chromeos::input_method::InputMethodManager; using chromeos::input_method::MockInputMethodManager; namespace { @@ -24,10 +24,10 @@ namespace { class LanguageOptionsHandlerTest : public testing::Test { public: LanguageOptionsHandlerTest() { - InputMethodManager::InitializeForTesting(new MockInputMethodManager); + chromeos::input_method::InitializeForTesting(new MockInputMethodManager); } virtual ~LanguageOptionsHandlerTest() { - InputMethodManager::Shutdown(); + chromeos::input_method::Shutdown(); } protected: diff --git a/chrome/chrome_browser_chromeos.gypi b/chrome/chrome_browser_chromeos.gypi index 2e8ffb4..3a0a6f3 100644 --- a/chrome/chrome_browser_chromeos.gypi +++ b/chrome/chrome_browser_chromeos.gypi @@ -326,6 +326,8 @@ 'browser/chromeos/input_method/ibus_ui_controller.h', 'browser/chromeos/input_method/input_method_config.cc', 'browser/chromeos/input_method/input_method_config.h', + 'browser/chromeos/input_method/input_method_configuration.cc', + 'browser/chromeos/input_method/input_method_configuration.h', 'browser/chromeos/input_method/input_method_delegate.h', 'browser/chromeos/input_method/input_method_delegate_impl.cc', 'browser/chromeos/input_method/input_method_delegate_impl.h', @@ -333,7 +335,6 @@ 'browser/chromeos/input_method/input_method_descriptor.h', 'browser/chromeos/input_method/input_method_engine.cc', 'browser/chromeos/input_method/input_method_engine.h', - 'browser/chromeos/input_method/input_method_manager.cc', 'browser/chromeos/input_method/input_method_manager.h', 'browser/chromeos/input_method/input_method_manager_impl.cc', 'browser/chromeos/input_method/input_method_manager_impl.h', diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index 98a3f01..871f6bd 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi @@ -576,9 +576,9 @@ 'browser/chromeos/input_method/ibus_controller_base_unittest.cc', 'browser/chromeos/input_method/ibus_controller_impl_unittest.cc', 'browser/chromeos/input_method/ibus_controller_unittest.cc', + 'browser/chromeos/input_method/input_method_configuration_unittest.cc', 'browser/chromeos/input_method/input_method_descriptor_unittest.cc', 'browser/chromeos/input_method/input_method_manager_impl_unittest.cc', - 'browser/chromeos/input_method/input_method_manager_unittest.cc', 'browser/chromeos/input_method/input_method_property_unittest.cc', 'browser/chromeos/input_method/input_method_util_unittest.cc', 'browser/chromeos/input_method/input_method_whitelist_unittest.cc', |