| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef UI_BASE_IME_IME_ENGINE_OBSERVER_H_ | |
| 6 #define UI_BASE_IME_IME_ENGINE_OBSERVER_H_ | |
| 7 | |
| 8 #include "build/build_config.h" | |
| 9 #include "ui/base/ime/ime_engine_handler_interface.h" | |
| 10 | |
| 11 namespace ui { | |
| 12 | |
| 13 class IMEEngineObserver { | |
| 14 public: | |
| 15 virtual ~IMEEngineObserver() {} | |
| 16 | |
| 17 // Called when the IME becomes the active IME. | |
| 18 virtual void OnActivate(const std::string& engine_id) = 0; | |
| 19 | |
| 20 // Called when a text field gains focus, and will be sending key events. | |
| 21 virtual void OnFocus( | |
| 22 const IMEEngineHandlerInterface::InputContext& context) = 0; | |
| 23 | |
| 24 // Called when a text field loses focus, and will no longer generate events. | |
| 25 virtual void OnBlur(int context_id) = 0; | |
| 26 | |
| 27 // Called when the user pressed a key with a text field focused. | |
| 28 virtual void OnKeyEvent( | |
| 29 const std::string& engine_id, | |
| 30 const IMEEngineHandlerInterface::KeyboardEvent& event, | |
| 31 IMEEngineHandlerInterface::KeyEventDoneCallback& key_data) = 0; | |
| 32 | |
| 33 // Called when Chrome terminates on-going text input session. | |
| 34 virtual void OnReset(const std::string& engine_id) = 0; | |
| 35 | |
| 36 // Called when the IME is no longer active. | |
| 37 virtual void OnDeactivated(const std::string& engine_id) = 0; | |
| 38 | |
| 39 // Called when composition bounds are changed. | |
| 40 virtual void OnCompositionBoundsChanged( | |
| 41 const std::vector<gfx::Rect>& bounds) = 0; | |
| 42 | |
| 43 // Returns whether the observer is interested in key events. | |
| 44 virtual bool IsInterestedInKeyEvent() const = 0; | |
| 45 | |
| 46 // Called when a surrounding text is changed. | |
| 47 virtual void OnSurroundingTextChanged(const std::string& engine_id, | |
| 48 const std::string& text, | |
| 49 int cursor_pos, | |
| 50 int anchor_pos, | |
| 51 int offset_pos) = 0; | |
| 52 | |
| 53 // ChromeOS only APIs. | |
| 54 #if defined(OS_CHROMEOS) | |
| 55 | |
| 56 enum MouseButtonEvent { | |
| 57 MOUSE_BUTTON_LEFT, | |
| 58 MOUSE_BUTTON_RIGHT, | |
| 59 MOUSE_BUTTON_MIDDLE, | |
| 60 }; | |
| 61 | |
| 62 // Called when an InputContext's properties change while it is focused. | |
| 63 virtual void OnInputContextUpdate( | |
| 64 const IMEEngineHandlerInterface::InputContext& context) = 0; | |
| 65 | |
| 66 | |
| 67 | |
| 68 // Called when the user clicks on an item in the candidate list. | |
| 69 virtual void OnCandidateClicked(const std::string& engine_id, | |
| 70 int candidate_id, | |
| 71 MouseButtonEvent button) = 0; | |
| 72 | |
| 73 // Called when a menu item for this IME is interacted with. | |
| 74 virtual void OnMenuItemActivated(const std::string& engine_id, | |
| 75 const std::string& menu_id) = 0; | |
| 76 #endif | |
| 77 }; | |
| 78 | |
| 79 } // namespace ui | |
| 80 | |
| 81 #endif // UI_BASE_IME_IME_ENGINE_OBSERVER_H_ | |
| OLD | NEW |