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

content / renderer / media / render_media_event_handler.h [blame]

// Copyright 2019 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_RENDERER_MEDIA_RENDER_MEDIA_EVENT_HANDLER_H_
#define CONTENT_RENDERER_MEDIA_RENDER_MEDIA_EVENT_HANDLER_H_

#include <vector>

#include "content/common/media/media_log_records.mojom.h"
#include "content/renderer/media/batching_media_log.h"
#include "media/base/media_player_logging_id.h"
#include "mojo/public/cpp/bindings/remote.h"

namespace content {

// RenderMediaEventHandler is an implementation of
// BatchingMediaLog::EventHandler that forwards events to the browser process.
class RenderMediaEventHandler : public BatchingMediaLog::EventHandler {
 public:
  explicit RenderMediaEventHandler(media::MediaPlayerLoggingID player_id);
  ~RenderMediaEventHandler() override;
  void SendQueuedMediaEvents(std::vector<media::MediaLogRecord>) override;
  void OnWebMediaPlayerDestroyed() override;

 private:
  media::MediaPlayerLoggingID log_id_;
  content::mojom::MediaInternalLogRecords& GetMediaInternalRecordLogRemote();
  mojo::Remote<content::mojom::MediaInternalLogRecords>
      media_internal_log_remote_;
};

}  // namespace content

#endif  // CONTENT_RENDERER_MEDIA_RENDER_MEDIA_EVENT_HANDLER_H_