| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_CHROMEOS_EXTENSIONS_INPUT_METHOD_API_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_INPUT_METHOD_API_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_INPUT_METHOD_API_H_ | 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_INPUT_METHOD_API_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "extensions/browser/browser_context_keyed_api_factory.h" | 10 #include "extensions/browser/browser_context_keyed_api_factory.h" |
| 11 #include "extensions/browser/event_router.h" | 11 #include "extensions/browser/event_router.h" |
| 12 #include "extensions/browser/extension_function.h" | 12 #include "extensions/browser/extension_function.h" |
| 13 | 13 |
| 14 namespace chromeos { | 14 namespace chromeos { |
| 15 class ExtensionDictionaryEventRouter; | 15 class ExtensionDictionaryEventRouter; |
| 16 class ExtensionInputMethodEventRouter; | 16 class ExtensionInputMethodEventRouter; |
| 17 class ExtensionImeMenuEventRouter; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace extensions { | 20 namespace extensions { |
| 20 | 21 |
| 21 // Implements the inputMethodPrivate.getInputMethodConfig method. | 22 // Implements the inputMethodPrivate.getInputMethodConfig method. |
| 22 class GetInputMethodConfigFunction : public UIThreadExtensionFunction { | 23 class GetInputMethodConfigFunction : public UIThreadExtensionFunction { |
| 23 public: | 24 public: |
| 24 GetInputMethodConfigFunction() {} | 25 GetInputMethodConfigFunction() {} |
| 25 | 26 |
| 26 protected: | 27 protected: |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 INPUTMETHODPRIVATE_GETENCRYPTSYNCENABLED) | 130 INPUTMETHODPRIVATE_GETENCRYPTSYNCENABLED) |
| 130 DISALLOW_COPY_AND_ASSIGN(GetEncryptSyncEnabledFunction); | 131 DISALLOW_COPY_AND_ASSIGN(GetEncryptSyncEnabledFunction); |
| 131 }; | 132 }; |
| 132 | 133 |
| 133 class InputMethodAPI : public BrowserContextKeyedAPI, | 134 class InputMethodAPI : public BrowserContextKeyedAPI, |
| 134 public extensions::EventRouter::Observer { | 135 public extensions::EventRouter::Observer { |
| 135 public: | 136 public: |
| 136 static const char kOnDictionaryChanged[]; | 137 static const char kOnDictionaryChanged[]; |
| 137 static const char kOnDictionaryLoaded[]; | 138 static const char kOnDictionaryLoaded[]; |
| 138 static const char kOnInputMethodChanged[]; | 139 static const char kOnInputMethodChanged[]; |
| 140 static const char kOnImeMenuActivated[]; |
| 141 static const char kOnImeMenuDeactivated[]; |
| 139 | 142 |
| 140 explicit InputMethodAPI(content::BrowserContext* context); | 143 explicit InputMethodAPI(content::BrowserContext* context); |
| 141 ~InputMethodAPI() override; | 144 ~InputMethodAPI() override; |
| 142 | 145 |
| 143 // Returns input method name for the given XKB (X keyboard extensions in X | 146 // Returns input method name for the given XKB (X keyboard extensions in X |
| 144 // Window System) id. | 147 // Window System) id. |
| 145 static std::string GetInputMethodForXkb(const std::string& xkb_id); | 148 static std::string GetInputMethodForXkb(const std::string& xkb_id); |
| 146 | 149 |
| 147 // BrowserContextKeyedAPI implementation. | 150 // BrowserContextKeyedAPI implementation. |
| 148 static BrowserContextKeyedAPIFactory<InputMethodAPI>* GetFactoryInstance(); | 151 static BrowserContextKeyedAPIFactory<InputMethodAPI>* GetFactoryInstance(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 162 } | 165 } |
| 163 static const bool kServiceIsNULLWhileTesting = true; | 166 static const bool kServiceIsNULLWhileTesting = true; |
| 164 | 167 |
| 165 content::BrowserContext* const context_; | 168 content::BrowserContext* const context_; |
| 166 | 169 |
| 167 // Created lazily upon OnListenerAdded. | 170 // Created lazily upon OnListenerAdded. |
| 168 scoped_ptr<chromeos::ExtensionInputMethodEventRouter> | 171 scoped_ptr<chromeos::ExtensionInputMethodEventRouter> |
| 169 input_method_event_router_; | 172 input_method_event_router_; |
| 170 scoped_ptr<chromeos::ExtensionDictionaryEventRouter> | 173 scoped_ptr<chromeos::ExtensionDictionaryEventRouter> |
| 171 dictionary_event_router_; | 174 dictionary_event_router_; |
| 175 scoped_ptr<chromeos::ExtensionImeMenuEventRouter> ime_menu_event_router_; |
| 172 | 176 |
| 173 DISALLOW_COPY_AND_ASSIGN(InputMethodAPI); | 177 DISALLOW_COPY_AND_ASSIGN(InputMethodAPI); |
| 174 }; | 178 }; |
| 175 | 179 |
| 176 } // namespace extensions | 180 } // namespace extensions |
| 177 | 181 |
| 178 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_INPUT_METHOD_API_H_ | 182 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_INPUT_METHOD_API_H_ |
| OLD | NEW |