chromium/components/history_clusters/history_clusters_internals/webui/history_clusters_internals.mojom

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


module history_clusters_internals.mojom;

// 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> page_handler);
};

// Browser-side handler for requests from WebUI page.
interface PageHandler {
  // Requests for the context clusters to be serialized to JSON.
  // Will invoke callback when JSON string is ready.
  GetContextClustersJson() => (string context_clusters_json);

  // Requests that the HistoryClustersService prints the keyword bag state to
  // the log messages. These log messages will be sent to the page via
  // `OnLogMessageAdded()`.
  PrintKeywordBagStateToLogMessages();
};

// Renderer-side handler for internal page to process the updates from
// the History Clusters service.
interface Page {
  // Notifies the page of a log event from the History Clusters service.
  OnLogMessageAdded(string message);
};