summaryrefslogtreecommitdiffstats
path: root/chrome/browser/media/media_access_handler.h
blob: bc7b8556380abbca69baa61a9b6ccb60b423bb22 (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
// Copyright 2015 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 CHROME_BROWSER_MEDIA_MEDIA_ACCESS_HANDLER_H_
#define CHROME_BROWSER_MEDIA_MEDIA_ACCESS_HANDLER_H_

#include "base/callback.h"
#include "content/public/browser/media_request_state.h"
#include "content/public/common/media_stream_request.h"

namespace content {
class WebContents;
}

namespace extensions {
class Extension;
}

// Interface for handling media access requests that are propagated from
// MediaCaptureDevicesDispatcher.
class MediaAccessHandler {
 public:
  MediaAccessHandler() {}
  virtual ~MediaAccessHandler() {}

  // Check if the media stream type is supported by MediaAccessHandler.
  virtual bool SupportsStreamType(const content::MediaStreamType type,
                                  const extensions::Extension* extension) = 0;
  // Check media access permission. |extension| is set to NULL if request was
  // made from a drive-by page.
  virtual bool CheckMediaAccessPermission(
      content::WebContents* web_contents,
      const GURL& security_origin,
      content::MediaStreamType type,
      const extensions::Extension* extension) = 0;
  // Process media access requests. |extension| is set to NULL if request was
  // made from a drive-by page.
  virtual void HandleRequest(content::WebContents* web_contents,
                             const content::MediaStreamRequest& request,
                             const content::MediaResponseCallback& callback,
                             const extensions::Extension* extension) = 0;
  // Update media request state. Called on UI thread.
  virtual void UpdateMediaRequestState(int render_process_id,
                                       int render_frame_id,
                                       int page_request_id,
                                       content::MediaStreamType stream_type,
                                       content::MediaRequestState state) {}
};

#endif  // CHROME_BROWSER_MEDIA_MEDIA_ACCESS_HANDLER_H_