// 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 ash.boca.mojom;
import "url/mojom/url.mojom";
import "mojo/public/mojom/base/time.mojom";
// Refer ///depot/google3/google/internal/chrome/cros/edu/schooltools/v1/
// For detailed type definition.
// TODO(b/356405813): Refactor documentation.
// Represents the tab information within browser window.
struct TabInfo {
// Tab title.
string title;
// Tab URL.
url.mojom.Url url;
//Tab favicon in the format of data url.
string favicon;
};
// Represents user identity.
struct Identity {
// User id.
string id;
// User name.
string name;
// User email address.
string email;
};
// Represents a course.
struct Course {
// Course id.
string id;
// Course name.
string name;
};
// Represents a browser window.
struct Window {
// User-customized window name.
string? name;
// Tabs within browser window. Tabs are ordererd using non-increasing order
// for tab's last access
// timestamp
array<TabInfo> tab_list;
};
struct Config{
mojo_base.mojom.TimeDelta session_duration;
// Selected students to be joined for session.
array<Identity> students;
OnTaskConfig on_task_config;
CaptionConfig caption_config;
};
struct CaptionConfig {
// If caption is enabled.
bool caption_enabled;
// If the caption will be persisted to local only.
bool local_only;
// If transcription is enabled.
bool transcription_enabled;
};
enum NavigationType {
kUnknown = 0,
kOpen ,
kBlock,
kDomain,
kLimited,
};
struct ControlledTab {
TabInfo tab;
NavigationType navigation_type;
};
struct OnTaskConfig {
// If content will be display on students' device in lock mode.
bool is_locked;
array<ControlledTab> tabs;
};
// Implemented by browser process for page chrome-untrusted://boca-app/
interface PageHandler {
// Fetches a list of browser windows and tabs in it. Windows are ordered using
// non-increasing order for most recent tab's last
// access timestamp
GetWindowsTabsList() => (array<Window> window_list);
// Fetch a list of courses for the current teacher.
ListCourses() => (array<Course> courses);
// Requested by the Boca SWA to fetch a list of students for a given
// course. Must be called on a course_id received from the most recent
// ListCourses call.
ListStudents(string course_id) => (array<Identity> students);
// Create a session with `config`.
CreateSession(Config config) => (bool success);
};
// Implemented by renderer process
interface Page {};
// Implemented in browser process to set up the communication between the Page
// and PageHandler
interface BocaPageHandlerFactory {
// Set up the communication between browser process and renderer process.
Create(pending_receiver<PageHandler> handler, pending_remote<Page> page);
};