Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / media / base / media_permission.h
blobb6c3e1eb826b138845d4716d9ad6cc574f386756
1 // Copyright 2015 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.
5 #ifndef MEDIA_BASE_MEDIA_PERMISSION_H_
6 #define MEDIA_BASE_MEDIA_PERMISSION_H_
8 #include "base/callback.h"
9 #include "base/macros.h"
10 #include "media/base/media_export.h"
12 class GURL;
14 namespace media {
16 // Interface to handle media related permission checks and requests.
17 class MEDIA_EXPORT MediaPermission {
18 public:
19 typedef base::Callback<void(bool)> PermissionStatusCB;
21 enum Type {
22 PROTECTED_MEDIA_IDENTIFIER,
23 AUDIO_CAPTURE,
24 VIDEO_CAPTURE,
27 MediaPermission();
28 virtual ~MediaPermission();
30 // Checks whether |type| is permitted for |security_origion| without
31 // triggering user interaction (e.g. permission prompt). The status will be
32 // |false| if the permission has never been set.
33 virtual void HasPermission(
34 Type type,
35 const GURL& security_origin,
36 const PermissionStatusCB& permission_status_cb) = 0;
38 // Requests |type| permission for |security_origion|. This may trigger user
39 // interaction (e.g. permission prompt) if the permission has never been set.
40 virtual void RequestPermission(
41 Type type,
42 const GURL& security_origin,
43 const PermissionStatusCB& permission_status_cb) = 0;
45 private:
46 DISALLOW_COPY_AND_ASSIGN(MediaPermission);
49 } // namespace media
51 #endif // MEDIA_BASE_MEDIA_PERMISSION_H_