chromium/chrome/browser/ui/webui/search_engine_choice/search_engine_choice.mojom

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module search_engine_choice.mojom;

// Lives in the browser process. A renderer uses this to link itself with
// a page handler.
interface PageHandlerFactory {
  // Creates a page handler for the file manager and link it to the UI.
  CreatePageHandler(pending_receiver<PageHandler> handler);
};

// Browser-side handler for requests from WebUI page.
interface PageHandler {
  // These values are persisted to logs and should not be renumbered or
  // re-used.
  // LINT.IfChange(ScrollState)
  enum ScrollState {
    kAtTheBottom = 0,
    kAtTheBottomWithErrorMargin = 1,
    kNotAtTheBottom = 2,
  };
// LINT.ThenChange(/tools/metrics/histograms/enums.xml:SearchEngineChoiceScrollState)

  // Displays the Search Engine Choice dialog.
  // Triggered by the `displayDialog()` call in
  // `chrome/browser/resources/search_engine_choice/app.ts`
  DisplayDialog();

  // Changes the search engine based on the user's choice.
  // Triggered by the `handleSearchEngineChoiceSelected()` call in
  // `chrome/browser/resources/search_engine_choice/app.ts`
  HandleSearchEngineChoiceSelected(int32 prepopulate_id);

  // Notifies the `SearchEngineChoiceDialogService` that the learn more link was
  // clicked.
  HandleLearnMoreLinkClicked();

  // Notifies the `SearchEngineChoiceDialogService` that the "More" button was
  // clicked.
  HandleMoreButtonClicked();

  // Records the scroll state after the "More" button was clicked.
  RecordScrollState(ScrollState scroll_state);
};