// 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. // Next MinVersion: 6 module arc.mojom; import "screen_rect.mojom"; // Represents the type of text input field currently focused. [Extensible] enum TextInputType { NONE, TEXT, PASSWORD, SEARCH, EMAIL, NUMBER, TELEPHONE, URL, DATE, TIME, DATETIME, }; // TODO(yhanada): Switch to use gfx.mojom.Rect. See crbug.com/723224. // Represents the text insertion points in the container screen coordinates. struct CursorRect { int32 left; int32 top; int32 right; int32 bottom; }; // TODO(yhanada): Switch to use gfx.mojom.Range. See crbug.com/723224. // Represents the range in the text. It is an open interval [start, end). [MinVersion=5] struct TextRange { // Start offset in UTF-16 index. uint32 start; // End offset in UTF-16 index. uint32 end; }; // 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; }; // Next method ID: 4 interface ImeHost { // Notifies Chrome that the text input focus is changed. OnTextInputTypeChanged@0(TextInputType type); // Notifies Chrome that the cursor poisition has changed. OnCursorRectChanged@1(CursorRect rect); // Notifies Chrome that the current composition is canceled. [MinVersion=1] OnCancelComposition@2(); // Show virtual keyboard of Chrome OS if needed. [MinVersion=2] ShowImeIfNeeded@3(); // Notifies Chrome that the cursor position has changed and // also sends surrounding text. // // |text_range|, |text_in_range| and |selection_range| are piggy-backed // into this method because Chrome OS IME tries to retrieve these information // synchronously, so we need to update them all at once to keep consistency. [MinVersion=5] OnCursorRectChangedWithSurroundingText@4( CursorRect rect, // The cursor position. TextRange text_range, // The range of |text_in_range| in the current // text in the editor. string text_in_range, // The text around the cursor. TextRange selection_range // The range of the selected text // in the current text in the editor. ); }; // Next method ID: 6 interface ImeInstance { Init@0(ImeHost host_ptr); // Sets composition text and attributes requested by the host IME. SetCompositionText@1(string text, array segments); // Commits the last set composition text and clears the composition. ConfirmCompositionText@2(); // Commits the specified text and clears the composition. InsertText@3(string text); // Informs the virtual keyboard bounds on screen is changing. // |new_bounds| Represents a ChromeOS virtual keyboard bounds in ChromeOS // screen coordinate, physical pixel as a unit. // When all members are zero value, virtual keyboard is being hidden. [MinVersion=3] OnKeyboardBoundsChanging@4(ScreenRect new_bounds); // Deletes current selection plus the specified number of char16 values // before and after selection or caret. [MinVersion=4] ExtendSelectionAndDelete@5(uint64 before, uint64 after); };