1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43

content / public / renderer / render_frame_media_playback_options.h [blame]

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

#ifndef CONTENT_PUBLIC_RENDERER_RENDER_FRAME_MEDIA_PLAYBACK_OPTIONS_H_
#define CONTENT_PUBLIC_RENDERER_RENDER_FRAME_MEDIA_PLAYBACK_OPTIONS_H_

#include "content/common/content_export.h"
#include "content/public/common/media_playback_renderer_type.mojom.h"

namespace content {

// Default value for is_background_suspend_enabled is determined statically in
// Chromium, but some content embedders (e.g. Cast) may need to change it at
// runtime.
CONTENT_EXPORT extern const bool kIsBackgroundMediaSuspendEnabled;

struct RenderFrameMediaPlaybackOptions {
  // Whether the renderer should automatically suspend media playback on
  // background tabs for given |render_frame|.
  bool is_background_suspend_enabled = kIsBackgroundMediaSuspendEnabled;

  // Whether background video is allowed to play for given |render_frame|.
  bool is_background_video_playback_enabled = true;

  // Whether background video optimization is supported on current platform.
  bool is_background_video_track_optimization_supported = true;

  // Which renderer should be used in this media playback.
  mojom::RendererType renderer_type = mojom::RendererType::DEFAULT_RENDERER;

  bool is_mojo_renderer_enabled() const {
    return renderer_type == mojom::RendererType::MOJO_RENDERER;
  }

  bool is_remoting_renderer_enabled() const {
    return renderer_type == mojom::RendererType::REMOTING_RENDERER;
  }
};

}  // namespace content

#endif  // CONTENT_PUBLIC_RENDERER_RENDER_FRAME_MEDIA_PLAYBACK_OPTIONS_H_