media_observer.h revision 5821806d5e7f356e8fa4b058a389a808ea183019
1// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CONTENT_PUBLIC_BROWSER_MEDIA_OBSERVER_H_
6#define CONTENT_PUBLIC_BROWSER_MEDIA_OBSERVER_H_
7
8#include "content/public/browser/media_request_state.h"
9#include "content/public/common/media_stream_request.h"
10
11namespace media {
12struct MediaLogEvent;
13}
14
15namespace content {
16
17// An embedder may implement MediaObserver and return it from
18// ContentBrowserClient to receive callbacks as media events occur.
19class MediaObserver {
20 public:
21  // Called when an audio stream is deleted.
22  virtual void OnDeleteAudioStream(void* host, int stream_id) = 0;
23
24  // Called when an audio stream is set to playing or paused.
25  virtual void OnSetAudioStreamPlaying(void* host, int stream_id,
26                                       bool playing) = 0;
27
28  // Called when the status of an audio stream is set to "created", "flushed",
29  // "closed", or "error".
30  virtual void OnSetAudioStreamStatus(void* host, int stream_id,
31                                      const std::string& status) = 0;
32
33  // Called when the volume of an audio stream is set.
34  virtual void OnSetAudioStreamVolume(void* host, int stream_id,
35                                      double volume) = 0;
36
37  // Called when a MediaEvent occurs.
38  virtual void OnMediaEvent(int render_process_id,
39                            const media::MediaLogEvent& event) = 0;
40
41  // Called when capture devices are opened.
42  virtual void OnCaptureDevicesOpened(
43      int render_process_id,
44      int render_view_id,
45      const MediaStreamDevices& devices) = 0;
46
47  // Called when the opened capture devices are closed.
48  virtual void OnCaptureDevicesClosed(
49      int render_process_id,
50      int render_view_id,
51      const MediaStreamDevices& devices) = 0;
52
53  // Called when a media request changes state.
54  virtual void OnMediaRequestStateChanged(
55      int render_process_id,
56      int render_view_id,
57      const MediaStreamDevice& device,
58      MediaRequestState state) = 0;
59
60 protected:
61  virtual ~MediaObserver() {}
62};
63
64}  // namespace content
65
66#endif  // CONTENT_PUBLIC_BROWSER_MEDIA_OBSERVER_H_
67