| 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 <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 class InputImeSetCompositionFunction : public SyncExtensionFunction { | 77 class InputImeSetCompositionFunction : public SyncExtensionFunction { |
| 78 public: | 78 public: |
| 79 DECLARE_EXTENSION_FUNCTION("input.ime.setComposition", | 79 DECLARE_EXTENSION_FUNCTION("input.ime.setComposition", |
| 80 INPUT_IME_SETCOMPOSITION) | 80 INPUT_IME_SETCOMPOSITION) |
| 81 | 81 |
| 82 protected: | 82 protected: |
| 83 virtual ~InputImeSetCompositionFunction() {} | 83 virtual ~InputImeSetCompositionFunction() {} |
| 84 | 84 |
| 85 // ExtensionFunction: | 85 // ExtensionFunction: |
| 86 virtual bool RunSync() OVERRIDE; | 86 virtual bool RunSync() override; |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 class InputImeClearCompositionFunction : public SyncExtensionFunction { | 89 class InputImeClearCompositionFunction : public SyncExtensionFunction { |
| 90 public: | 90 public: |
| 91 DECLARE_EXTENSION_FUNCTION("input.ime.clearComposition", | 91 DECLARE_EXTENSION_FUNCTION("input.ime.clearComposition", |
| 92 INPUT_IME_CLEARCOMPOSITION) | 92 INPUT_IME_CLEARCOMPOSITION) |
| 93 | 93 |
| 94 protected: | 94 protected: |
| 95 virtual ~InputImeClearCompositionFunction() {} | 95 virtual ~InputImeClearCompositionFunction() {} |
| 96 | 96 |
| 97 // ExtensionFunction: | 97 // ExtensionFunction: |
| 98 virtual bool RunSync() OVERRIDE; | 98 virtual bool RunSync() override; |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 class InputImeCommitTextFunction : public SyncExtensionFunction { | 101 class InputImeCommitTextFunction : public SyncExtensionFunction { |
| 102 public: | 102 public: |
| 103 DECLARE_EXTENSION_FUNCTION("input.ime.commitText", INPUT_IME_COMMITTEXT) | 103 DECLARE_EXTENSION_FUNCTION("input.ime.commitText", INPUT_IME_COMMITTEXT) |
| 104 | 104 |
| 105 protected: | 105 protected: |
| 106 virtual ~InputImeCommitTextFunction() {} | 106 virtual ~InputImeCommitTextFunction() {} |
| 107 | 107 |
| 108 // ExtensionFunction: | 108 // ExtensionFunction: |
| 109 virtual bool RunSync() OVERRIDE; | 109 virtual bool RunSync() override; |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 class InputImeSetCandidateWindowPropertiesFunction | 112 class InputImeSetCandidateWindowPropertiesFunction |
| 113 : public SyncExtensionFunction { | 113 : public SyncExtensionFunction { |
| 114 public: | 114 public: |
| 115 DECLARE_EXTENSION_FUNCTION("input.ime.setCandidateWindowProperties", | 115 DECLARE_EXTENSION_FUNCTION("input.ime.setCandidateWindowProperties", |
| 116 INPUT_IME_SETCANDIDATEWINDOWPROPERTIES) | 116 INPUT_IME_SETCANDIDATEWINDOWPROPERTIES) |
| 117 | 117 |
| 118 protected: | 118 protected: |
| 119 virtual ~InputImeSetCandidateWindowPropertiesFunction() {} | 119 virtual ~InputImeSetCandidateWindowPropertiesFunction() {} |
| 120 | 120 |
| 121 // ExtensionFunction: | 121 // ExtensionFunction: |
| 122 virtual bool RunSync() OVERRIDE; | 122 virtual bool RunSync() override; |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 class InputImeSetCandidatesFunction : public SyncExtensionFunction { | 125 class InputImeSetCandidatesFunction : public SyncExtensionFunction { |
| 126 public: | 126 public: |
| 127 DECLARE_EXTENSION_FUNCTION("input.ime.setCandidates", INPUT_IME_SETCANDIDATES) | 127 DECLARE_EXTENSION_FUNCTION("input.ime.setCandidates", INPUT_IME_SETCANDIDATES) |
| 128 | 128 |
| 129 protected: | 129 protected: |
| 130 virtual ~InputImeSetCandidatesFunction() {} | 130 virtual ~InputImeSetCandidatesFunction() {} |
| 131 | 131 |
| 132 // ExtensionFunction: | 132 // ExtensionFunction: |
| 133 virtual bool RunSync() OVERRIDE; | 133 virtual bool RunSync() override; |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 class InputImeSetCursorPositionFunction : public SyncExtensionFunction { | 136 class InputImeSetCursorPositionFunction : public SyncExtensionFunction { |
| 137 public: | 137 public: |
| 138 DECLARE_EXTENSION_FUNCTION("input.ime.setCursorPosition", | 138 DECLARE_EXTENSION_FUNCTION("input.ime.setCursorPosition", |
| 139 INPUT_IME_SETCURSORPOSITION) | 139 INPUT_IME_SETCURSORPOSITION) |
| 140 | 140 |
| 141 protected: | 141 protected: |
| 142 virtual ~InputImeSetCursorPositionFunction() {} | 142 virtual ~InputImeSetCursorPositionFunction() {} |
| 143 | 143 |
| 144 // ExtensionFunction: | 144 // ExtensionFunction: |
| 145 virtual bool RunSync() OVERRIDE; | 145 virtual bool RunSync() override; |
| 146 }; | 146 }; |
| 147 | 147 |
| 148 class InputImeSetMenuItemsFunction : public SyncExtensionFunction { | 148 class InputImeSetMenuItemsFunction : public SyncExtensionFunction { |
| 149 public: | 149 public: |
| 150 DECLARE_EXTENSION_FUNCTION("input.ime.setMenuItems", INPUT_IME_SETMENUITEMS) | 150 DECLARE_EXTENSION_FUNCTION("input.ime.setMenuItems", INPUT_IME_SETMENUITEMS) |
| 151 | 151 |
| 152 protected: | 152 protected: |
| 153 virtual ~InputImeSetMenuItemsFunction() {} | 153 virtual ~InputImeSetMenuItemsFunction() {} |
| 154 | 154 |
| 155 // ExtensionFunction: | 155 // ExtensionFunction: |
| 156 virtual bool RunSync() OVERRIDE; | 156 virtual bool RunSync() override; |
| 157 }; | 157 }; |
| 158 | 158 |
| 159 class InputImeUpdateMenuItemsFunction : public SyncExtensionFunction { | 159 class InputImeUpdateMenuItemsFunction : public SyncExtensionFunction { |
| 160 public: | 160 public: |
| 161 DECLARE_EXTENSION_FUNCTION("input.ime.updateMenuItems", | 161 DECLARE_EXTENSION_FUNCTION("input.ime.updateMenuItems", |
| 162 INPUT_IME_UPDATEMENUITEMS) | 162 INPUT_IME_UPDATEMENUITEMS) |
| 163 | 163 |
| 164 protected: | 164 protected: |
| 165 virtual ~InputImeUpdateMenuItemsFunction() {} | 165 virtual ~InputImeUpdateMenuItemsFunction() {} |
| 166 | 166 |
| 167 // ExtensionFunction: | 167 // ExtensionFunction: |
| 168 virtual bool RunSync() OVERRIDE; | 168 virtual bool RunSync() override; |
| 169 }; | 169 }; |
| 170 | 170 |
| 171 class InputImeDeleteSurroundingTextFunction : public SyncExtensionFunction { | 171 class InputImeDeleteSurroundingTextFunction : public SyncExtensionFunction { |
| 172 public: | 172 public: |
| 173 DECLARE_EXTENSION_FUNCTION("input.ime.deleteSurroundingText", | 173 DECLARE_EXTENSION_FUNCTION("input.ime.deleteSurroundingText", |
| 174 INPUT_IME_DELETESURROUNDINGTEXT) | 174 INPUT_IME_DELETESURROUNDINGTEXT) |
| 175 protected: | 175 protected: |
| 176 virtual ~InputImeDeleteSurroundingTextFunction() {} | 176 virtual ~InputImeDeleteSurroundingTextFunction() {} |
| 177 | 177 |
| 178 // ExtensionFunction: | 178 // ExtensionFunction: |
| 179 virtual bool RunSync() OVERRIDE; | 179 virtual bool RunSync() override; |
| 180 }; | 180 }; |
| 181 | 181 |
| 182 class InputImeKeyEventHandledFunction : public AsyncExtensionFunction { | 182 class InputImeKeyEventHandledFunction : public AsyncExtensionFunction { |
| 183 public: | 183 public: |
| 184 DECLARE_EXTENSION_FUNCTION("input.ime.keyEventHandled", | 184 DECLARE_EXTENSION_FUNCTION("input.ime.keyEventHandled", |
| 185 INPUT_IME_KEYEVENTHANDLED) | 185 INPUT_IME_KEYEVENTHANDLED) |
| 186 | 186 |
| 187 protected: | 187 protected: |
| 188 virtual ~InputImeKeyEventHandledFunction() {} | 188 virtual ~InputImeKeyEventHandledFunction() {} |
| 189 | 189 |
| 190 // ExtensionFunction: | 190 // ExtensionFunction: |
| 191 virtual bool RunAsync() OVERRIDE; | 191 virtual bool RunAsync() override; |
| 192 }; | 192 }; |
| 193 | 193 |
| 194 class InputImeSendKeyEventsFunction : public AsyncExtensionFunction { | 194 class InputImeSendKeyEventsFunction : public AsyncExtensionFunction { |
| 195 public: | 195 public: |
| 196 DECLARE_EXTENSION_FUNCTION("input.ime.sendKeyEvents", | 196 DECLARE_EXTENSION_FUNCTION("input.ime.sendKeyEvents", |
| 197 INPUT_IME_SENDKEYEVENTS) | 197 INPUT_IME_SENDKEYEVENTS) |
| 198 | 198 |
| 199 protected: | 199 protected: |
| 200 virtual ~InputImeSendKeyEventsFunction() {} | 200 virtual ~InputImeSendKeyEventsFunction() {} |
| 201 | 201 |
| 202 // ExtensionFunction: | 202 // ExtensionFunction: |
| 203 virtual bool RunAsync() OVERRIDE; | 203 virtual bool RunAsync() override; |
| 204 }; | 204 }; |
| 205 | 205 |
| 206 class InputImeHideInputViewFunction : public AsyncExtensionFunction { | 206 class InputImeHideInputViewFunction : public AsyncExtensionFunction { |
| 207 public: | 207 public: |
| 208 DECLARE_EXTENSION_FUNCTION("input.ime.hideInputView", | 208 DECLARE_EXTENSION_FUNCTION("input.ime.hideInputView", |
| 209 INPUT_IME_HIDEINPUTVIEW) | 209 INPUT_IME_HIDEINPUTVIEW) |
| 210 | 210 |
| 211 protected: | 211 protected: |
| 212 virtual ~InputImeHideInputViewFunction() {} | 212 virtual ~InputImeHideInputViewFunction() {} |
| 213 | 213 |
| 214 // ExtensionFunction: | 214 // ExtensionFunction: |
| 215 virtual bool RunAsync() OVERRIDE; | 215 virtual bool RunAsync() override; |
| 216 }; | 216 }; |
| 217 | 217 |
| 218 class InputImeAPI : public BrowserContextKeyedAPI, | 218 class InputImeAPI : public BrowserContextKeyedAPI, |
| 219 public ExtensionRegistryObserver, | 219 public ExtensionRegistryObserver, |
| 220 public EventRouter::Observer { | 220 public EventRouter::Observer { |
| 221 public: | 221 public: |
| 222 explicit InputImeAPI(content::BrowserContext* context); | 222 explicit InputImeAPI(content::BrowserContext* context); |
| 223 virtual ~InputImeAPI(); | 223 virtual ~InputImeAPI(); |
| 224 | 224 |
| 225 // BrowserContextKeyedAPI implementation. | 225 // BrowserContextKeyedAPI implementation. |
| 226 static BrowserContextKeyedAPIFactory<InputImeAPI>* GetFactoryInstance(); | 226 static BrowserContextKeyedAPIFactory<InputImeAPI>* GetFactoryInstance(); |
| 227 | 227 |
| 228 // ExtensionRegistryObserver implementation. | 228 // ExtensionRegistryObserver implementation. |
| 229 virtual void OnExtensionLoaded(content::BrowserContext* browser_context, | 229 virtual void OnExtensionLoaded(content::BrowserContext* browser_context, |
| 230 const Extension* extension) OVERRIDE; | 230 const Extension* extension) override; |
| 231 virtual void OnExtensionUnloaded( | 231 virtual void OnExtensionUnloaded( |
| 232 content::BrowserContext* browser_context, | 232 content::BrowserContext* browser_context, |
| 233 const Extension* extension, | 233 const Extension* extension, |
| 234 UnloadedExtensionInfo::Reason reason) OVERRIDE; | 234 UnloadedExtensionInfo::Reason reason) override; |
| 235 | 235 |
| 236 // EventRouter::Observer implementation. | 236 // EventRouter::Observer implementation. |
| 237 virtual void OnListenerAdded(const EventListenerInfo& details) OVERRIDE; | 237 virtual void OnListenerAdded(const EventListenerInfo& details) override; |
| 238 | 238 |
| 239 private: | 239 private: |
| 240 friend class BrowserContextKeyedAPIFactory<InputImeAPI>; | 240 friend class BrowserContextKeyedAPIFactory<InputImeAPI>; |
| 241 InputImeEventRouter* input_ime_event_router(); | 241 InputImeEventRouter* input_ime_event_router(); |
| 242 | 242 |
| 243 // BrowserContextKeyedAPI implementation. | 243 // BrowserContextKeyedAPI implementation. |
| 244 static const char* service_name() { | 244 static const char* service_name() { |
| 245 return "InputImeAPI"; | 245 return "InputImeAPI"; |
| 246 } | 246 } |
| 247 static const bool kServiceIsNULLWhileTesting = true; | 247 static const bool kServiceIsNULLWhileTesting = true; |
| 248 | 248 |
| 249 content::BrowserContext* const browser_context_; | 249 content::BrowserContext* const browser_context_; |
| 250 | 250 |
| 251 // Listen to extension load, unloaded notifications. | 251 // Listen to extension load, unloaded notifications. |
| 252 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 252 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
| 253 extension_registry_observer_; | 253 extension_registry_observer_; |
| 254 }; | 254 }; |
| 255 | 255 |
| 256 } // namespace extensions | 256 } // namespace extensions |
| 257 | 257 |
| 258 #endif // CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_H_ | 258 #endif // CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_H_ |
| OLD | NEW |