// Copyright 2012 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef UI_BASE_IME_INPUT_METHOD_H_ #define UI_BASE_IME_INPUT_METHOD_H_ #include <stdint.h> #include "build/build_config.h" #include "ui/base/ime/text_input_mode.h" #include "ui/base/ime/text_input_type.h" #include "ui/base/ime/virtual_keyboard_controller.h" #include "ui/events/event_dispatcher.h" #include "ui/events/platform_event.h" #include "ui/gfx/geometry/rect.h" namespace ui { class VirtualKeyboardController; class InputMethodObserver; class KeyEvent; class ImeKeyEventDispatcher; class TextInputClient; // An interface implemented by an object that encapsulates a native input method // service provided by the underlying operating system, and acts as a "system // wide" input method for all Chrome windows. A class that implements this // interface should behave as follows: // - Receives a keyboard event directly from a message dispatcher for the // system through the InputMethod::DispatchKeyEvent API, and forwards it to // an underlying input method for the OS. // - The input method should handle the key event either of the following ways: // 1) Send the original key down event to the focused window, which is e.g. // a NativeWidgetAura (NWA) or a RenderWidgetHostViewAura (RWHVA), using // ImeKeyEventDispatcher API, then send a Char event using // TextInputClient::InsertChar API to a text input client, which is, again, // e.g. NWA or RWHVA, and then send the original key up event to the same // window. // 2) Send VKEY_PROCESSKEY event to the window using the DispatchKeyEvent API, // then update IME status (e.g. composition text) using TextInputClient, // and then send the original key up event to the window. // - Keeps track of the focused TextInputClient to see which client can call // APIs, OnTextInputTypeChanged, OnCaretBoundsChanged, and CancelComposition, // that change the state of the input method. // In Aura environment, aura::WindowTreeHost creates an instance of // ui::InputMethod and owns it. class InputMethod { … }; } // namespace ui #endif // UI_BASE_IME_INPUT_METHOD_H_