1// Copyright 2018 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 5module ax.mojom; 6 7import "mojo/public/mojom/base/string16.mojom"; 8import "ui/gfx/geometry/mojom/geometry.mojom"; 9import "ui/gfx/range/mojom/range.mojom"; 10import "url/mojom/url.mojom"; 11 12// Tree structure for assistant. The tree is represented as a flat array of 13// nodes, each containing a children_indices vector that points to its child 14// nodes. The purpose is to work around max depth restriction of recursive 15// data structure in mojo. 16struct AssistantTree { 17 array<AssistantNode> nodes; 18}; 19 20// Represents view structure to be passed to assistant. The view structure is 21// synthesized from the AXNode. 22struct AssistantNode { 23 array<int32> children_indices; 24 25 // Geometry of the view in pixels 26 gfx.mojom.Rect rect; 27 28 // Text of the view. 29 mojo_base.mojom.String16 text; 30 31 // Text properties 32 float text_size; 33 uint32 color; 34 uint32 bgcolor; 35 bool bold; 36 bool italic; 37 bool underline; 38 bool line_through; 39 40 // Selected portion of the text. 41 gfx.mojom.Range? selection; 42 43 // Fake Android view class name of the element. Each node is assigned 44 // a closest approximation of Android's views to keep the server happy. 45 string class_name; 46 47 // Accessibility functionality of the node inferred from DOM or based on HTML 48 // role attribute. 49 string? role; 50}; 51 52// Additional information to current context. 53struct AssistantExtra { 54 url.mojom.Url url; 55 gfx.mojom.Rect bounds_pixel; 56 mojo_base.mojom.String16 title; 57}; 58 59// Assistant structure, including Assistant tree and extra. 60struct AssistantStructure { 61 AssistantTree? assistant_tree; 62 AssistantExtra? assistant_extra; 63}; 64