| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 79 |
| 80 class InputImeSetCompositionFunction : public SyncExtensionFunction { | 80 class InputImeSetCompositionFunction : public SyncExtensionFunction { |
| 81 public: | 81 public: |
| 82 DECLARE_EXTENSION_FUNCTION("input.ime.setComposition", | 82 DECLARE_EXTENSION_FUNCTION("input.ime.setComposition", |
| 83 INPUT_IME_SETCOMPOSITION) | 83 INPUT_IME_SETCOMPOSITION) |
| 84 | 84 |
| 85 protected: | 85 protected: |
| 86 virtual ~InputImeSetCompositionFunction() {} | 86 virtual ~InputImeSetCompositionFunction() {} |
| 87 | 87 |
| 88 // ExtensionFunction: | 88 // ExtensionFunction: |
| 89 virtual bool RunImpl() OVERRIDE; | 89 virtual bool RunSync() OVERRIDE; |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 class InputImeClearCompositionFunction : public SyncExtensionFunction { | 92 class InputImeClearCompositionFunction : public SyncExtensionFunction { |
| 93 public: | 93 public: |
| 94 DECLARE_EXTENSION_FUNCTION("input.ime.clearComposition", | 94 DECLARE_EXTENSION_FUNCTION("input.ime.clearComposition", |
| 95 INPUT_IME_CLEARCOMPOSITION) | 95 INPUT_IME_CLEARCOMPOSITION) |
| 96 | 96 |
| 97 protected: | 97 protected: |
| 98 virtual ~InputImeClearCompositionFunction() {} | 98 virtual ~InputImeClearCompositionFunction() {} |
| 99 | 99 |
| 100 // ExtensionFunction: | 100 // ExtensionFunction: |
| 101 virtual bool RunImpl() OVERRIDE; | 101 virtual bool RunSync() OVERRIDE; |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 class InputImeCommitTextFunction : public SyncExtensionFunction { | 104 class InputImeCommitTextFunction : public SyncExtensionFunction { |
| 105 public: | 105 public: |
| 106 DECLARE_EXTENSION_FUNCTION("input.ime.commitText", INPUT_IME_COMMITTEXT) | 106 DECLARE_EXTENSION_FUNCTION("input.ime.commitText", INPUT_IME_COMMITTEXT) |
| 107 | 107 |
| 108 protected: | 108 protected: |
| 109 virtual ~InputImeCommitTextFunction() {} | 109 virtual ~InputImeCommitTextFunction() {} |
| 110 | 110 |
| 111 // ExtensionFunction: | 111 // ExtensionFunction: |
| 112 virtual bool RunImpl() OVERRIDE; | 112 virtual bool RunSync() OVERRIDE; |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 class InputImeSetCandidateWindowPropertiesFunction | 115 class InputImeSetCandidateWindowPropertiesFunction |
| 116 : public SyncExtensionFunction { | 116 : public SyncExtensionFunction { |
| 117 public: | 117 public: |
| 118 DECLARE_EXTENSION_FUNCTION("input.ime.setCandidateWindowProperties", | 118 DECLARE_EXTENSION_FUNCTION("input.ime.setCandidateWindowProperties", |
| 119 INPUT_IME_SETCANDIDATEWINDOWPROPERTIES) | 119 INPUT_IME_SETCANDIDATEWINDOWPROPERTIES) |
| 120 | 120 |
| 121 protected: | 121 protected: |
| 122 virtual ~InputImeSetCandidateWindowPropertiesFunction() {} | 122 virtual ~InputImeSetCandidateWindowPropertiesFunction() {} |
| 123 | 123 |
| 124 // ExtensionFunction: | 124 // ExtensionFunction: |
| 125 virtual bool RunImpl() OVERRIDE; | 125 virtual bool RunSync() OVERRIDE; |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 class InputImeSetCandidatesFunction : public SyncExtensionFunction { | 128 class InputImeSetCandidatesFunction : public SyncExtensionFunction { |
| 129 public: | 129 public: |
| 130 DECLARE_EXTENSION_FUNCTION("input.ime.setCandidates", INPUT_IME_SETCANDIDATES) | 130 DECLARE_EXTENSION_FUNCTION("input.ime.setCandidates", INPUT_IME_SETCANDIDATES) |
| 131 | 131 |
| 132 protected: | 132 protected: |
| 133 virtual ~InputImeSetCandidatesFunction() {} | 133 virtual ~InputImeSetCandidatesFunction() {} |
| 134 | 134 |
| 135 // ExtensionFunction: | 135 // ExtensionFunction: |
| 136 virtual bool RunImpl() OVERRIDE; | 136 virtual bool RunSync() OVERRIDE; |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 class InputImeSetCursorPositionFunction : public SyncExtensionFunction { | 139 class InputImeSetCursorPositionFunction : public SyncExtensionFunction { |
| 140 public: | 140 public: |
| 141 DECLARE_EXTENSION_FUNCTION("input.ime.setCursorPosition", | 141 DECLARE_EXTENSION_FUNCTION("input.ime.setCursorPosition", |
| 142 INPUT_IME_SETCURSORPOSITION) | 142 INPUT_IME_SETCURSORPOSITION) |
| 143 | 143 |
| 144 protected: | 144 protected: |
| 145 virtual ~InputImeSetCursorPositionFunction() {} | 145 virtual ~InputImeSetCursorPositionFunction() {} |
| 146 | 146 |
| 147 // ExtensionFunction: | 147 // ExtensionFunction: |
| 148 virtual bool RunImpl() OVERRIDE; | 148 virtual bool RunSync() OVERRIDE; |
| 149 }; | 149 }; |
| 150 | 150 |
| 151 class InputImeSetMenuItemsFunction : public SyncExtensionFunction { | 151 class InputImeSetMenuItemsFunction : public SyncExtensionFunction { |
| 152 public: | 152 public: |
| 153 DECLARE_EXTENSION_FUNCTION("input.ime.setMenuItems", INPUT_IME_SETMENUITEMS) | 153 DECLARE_EXTENSION_FUNCTION("input.ime.setMenuItems", INPUT_IME_SETMENUITEMS) |
| 154 | 154 |
| 155 protected: | 155 protected: |
| 156 virtual ~InputImeSetMenuItemsFunction() {} | 156 virtual ~InputImeSetMenuItemsFunction() {} |
| 157 | 157 |
| 158 // ExtensionFunction: | 158 // ExtensionFunction: |
| 159 virtual bool RunImpl() OVERRIDE; | 159 virtual bool RunSync() OVERRIDE; |
| 160 }; | 160 }; |
| 161 | 161 |
| 162 class InputImeUpdateMenuItemsFunction : public SyncExtensionFunction { | 162 class InputImeUpdateMenuItemsFunction : public SyncExtensionFunction { |
| 163 public: | 163 public: |
| 164 DECLARE_EXTENSION_FUNCTION("input.ime.updateMenuItems", | 164 DECLARE_EXTENSION_FUNCTION("input.ime.updateMenuItems", |
| 165 INPUT_IME_UPDATEMENUITEMS) | 165 INPUT_IME_UPDATEMENUITEMS) |
| 166 | 166 |
| 167 protected: | 167 protected: |
| 168 virtual ~InputImeUpdateMenuItemsFunction() {} | 168 virtual ~InputImeUpdateMenuItemsFunction() {} |
| 169 | 169 |
| 170 // ExtensionFunction: | 170 // ExtensionFunction: |
| 171 virtual bool RunImpl() OVERRIDE; | 171 virtual bool RunSync() OVERRIDE; |
| 172 }; | 172 }; |
| 173 | 173 |
| 174 class InputImeDeleteSurroundingTextFunction : public SyncExtensionFunction { | 174 class InputImeDeleteSurroundingTextFunction : public SyncExtensionFunction { |
| 175 public: | 175 public: |
| 176 DECLARE_EXTENSION_FUNCTION("input.ime.deleteSurroundingText", | 176 DECLARE_EXTENSION_FUNCTION("input.ime.deleteSurroundingText", |
| 177 INPUT_IME_DELETESURROUNDINGTEXT) | 177 INPUT_IME_DELETESURROUNDINGTEXT) |
| 178 protected: | 178 protected: |
| 179 virtual ~InputImeDeleteSurroundingTextFunction() {} | 179 virtual ~InputImeDeleteSurroundingTextFunction() {} |
| 180 | 180 |
| 181 // ExtensionFunction: | 181 // ExtensionFunction: |
| 182 virtual bool RunImpl() OVERRIDE; | 182 virtual bool RunSync() OVERRIDE; |
| 183 }; | 183 }; |
| 184 | 184 |
| 185 class InputImeKeyEventHandledFunction : public AsyncExtensionFunction { | 185 class InputImeKeyEventHandledFunction : public AsyncExtensionFunction { |
| 186 public: | 186 public: |
| 187 DECLARE_EXTENSION_FUNCTION("input.ime.keyEventHandled", | 187 DECLARE_EXTENSION_FUNCTION("input.ime.keyEventHandled", |
| 188 INPUT_IME_KEYEVENTHANDLED) | 188 INPUT_IME_KEYEVENTHANDLED) |
| 189 | 189 |
| 190 protected: | 190 protected: |
| 191 virtual ~InputImeKeyEventHandledFunction() {} | 191 virtual ~InputImeKeyEventHandledFunction() {} |
| 192 | 192 |
| 193 // ExtensionFunction: | 193 // ExtensionFunction: |
| 194 virtual bool RunImpl() OVERRIDE; | 194 virtual bool RunSync() OVERRIDE; |
| 195 }; | 195 }; |
| 196 | 196 |
| 197 class InputImeSendKeyEventsFunction : public AsyncExtensionFunction { | 197 class InputImeSendKeyEventsFunction : public AsyncExtensionFunction { |
| 198 public: | 198 public: |
| 199 DECLARE_EXTENSION_FUNCTION("input.ime.sendKeyEvents", | 199 DECLARE_EXTENSION_FUNCTION("input.ime.sendKeyEvents", |
| 200 INPUT_IME_SENDKEYEVENTS) | 200 INPUT_IME_SENDKEYEVENTS) |
| 201 | 201 |
| 202 protected: | 202 protected: |
| 203 virtual ~InputImeSendKeyEventsFunction() {} | 203 virtual ~InputImeSendKeyEventsFunction() {} |
| 204 | 204 |
| 205 // ExtensionFunction: | 205 // ExtensionFunction: |
| 206 virtual bool RunImpl() OVERRIDE; | 206 virtual bool RunSync() OVERRIDE; |
| 207 }; | 207 }; |
| 208 | 208 |
| 209 class InputImeHideInputViewFunction : public AsyncExtensionFunction { | 209 class InputImeHideInputViewFunction : public AsyncExtensionFunction { |
| 210 public: | 210 public: |
| 211 DECLARE_EXTENSION_FUNCTION("input.ime.hideInputView", | 211 DECLARE_EXTENSION_FUNCTION("input.ime.hideInputView", |
| 212 INPUT_IME_HIDEINPUTVIEW) | 212 INPUT_IME_HIDEINPUTVIEW) |
| 213 | 213 |
| 214 protected: | 214 protected: |
| 215 virtual ~InputImeHideInputViewFunction() {} | 215 virtual ~InputImeHideInputViewFunction() {} |
| 216 | 216 |
| 217 // ExtensionFunction: | 217 // ExtensionFunction: |
| 218 virtual bool RunImpl() OVERRIDE; | 218 virtual bool RunSync() OVERRIDE; |
| 219 }; | 219 }; |
| 220 | 220 |
| 221 class InputImeAPI : public BrowserContextKeyedAPI, | 221 class InputImeAPI : public BrowserContextKeyedAPI, |
| 222 public content::NotificationObserver, | 222 public content::NotificationObserver, |
| 223 public EventRouter::Observer { | 223 public EventRouter::Observer { |
| 224 public: | 224 public: |
| 225 explicit InputImeAPI(content::BrowserContext* context); | 225 explicit InputImeAPI(content::BrowserContext* context); |
| 226 virtual ~InputImeAPI(); | 226 virtual ~InputImeAPI(); |
| 227 | 227 |
| 228 // BrowserContextKeyedAPI implementation. | 228 // BrowserContextKeyedAPI implementation. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 246 } | 246 } |
| 247 static const bool kServiceIsNULLWhileTesting = true; | 247 static const bool kServiceIsNULLWhileTesting = true; |
| 248 | 248 |
| 249 Profile* const profile_; | 249 Profile* const profile_; |
| 250 content::NotificationRegistrar registrar_; | 250 content::NotificationRegistrar registrar_; |
| 251 }; | 251 }; |
| 252 | 252 |
| 253 } // namespace extensions | 253 } // namespace extensions |
| 254 | 254 |
| 255 #endif // CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_H_ | 255 #endif // CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_H_ |
| OLD | NEW |