910e62b5创建于 1月15日历史提交
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module crosapi.mojom;

import "mojo/public/mojom/base/string16.mojom";
import "mojo/public/mojom/base/unguessable_token.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";
import "ui/gfx/image/mojom/image.mojom";
import "url/mojom/url.mojom";


struct MahiPageInfo {
  // Id for the delegate to distinguish between different clients.
  mojo_base.mojom.UnguessableToken client_id@0;

  // The id represents a unique identifier for the page.
  mojo_base.mojom.UnguessableToken page_id@1;

  // Url of the web page.
  url.mojom.Url url@2;

  // The title of the page. It is UTF-16 encoded.
  mojo_base.mojom.String16 title@3;

  // The favicon of the page. Null if there is no valid favicon.
  gfx.mojom.ImageSkia? favicon_image@4;

  // Repersents if the web page is distillalbe.
  // Null if the distillablity has not been checked yet.
  bool? IsDistillable@5;

  // Represents if the page is from a incognito window.
  [MinVersion=1]
  bool is_incognito@6;
};

[Extensible]
enum MahiContextMenuActionType {
  [Default] kNone,
  kSummary,
  kOutline,
  kSettings,
  kQA,
  kElucidation,
  kSummaryOfSelection,
};

// The struct of the mahi context menu request from the browser.
struct MahiContextMenuRequest {
  // Unique identifier associated with the display.
  // -1 means invalid display.
  int64 display_id@0;

  // The triggered action in the context menu.
  MahiContextMenuActionType action_type@1;

  // The input question from the user.
  // Only present if the context menu action is `kQA`.
  mojo_base.mojom.String16? question@2;

  // The bounds for the mahi context menu view.
  // Used to place the mahi panel in the same position.
  [MinVersion=1]
  gfx.mojom.Rect? mahi_menu_bounds@3;
};

// Struct containing the id and the content for the requested page.
struct MahiPageContent {
  // Id for the delegate to distinguish between different clients.
  mojo_base.mojom.UnguessableToken client_id@0;

  // Unique id corresponding to a page.
  mojo_base.mojom.UnguessableToken page_id@1;

  // The extracted content of the page.
  mojo_base.mojom.String16 page_content@2;
};