summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chromeos/input_method/input_method_configuration.cc83
-rw-r--r--chromeos/ime/input_method_manager.h2
2 files changed, 32 insertions, 53 deletions
diff --git a/chrome/browser/chromeos/input_method/input_method_configuration.cc b/chrome/browser/chromeos/input_method/input_method_configuration.cc
index bea7e54..dc20c41 100644
--- a/chrome/browser/chromeos/input_method/input_method_configuration.cc
+++ b/chrome/browser/chromeos/input_method/input_method_configuration.cc
@@ -17,6 +17,10 @@ namespace chromeos {
namespace input_method {
namespace {
+InputMethodPersistence* g_input_method_persistence = NULL;
+BrowserStateMonitor* g_browser_state_monitor = NULL;
+} // namespace
+
void OnSessionStateChange(InputMethodManagerImpl* input_method_manager_impl,
InputMethodPersistence* input_method_persistence,
InputMethodManager::State new_state) {
@@ -24,68 +28,43 @@ void OnSessionStateChange(InputMethodManagerImpl* input_method_manager_impl,
input_method_manager_impl->SetState(new_state);
}
-class InputMethodConfiguration {
- public:
- InputMethodConfiguration() {}
- virtual ~InputMethodConfiguration() {}
-
- void Initialize(
- const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner) {
- IBusBridge::Initialize();
-
- InputMethodManagerImpl* impl = new InputMethodManagerImpl(
- scoped_ptr<InputMethodDelegate>(new InputMethodDelegateImpl));
- impl->Init(ui_task_runner.get());
- InputMethodManager::Initialize(impl);
-
- input_method_persistence_.reset(new InputMethodPersistence(impl));
- browser_state_monitor_.reset(new BrowserStateMonitor(
- base::Bind(&OnSessionStateChange,
- impl,
- input_method_persistence_.get())));
-
- DVLOG(1) << "InputMethodManager initialized";
- }
-
- void InitializeForTesting(InputMethodManager* mock_manager) {
- InputMethodManager::Initialize(mock_manager);
- DVLOG(1) << "InputMethodManager for testing initialized";
- }
-
- void Shutdown() {
- browser_state_monitor_.reset();
- input_method_persistence_.reset();
+void Initialize(
+ const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner,
+ const scoped_refptr<base::SequencedTaskRunner>& file_task_runner) {
+ IBusBridge::Initialize();
- InputMethodManager::Shutdown();
+ InputMethodManagerImpl* impl = new InputMethodManagerImpl(
+ scoped_ptr<InputMethodDelegate>(new InputMethodDelegateImpl));
+ impl->Init(ui_task_runner.get());
+ InputMethodManager::Initialize(impl);
+ g_input_method_persistence = new InputMethodPersistence(impl);
+ g_browser_state_monitor = new BrowserStateMonitor(
+ base::Bind(&OnSessionStateChange, impl, g_input_method_persistence));
- IBusBridge::Shutdown();
+ DVLOG(1) << "InputMethodManager initialized";
+}
- DVLOG(1) << "InputMethodManager shutdown";
- }
+void InitializeForTesting(InputMethodManager* mock_manager) {
+ InputMethodManager::Initialize(mock_manager);
+ DVLOG(1) << "InputMethodManager for testing initialized";
+}
- private:
- scoped_ptr<BrowserStateMonitor> browser_state_monitor_;
- scoped_ptr<InputMethodPersistence> input_method_persistence_;
-};
+void Shutdown() {
+ delete g_browser_state_monitor;
+ g_browser_state_monitor = NULL;
-InputMethodConfiguration* g_input_method_configuration = NULL;
+ delete g_input_method_persistence;
+ g_input_method_persistence = NULL;
-} // namespace
+ InputMethodManager::Shutdown();
-void Initialize(
- const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner,
- const scoped_refptr<base::SequencedTaskRunner>& file_task_runner) {
- g_input_method_configuration = new InputMethodConfiguration();
- g_input_method_configuration->Initialize(ui_task_runner);
-}
+ IBusBridge::Shutdown();
-void InitializeForTesting(InputMethodManager* mock_manager) {
- g_input_method_configuration = new InputMethodConfiguration();
- g_input_method_configuration->InitializeForTesting(mock_manager);
+ DVLOG(1) << "InputMethodManager shutdown";
}
-void Shutdown() {
- g_input_method_configuration->Shutdown();
+InputMethodManager* GetInputMethodManager() {
+ return InputMethodManager::Get();
}
} // namespace input_method
diff --git a/chromeos/ime/input_method_manager.h b/chromeos/ime/input_method_manager.h
index 3d5666e..16decf4 100644
--- a/chromeos/ime/input_method_manager.h
+++ b/chromeos/ime/input_method_manager.h
@@ -29,7 +29,7 @@ class XKeyboard;
// This class manages input methodshandles. Classes can add themselves as
// observers. Clients can get an instance of this library class by:
-// InputMethodManager::Get().
+// GetInputMethodManager().
class CHROMEOS_EXPORT InputMethodManager {
public:
enum State {