summaryrefslogtreecommitdiffstats
path: root/content/browser/renderer_host/media/media_stream_requester.h
blob: 337effade97ddee0de682ef46acf252532f21395 (plain)
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
47
48
49
50
51
52
53
54
55
// Copyright (c) 2012 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.

#ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_REQUESTER_H_
#define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_REQUESTER_H_

#include <string>

#include "content/common/content_export.h"
#include "content/common/media/media_stream_options.h"

namespace content {

// MediaStreamRequester must be implemented by the class requesting a new media
// stream to be opened. MediaStreamManager will use this interface to signal
// success and error for a request.
class CONTENT_EXPORT MediaStreamRequester {
 public:
  // Called as a reply of a successful call to GenerateStream.
  virtual void StreamGenerated(int render_view_id,
                               int page_request_id,
                               const std::string& label,
                               const StreamDeviceInfoArray& audio_devices,
                               const StreamDeviceInfoArray& video_devices) = 0;
  // Called if GenerateStream failed.
  virtual void StreamGenerationFailed(
      int render_view_id,
      int page_request_id,
      content::MediaStreamRequestResult result) = 0;
  // Called if a device has been stopped by a user from UI or the device
  // has become unavailable.  |render_view_id| is the render view that requested
  // the device and |label| is the label of the request|.
  virtual void DeviceStopped(int render_view_id,
                             const std::string& label,
                             const StreamDeviceInfo& device) = 0;
  // Called as a reply of a successful call to EnumerateDevices.
  virtual void DevicesEnumerated(int render_view_id,
                                 int page_request_id,
                                 const std::string& label,
                                 const StreamDeviceInfoArray& devices) = 0;
  // Called as a reply of a successful call to OpenDevice.
  virtual void DeviceOpened(int render_view_id,
                            int page_request_id,
                            const std::string& label,
                            const StreamDeviceInfo& device_info) = 0;

 protected:
  virtual ~MediaStreamRequester() {
  }
};

}  // namespace content

#endif  // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_REQUESTER_H_