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

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

Issue 11466010: Decompose BrowserStateMonitor into two parts, simplifying unit tests and APIs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix gypi ordering. Created 8 years 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_configuration.cc
diff --git a/chrome/browser/chromeos/input_method/input_method_configuration.cc b/chrome/browser/chromeos/input_method/input_method_configuration.cc
index 647cf3bd2742e9921acc350aa8ac719be2eca8ee..f98025f15436453fc71d9bb46314909b364dc157 100644
--- a/chrome/browser/chromeos/input_method/input_method_configuration.cc
+++ b/chrome/browser/chromeos/input_method/input_method_configuration.cc
@@ -4,18 +4,29 @@
#include "chrome/browser/chromeos/input_method/input_method_configuration.h"
+#include "base/bind.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/chromeos/input_method/browser_state_monitor.h"
#include "chrome/browser/chromeos/input_method/input_method_delegate_impl.h"
#include "chrome/browser/chromeos/input_method/input_method_manager_impl.h"
+#include "chrome/browser/chromeos/input_method/input_method_persistence.h"
namespace chromeos {
namespace input_method {
namespace {
InputMethodManager* g_input_method_manager = NULL;
+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) {
+ input_method_persistence->OnSessionStateChange(new_state);
+ input_method_manager_impl->SetState(new_state);
+}
void Initialize() {
DCHECK(!g_input_method_manager);
@@ -24,6 +35,10 @@ void Initialize() {
scoped_ptr<InputMethodDelegate>(new InputMethodDelegateImpl));
impl->Init();
g_input_method_manager = impl;
+ g_input_method_persistence =
+ new InputMethodPersistence(g_input_method_manager);
+ g_browser_state_monitor = new BrowserStateMonitor(
+ base::Bind(&OnSessionStateChange, impl, g_input_method_persistence));
DVLOG(1) << "InputMethodManager initialized";
}
@@ -35,8 +50,15 @@ void InitializeForTesting(InputMethodManager* mock_manager) {
}
void Shutdown() {
+ delete g_browser_state_monitor;
+ g_browser_state_monitor = NULL;
+
+ delete g_input_method_persistence;
+ g_input_method_persistence = NULL;
+
delete g_input_method_manager;
g_input_method_manager = NULL;
+
DVLOG(1) << "InputMethodManager shutdown";
}

Powered by Google App Engine
This is Rietveld 408576698