OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_BASE_MEDIA_PERMISSION_H_ | 5 #ifndef MEDIA_BASE_MEDIA_PERMISSION_H_ |
6 #define MEDIA_BASE_MEDIA_PERMISSION_H_ | 6 #define MEDIA_BASE_MEDIA_PERMISSION_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "media/base/media_export.h" | 10 #include "media/base/media_export.h" |
11 | 11 |
12 class GURL; | 12 class GURL; |
13 | 13 |
14 namespace media { | 14 namespace media { |
15 | 15 |
16 // Interface to handle media related permission checks and requests. | 16 // Interface to handle media related permission checks and requests. |
17 class MEDIA_EXPORT MediaPermission { | 17 class MEDIA_EXPORT MediaPermission { |
18 public: | 18 public: |
19 typedef base::Callback<void(bool)> PermissionStatusCB; | 19 typedef base::Callback<void(bool)> PermissionStatusCB; |
20 | 20 |
21 enum Type { | 21 enum Type { |
22 PROTECTED_MEDIA_IDENTIFIER, | 22 PROTECTED_MEDIA_IDENTIFIER, |
| 23 AUDIO_CAPTURE, |
| 24 VIDEO_CAPTURE, |
23 }; | 25 }; |
24 | 26 |
25 MediaPermission(); | 27 MediaPermission(); |
26 virtual ~MediaPermission(); | 28 virtual ~MediaPermission(); |
27 | 29 |
28 // Checks whether |type| is permitted for |security_origion| without | 30 // Checks whether |type| is permitted for |security_origion| without |
29 // triggering user interaction (e.g. permission prompt). The status will be | 31 // triggering user interaction (e.g. permission prompt). The status will be |
30 // |false| if the permission has never been set. | 32 // |false| if the permission has never been set. |
31 virtual void HasPermission( | 33 virtual void HasPermission( |
32 Type type, | 34 Type type, |
33 const GURL& security_origin, | 35 const GURL& security_origin, |
34 const PermissionStatusCB& permission_status_cb) = 0; | 36 const PermissionStatusCB& permission_status_cb) = 0; |
35 | 37 |
36 // Requests |type| permission for |security_origion|. This may trigger user | 38 // Requests |type| permission for |security_origion|. This may trigger user |
37 // interaction (e.g. permission prompt) if the permission has never been set. | 39 // interaction (e.g. permission prompt) if the permission has never been set. |
38 virtual void RequestPermission( | 40 virtual void RequestPermission( |
39 Type type, | 41 Type type, |
40 const GURL& security_origin, | 42 const GURL& security_origin, |
41 const PermissionStatusCB& permission_status_cb) = 0; | 43 const PermissionStatusCB& permission_status_cb) = 0; |
42 | 44 |
43 private: | 45 private: |
44 DISALLOW_COPY_AND_ASSIGN(MediaPermission); | 46 DISALLOW_COPY_AND_ASSIGN(MediaPermission); |
45 }; | 47 }; |
46 | 48 |
47 } // namespace media | 49 } // namespace media |
48 | 50 |
49 #endif // MEDIA_BASE_MEDIA_PERMISSION_H_ | 51 #endif // MEDIA_BASE_MEDIA_PERMISSION_H_ |
OLD | NEW |