chromium/chromecast/ui/mojom/display_settings.mojom

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

module chromecast.mojom;

import "mojo/public/mojom/base/time.mojom";

// Interface for controlling device display settings. Each setting can be reset
// to its default value via Reset<setting>() methods.
// This interface is hosted in the browser process.
interface DisplaySettings {
  // Sets display temperature value.
  SetColorTemperature(float kelvin);
  // Same as above, but temperature will be changed smoothly over a duration.
  SetColorTemperatureSmooth(float kelvin, mojo_base.mojom.TimeDelta duration);
  // Resets the display temperature value to the neutral value.
  ResetColorTemperature();

  // Sets display brightness from 0.0 to 1.0. The interpretation of this value
  // is up to the platform implementation.
  SetBrightness(float brightness);
  // Same as above, but if the second argument is set, brightness will be
  // changed smoothly over a duration.
  SetBrightnessSmooth(float brightness, mojo_base.mojom.TimeDelta duration);
  // Resets display brightness to the default value.
  ResetBrightness();

  // Sets whether screen should be on. If set to false, then screen will always
  // be off and other settings will not be applied.
  SetScreenOn(bool display_on);

  // Sets whether the screen should power off when SetScreenOn(false) is called.
  SetAllowScreenPowerOff(bool allow_power_off);

  // Adds an observer to DisplaySettings.
  AddDisplaySettingsObserver(pending_remote<DisplaySettingsObserver> observer);
};

// Observer for display settings changes.
interface DisplaySettingsObserver {
  // Receive a new display brightness.
  OnDisplayBrightnessChanged(float brightness);
};