blob: 454529e27482a9f61936a810933d071a43c66d32 [file] [log] [blame]
ekaramad9053e57b2016-04-26 20:00:381// 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 Hanada1b19cf852019-01-18 16:12:268#include "base/strings/string16.h"
ekaramad9053e57b2016-04-26 20:00:389#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
13namespace 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).
18struct 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 Hanada1b19cf852019-01-18 16:12:2632 base::string16 value;
ekaramad9053e57b2016-04-26 20:00:3833
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
changwan75e3b2072017-01-16 02:55:0056 // Whether or not this is a reply to a request from IME.
57 bool reply_to_request;
ekaramad9053e57b2016-04-26 20:00:3858};
59
60} // namespace content
61
62#endif // CONTENT_COMMON_TEXT_INPUT_STATE_H_