| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/extensions/extension_function.h" | |
| 9 | |
| 10 #include "base/memory/singleton.h" | |
| 11 #include "base/values.h" | |
| 12 #include "chrome/browser/chromeos/input_method/input_method_engine.h" | |
| 13 #include "chrome/common/extensions/extension.h" | |
| 14 | |
| 15 #include <map> | 8 #include <map> |
| 16 #include <string> | 9 #include <string> |
| 17 #include <vector> | 10 #include <vector> |
| 18 | 11 |
| 12 #include "base/memory/singleton.h" |
| 13 #include "base/values.h" |
| 14 #include "chrome/browser/chromeos/input_method/input_method_engine.h" |
| 15 #include "chrome/browser/extensions/extension_function.h" |
| 16 #include "chrome/browser/profiles/profile_keyed_service.h" |
| 17 #include "chrome/common/extensions/extension.h" |
| 18 #include "content/public/browser/notification_observer.h" |
| 19 #include "content/public/browser/notification_registrar.h" |
| 20 |
| 19 class Profile; | 21 class Profile; |
| 20 | 22 |
| 21 namespace chromeos { | 23 namespace chromeos { |
| 22 class InputMethodEngine; | 24 class InputMethodEngine; |
| 23 class ImeObserver; | 25 class ImeObserver; |
| 24 } | 26 } |
| 25 | 27 |
| 26 namespace extensions { | 28 namespace extensions { |
| 27 | 29 |
| 28 class InputImeEventRouter { | 30 class InputImeEventRouter { |
| 29 public: | 31 public: |
| 30 static InputImeEventRouter* GetInstance(); | 32 static InputImeEventRouter* GetInstance(); |
| 31 void Init(); | |
| 32 | 33 |
| 33 bool RegisterIme(Profile* profile, | 34 bool RegisterIme(Profile* profile, |
| 34 const std::string& extension_id, | 35 const std::string& extension_id, |
| 35 const extensions::Extension::InputComponentInfo& component); | 36 const extensions::Extension::InputComponentInfo& component); |
| 36 void UnregisterAllImes(Profile* profile, const std::string& extension_id); | 37 void UnregisterAllImes(Profile* profile, const std::string& extension_id); |
| 37 chromeos::InputMethodEngine* GetEngine(const std::string& extension_id, | 38 chromeos::InputMethodEngine* GetEngine(const std::string& extension_id, |
| 38 const std::string& engine_id); | 39 const std::string& engine_id); |
| 39 chromeos::InputMethodEngine* GetActiveEngine(const std::string& extension_id); | 40 chromeos::InputMethodEngine* GetActiveEngine(const std::string& extension_id); |
| 40 | 41 |
| 41 | 42 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 public: | 164 public: |
| 164 DECLARE_EXTENSION_FUNCTION_NAME("input.ime.keyEventHandled"); | 165 DECLARE_EXTENSION_FUNCTION_NAME("input.ime.keyEventHandled"); |
| 165 | 166 |
| 166 protected: | 167 protected: |
| 167 virtual ~KeyEventHandled() {} | 168 virtual ~KeyEventHandled() {} |
| 168 | 169 |
| 169 // ExtensionFunction: | 170 // ExtensionFunction: |
| 170 virtual bool RunImpl() OVERRIDE; | 171 virtual bool RunImpl() OVERRIDE; |
| 171 }; | 172 }; |
| 172 | 173 |
| 174 class InputImeAPI : public ProfileKeyedService, |
| 175 public content::NotificationObserver { |
| 176 public: |
| 177 explicit InputImeAPI(Profile* profile); |
| 178 virtual ~InputImeAPI(); |
| 179 |
| 180 // content::NotificationObserver implementation. |
| 181 virtual void Observe(int type, |
| 182 const content::NotificationSource& source, |
| 183 const content::NotificationDetails& details) OVERRIDE; |
| 184 |
| 185 private: |
| 186 InputImeEventRouter* input_ime_event_router(); |
| 187 |
| 188 Profile* const profile_; |
| 189 content::NotificationRegistrar registrar_; |
| 190 }; |
| 191 |
| 173 } // namespace extensions | 192 } // namespace extensions |
| 174 | 193 |
| 175 #endif // CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_H_ | 194 #endif // CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_H_ |
| OLD | NEW |