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

Unified Diff: chrome/browser/chromeos/extensions/input_method_api.h

Issue 11442074: Lazy initialization for ExtensionInputMethodEventRouter (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 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/extensions/input_method_api.h
diff --git a/chrome/browser/chromeos/extensions/input_method_api.h b/chrome/browser/chromeos/extensions/input_method_api.h
index 37bd9d2d1d2cd68eeb43c7e90ce93f721577ff0d..bdadd7613d906642fd0911b419e745bb877a6a40 100644
--- a/chrome/browser/chromeos/extensions/input_method_api.h
+++ b/chrome/browser/chromeos/extensions/input_method_api.h
@@ -6,7 +6,14 @@
#define CHROME_BROWSER_CHROMEOS_EXTENSIONS_INPUT_METHOD_API_H_
#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/extensions/event_router.h"
#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/profiles/profile_keyed_service.h"
+
+namespace chromeos {
+class ExtensionInputMethodEventRouter;
+}
namespace extensions {
@@ -24,6 +31,32 @@ class GetInputMethodFunction : public SyncExtensionFunction {
DECLARE_EXTENSION_FUNCTION_NAME("inputMethodPrivate.get");
};
+class InputMethodAPI : public ProfileKeyedService,
+ public extensions::EventRouter::Observer {
+ public:
+ explicit InputMethodAPI(Profile* profile);
+ virtual ~InputMethodAPI();
+
+ // Convenience method to get the InputMethodAPI for a profile.
+ static InputMethodAPI* Get(Profile* profile);
+
+ chromeos::ExtensionInputMethodEventRouter* input_method_event_router();
+
+ // ProfileKeyedService implementation.
+ virtual void Shutdown() OVERRIDE;
+
+ // EventRouter::Observer implementation.
+ virtual void OnListenerAdded(const extensions::EventListenerInfo& details)
+ OVERRIDE;
+
+ private:
+ Profile* profile_;
+
+ // Created lazily upon OnListenerAdded.
+ scoped_ptr<chromeos::ExtensionInputMethodEventRouter>
+ input_method_event_router_;
+};
+
} // namespace extensions
#endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_INPUT_METHOD_API_H_

Powered by Google App Engine
This is Rietveld 408576698