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

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: Rebased 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/extensions/input_method_api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..719c3028a73e6ddb5090081ec10ae69c27d33b13 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,31 @@ 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();
+
+ // Returns input method name for the given XKB (X keyboard extensions in X
+ // Window System) id.
+ static std::string GetInputMethodForXkb(const std::string& xkb_id);
+
+ // ProfileKeyedService implementation.
+ virtual void Shutdown() OVERRIDE;
+
+ // EventRouter::Observer implementation.
+ virtual void OnListenerAdded(const extensions::EventListenerInfo& details)
+ OVERRIDE;
+
+ private:
+ Profile* const profile_;
+
+ // Created lazily upon OnListenerAdded.
+ scoped_ptr<chromeos::ExtensionInputMethodEventRouter>
+ input_method_event_router_;
+};
+
} // namespace extensions
#endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_INPUT_METHOD_API_H_
« no previous file with comments | « no previous file | chrome/browser/chromeos/extensions/input_method_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698