chromium/chrome/browser/ui/webui/ash/settings/pages/date_time/mojom/date_time_handler.mojom

// 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.settings.date_time.mojom;

// Lives in the browser process. A renderer uses this to create a page handler
// that enables communication between a renderer and the browser process.
interface PageHandlerFactory {
  // Creates a PageHandler and connects it up to the Page.
  CreatePageHandler(pending_remote<Page> page,
                    pending_receiver<PageHandler> handler);
};

// Lives in the browser process. A renderer uses this to invoke methods that
// are implemented in the browser process.
interface PageHandler {
  // Starts parent access validation for child account. Result will get sent
  // via the `Page` method exposed below `OnParentAccessValidationComplete` to
  // indicate whether or not the child account is allowed to modify date and
  // time settings.
  ShowParentAccessForTimezone();

  // Emits a GetTimeZones request and returns a list of timezones. The inner
  // list contains values (timezone ID and timezone name) per timezone.
  GetTimezones() => (array<array<string, 2>> timezones);

  // Opens the set date and time ui.
  ShowSetDateTimeUI();
};

// Interface for the OneDrive settings. Implemented in Javascript and
// used by the page handler to send asynchronous updates.
interface Page {
  // Invoked whenever system clock can set time is updated, indicating whether
  // the system time can be set.
  OnSystemClockCanSetTimeChanged(bool is_allowed);

  // Invoked when parent access validation is completed.
  OnParentAccessValidationComplete(bool success);
};