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

module ash.mojom;

// Describes whether media is currently being captured.
enum MediaCaptureState {
  NONE = 0,
  AUDIO = 1,
  VIDEO = 2,
  AUDIO_VIDEO = 3
};

// Allows clients (e.g. Chrome browser) to interface with the ash media
// indicators.
interface MediaController {
  // Sets the client interface.
  SetClient(associated MediaClient client);

  // Called when the media capture state changes on the client, or in response
  // to a RequestCaptureState() request. Returns an array of MediaCaptureState
  // by index of the shell content. (These indexes are unstable, but are
  // unlikely to change in practice, see comments in chrome's MediaClient::
  // RequestCaptureState()).
  NotifyCaptureState(array<MediaCaptureState> state);
};

// This delegate allows the UI code in ash to forward UI commands.
interface MediaClient {
  // Handles the Next Track Media shortcut key.
  HandleMediaNextTrack();

  // Handles the Play/Pause Toggle Media shortcut key.
  HandleMediaPlayPause();

  // Handles the Previous Track Media shortcut key.
  HandleMediaPrevTrack();

  // Requests that the client resends the NotifyMediaCaptureChanged() message.
  RequestCaptureState();

  // Suspends all WebContents-associated media sessions to stop managed players.
  SuspendMediaSessions();
};