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
   44
   45
   46

fuchsia_web / webengine / browser / web_engine_media_resource_provider_impl.h [blame]

// 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.

#ifndef FUCHSIA_WEB_WEBENGINE_BROWSER_WEB_ENGINE_MEDIA_RESOURCE_PROVIDER_IMPL_H_
#define FUCHSIA_WEB_WEBENGINE_BROWSER_WEB_ENGINE_MEDIA_RESOURCE_PROVIDER_IMPL_H_

#include <lib/fidl/cpp/interface_handle.h>

#include "content/public/browser/document_service.h"
#include "fuchsia_web/webengine/mojom/web_engine_media_resource_provider.mojom.h"

namespace content {
class RenderFrameHost;
}  // namespace content

class WebEngineMediaResourceProviderImpl final
    : public content::DocumentService<mojom::WebEngineMediaResourceProvider> {
 public:
  ~WebEngineMediaResourceProviderImpl() override;

  WebEngineMediaResourceProviderImpl(
      const WebEngineMediaResourceProviderImpl&) = delete;
  WebEngineMediaResourceProviderImpl& operator=(
      const WebEngineMediaResourceProviderImpl&) = delete;
  WebEngineMediaResourceProviderImpl(
      const WebEngineMediaResourceProviderImpl&&) = delete;
  WebEngineMediaResourceProviderImpl& operator=(
      const WebEngineMediaResourceProviderImpl&&) = delete;

  static void Bind(
      content::RenderFrameHost* frame_host,
      mojo::PendingReceiver<mojom::WebEngineMediaResourceProvider> receiver);

 private:
  WebEngineMediaResourceProviderImpl(
      content::RenderFrameHost& render_frame_host,
      mojo::PendingReceiver<mojom::WebEngineMediaResourceProvider> receiver);

  // mojom::WebEngineMediaResourceProvider:
  void ShouldUseAudioConsumer(ShouldUseAudioConsumerCallback callback) override;
  void CreateAudioConsumer(
      fidl::InterfaceRequest<fuchsia::media::AudioConsumer> request) override;
};

#endif  // FUCHSIA_WEB_WEBENGINE_BROWSER_WEB_ENGINE_MEDIA_RESOURCE_PROVIDER_IMPL_H_