ekaramad | 9053e57b | 2016-04-26 20:00:38 | [diff] [blame] | 1 | // Copyright 2016 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 CONTENT_COMMON_TEXT_INPUT_STATE_H_ |
| 6 | #define CONTENT_COMMON_TEXT_INPUT_STATE_H_ |
| 7 | |
Yuichiro Hanada | 1b19cf85 | 2019-01-18 16:12:26 | [diff] [blame] | 8 | #include "base/strings/string16.h" |
ekaramad | 9053e57b | 2016-04-26 20:00:38 | [diff] [blame] | 9 | #include "content/common/content_export.h" |
| 10 | #include "ui/base/ime/text_input_mode.h" |
| 11 | #include "ui/base/ime/text_input_type.h" |
| 12 | |
| 13 | namespace content { |
| 14 | |
| 15 | // The text input state information for handling IME on the browser side. The |
| 16 | // text input state information such as type, mode, etc. are used by the input |
| 17 | // method to handle IME (the usage is specific to each platform). |
| 18 | struct CONTENT_EXPORT TextInputState { |
| 19 | TextInputState(); |
| 20 | TextInputState(const TextInputState& other); |
| 21 | |
| 22 | // Type of the input field. |
| 23 | ui::TextInputType type; |
| 24 | |
| 25 | // The mode of input field. |
| 26 | ui::TextInputMode mode; |
| 27 | |
| 28 | // The flags of input field (autocorrect, autocomplete, etc.) |
| 29 | int flags; |
| 30 | |
| 31 | // The value of input field. |
Yuichiro Hanada | 1b19cf85 | 2019-01-18 16:12:26 | [diff] [blame] | 32 | base::string16 value; |
ekaramad | 9053e57b | 2016-04-26 20:00:38 | [diff] [blame] | 33 | |
| 34 | // The cursor position of the current selection start, or the caret position |
| 35 | // if nothing is selected. |
| 36 | int selection_start; |
| 37 | |
| 38 | // The cursor position of the current selection end, or the caret position if |
| 39 | // nothing is selected. |
| 40 | int selection_end; |
| 41 | |
| 42 | // The start position of the current composition, or -1 if there is none. |
| 43 | int composition_start; |
| 44 | |
| 45 | // The end position of the current composition, or -1 if there is none. |
| 46 | int composition_end; |
| 47 | |
| 48 | // Whether or not inline composition can be performed for the current input. |
| 49 | bool can_compose_inline; |
| 50 | |
| 51 | // Whether or not the IME should be shown as a result of this update. Even if |
| 52 | // true, the IME will only be shown if the input is appropriate (e.g. not |
| 53 | // TEXT_INPUT_TYPE_NONE). |
| 54 | bool show_ime_if_needed; |
| 55 | |
changwan | 75e3b207 | 2017-01-16 02:55:00 | [diff] [blame] | 56 | // Whether or not this is a reply to a request from IME. |
| 57 | bool reply_to_request; |
ekaramad | 9053e57b | 2016-04-26 20:00:38 | [diff] [blame] | 58 | }; |
| 59 | |
| 60 | } // namespace content |
| 61 | |
| 62 | #endif // CONTENT_COMMON_TEXT_INPUT_STATE_H_ |