summaryrefslogtreecommitdiff
path: root/chromium/chrome/common/accessibility/read_anything.mojom
blob: edc974fd325877a1e093e6d72d120e7f5a51db94 (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
// Copyright 2021 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.

// A module for a prototype of the Read Anything feature.
module read_anything.mojom;

import "skia/public/mojom/skcolor.mojom";
import "ui/accessibility/mojom/ax_tree_update.mojom";

// Used to represent the current user choices for the Read Anything visual
// presentation/theme. This includes font name, size, spacing, and colors.
struct ReadAnythingTheme {
  // The name of the user's font choice.
  string font_name;

  // The px value of the user's font size.
  float font_size;

  // The various colors of the user's chosen theme.
  skia.mojom.SkColor foreground_color;
  skia.mojom.SkColor background_color;
};

// Used by the WebUI page to bootstrap bidirectional communication.
interface PageHandlerFactory {
  // The WebUI calls this method when the page is first initialized.
  CreatePageHandler(pending_remote<Page> page,
                    pending_receiver<PageHandler> handler);
};

// Used as identifiers for the Read Anything theme options.
// Next value: 4
[Extensible, Stable, Uuid="03f38cfc-a34f-460a-a0a7-faf711f11a64"]
enum Colors {
  [Default]kDefault = 0,
  kLight = 1,
  kDark = 2,
  kYellow = 3,
};

// Browser-side handler for requests from WebUI page.
interface PageHandler {
  // TODO(crbug.com/1266555): Fill in with messages once Select to Read Anything
  // is implemented.
};

// WebUI-side handler for requests from the browser.
interface Page {
  // Trigger the frontend to update the current read anything display. Snapshot
  // is an accessibility tree snapshot of a web page. Content node ids are node
  // ids from that ax tree update, where each node is part of the main article
  // for that web page.
  OnAXTreeDistilled(ax.mojom.AXTreeUpdate snapshot,
                    array<int32> content_node_ids);

  // Send an updated theme to front end.
  OnThemeChanged(ReadAnythingTheme new_theme);
};