summaryrefslogtreecommitdiffstats
path: root/components/arc/common/ime.mojom
blob: e1b314e06dfcd302d240bbc67418ea5c80dff9df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module arc;

// Represents the type of text input field currently focused.
[Extensible=True]
enum TextInputType {
  NONE,
  TEXT,
  PASSWORD,
  SEARCH,
  EMAIL,
  NUMBER,
  TELEPHONE,
  URL,
  DATE,
  TIME,
  DATETIME,
};

// Represents the text insertion points in the container screen coordinates.
struct CursorRect {
  int32 left;
  int32 top;
  int32 right;
  int32 bottom;
};

// Represents a single segment of text currently composed by IME.
struct CompositionSegment {
  // Start offset of the segment in UTF-16 index.
  uint32 start_offset;
  // End offset of the segment in UTF-16 index.
  uint32 end_offset;
  // Indicates that this segment should be emphasized.
  bool emphasized;
};

interface ImeHost {
  // Notifies Chrome that the text input focus is changed.
  OnTextInputTypeChanged(TextInputType type);

  // Notifies Chrome that the cursor poisition has changed.
  OnCursorRectChanged(CursorRect rect);
};

interface ImeInstance {
  Init(ImeHost host_ptr);

  // Sets composition text and attributes requested by the host IME.
  SetCompositionText(string text, array<CompositionSegment> segments);

  // Commits the last set composition text and clears the composition.
  ConfirmCompositionText();

  // Commits the specified text and clears the composition.
  InsertText(string text);
};