// Copyright 2025 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module contextual_tasks_internals.mojom;
import "chrome/browser/contextual_tasks/contextual_tasks_types.mojom";
import "mojo/public/mojom/base/time.mojom";
import "url/mojom/url.mojom";
struct GetRelevantContextRequest {
// The query to get relevant context for.
string query;
// The mode to use for tab selection.
contextual_tasks.mojom.TabSelectionMode tab_selection_mode;
// The minimum model score to use for tab selection. Must be a value between 0
// and 1, inclusive.
float min_model_score;
};
// Represents the tab.
struct Tab {
// Tab title.
string title;
// Tab URL.
url.mojom.Url url;
};
struct GetRelevantContextResponse {
// The list of open tabs that are relevant to the query.
array<Tab> relevant_tabs;
};
// Lives in the browser process. A renderer uses this to link itself with
// a page handler.
interface ContextualTasksInternalsPageHandlerFactory {
// Create a page handler and link it to the UI.
CreatePageHandler(
pending_remote<ContextualTasksInternalsPage> page,
pending_receiver<ContextualTasksInternalsPageHandler> handler);
};
// PageHandler for ContextualTasksInternals page.
interface ContextualTasksInternalsPageHandler {
// Returns the relevant context for the given request.
GetRelevantContext(GetRelevantContextRequest request) =>
(GetRelevantContextResponse response);
};
// Renderer-side handler for internals WebUI page to process the updates from
// the service.
interface ContextualTasksInternalsPage {
// Notifies the page of a contextual tasks context log event from the
// Optimization Guide service.
OnLogMessageAdded(mojo_base.mojom.Time event_time,
string source_file,
int64 source_line,
string message);
};