| 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 ExtensionInputMethodEventRouter; | 16 class ExtensionInputMethodEventRouter; |
| 16 } | 17 } |
| 17 | 18 |
| 18 namespace extensions { | 19 namespace extensions { |
| 19 | 20 |
| 20 // Implements the inputMethodPrivate.getInputMethodConfig method. | 21 // Implements the inputMethodPrivate.getInputMethodConfig method. |
| 21 class GetInputMethodConfigFunction : public UIThreadExtensionFunction { | 22 class GetInputMethodConfigFunction : public UIThreadExtensionFunction { |
| 22 public: | 23 public: |
| 23 GetInputMethodConfigFunction() {} | 24 GetInputMethodConfigFunction() {} |
| 24 | 25 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 110 |
| 110 private: | 111 private: |
| 111 DECLARE_EXTENSION_FUNCTION("inputMethodPrivate.addWordToDictionary", | 112 DECLARE_EXTENSION_FUNCTION("inputMethodPrivate.addWordToDictionary", |
| 112 INPUTMETHODPRIVATE_ADDWORDTODICTIONARY) | 113 INPUTMETHODPRIVATE_ADDWORDTODICTIONARY) |
| 113 DISALLOW_COPY_AND_ASSIGN(AddWordToDictionaryFunction); | 114 DISALLOW_COPY_AND_ASSIGN(AddWordToDictionaryFunction); |
| 114 }; | 115 }; |
| 115 | 116 |
| 116 class InputMethodAPI : public BrowserContextKeyedAPI, | 117 class InputMethodAPI : public BrowserContextKeyedAPI, |
| 117 public extensions::EventRouter::Observer { | 118 public extensions::EventRouter::Observer { |
| 118 public: | 119 public: |
| 120 static const char kOnDictionaryChanged[]; |
| 121 static const char kOnDictionaryLoaded[]; |
| 119 static const char kOnInputMethodChanged[]; | 122 static const char kOnInputMethodChanged[]; |
| 120 | 123 |
| 121 explicit InputMethodAPI(content::BrowserContext* context); | 124 explicit InputMethodAPI(content::BrowserContext* context); |
| 122 ~InputMethodAPI() override; | 125 ~InputMethodAPI() override; |
| 123 | 126 |
| 124 // Returns input method name for the given XKB (X keyboard extensions in X | 127 // Returns input method name for the given XKB (X keyboard extensions in X |
| 125 // Window System) id. | 128 // Window System) id. |
| 126 static std::string GetInputMethodForXkb(const std::string& xkb_id); | 129 static std::string GetInputMethodForXkb(const std::string& xkb_id); |
| 127 | 130 |
| 128 // BrowserContextKeyedAPI implementation. | 131 // BrowserContextKeyedAPI implementation. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 141 static const char* service_name() { | 144 static const char* service_name() { |
| 142 return "InputMethodAPI"; | 145 return "InputMethodAPI"; |
| 143 } | 146 } |
| 144 static const bool kServiceIsNULLWhileTesting = true; | 147 static const bool kServiceIsNULLWhileTesting = true; |
| 145 | 148 |
| 146 content::BrowserContext* const context_; | 149 content::BrowserContext* const context_; |
| 147 | 150 |
| 148 // Created lazily upon OnListenerAdded. | 151 // Created lazily upon OnListenerAdded. |
| 149 scoped_ptr<chromeos::ExtensionInputMethodEventRouter> | 152 scoped_ptr<chromeos::ExtensionInputMethodEventRouter> |
| 150 input_method_event_router_; | 153 input_method_event_router_; |
| 154 scoped_ptr<chromeos::ExtensionDictionaryEventRouter> |
| 155 dictionary_event_router_; |
| 151 | 156 |
| 152 DISALLOW_COPY_AND_ASSIGN(InputMethodAPI); | 157 DISALLOW_COPY_AND_ASSIGN(InputMethodAPI); |
| 153 }; | 158 }; |
| 154 | 159 |
| 155 } // namespace extensions | 160 } // namespace extensions |
| 156 | 161 |
| 157 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_INPUT_METHOD_API_H_ | 162 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_INPUT_METHOD_API_H_ |
| OLD | NEW |