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 CHROME_BROWSER_MEDIA_WEBRTC_MEDIA_PERMISSION_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_WEBRTC_MEDIA_PERMISSION_H_ |
6 #define CHROME_BROWSER_MEDIA_WEBRTC_MEDIA_PERMISSION_H_ | 6 #define CHROME_BROWSER_MEDIA_WEBRTC_MEDIA_PERMISSION_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "components/content_settings/core/common/content_settings.h" | 11 #include "components/content_settings/core/common/content_settings.h" |
12 #include "components/content_settings/core/common/content_settings_types.h" | 12 #include "components/content_settings/core/common/content_settings_types.h" |
13 #include "content/public/common/media_stream_request.h" | 13 #include "content/public/common/media_stream_request.h" |
14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
15 | 15 |
16 class MediaStreamDevicePermissionContext; | |
17 class Profile; | 16 class Profile; |
18 | 17 |
19 // Represents a permission for microphone/camera access. | 18 // Represents a permission for microphone/camera access. |
20 class MediaPermission { | 19 class MediaPermission { |
21 public: | 20 public: |
22 MediaPermission(ContentSettingsType content_type, | 21 MediaPermission(ContentSettingsType content_type, |
23 const GURL& requesting_origin, | 22 const GURL& requesting_origin, |
24 const GURL& embedding_origin, | 23 const GURL& embedding_origin, |
25 Profile* profile); | 24 Profile* profile); |
26 | 25 |
27 // Returns the status of the permission. If the setting is | 26 // Returns the status of the permission. If the setting is |
28 // CONTENT_SETTING_BLOCK, |denial_reason| will output the reason for it being | 27 // CONTENT_SETTING_BLOCK, |denial_reason| will output the reason for it being |
29 // blocked. | 28 // blocked. |
30 ContentSetting GetPermissionStatus( | 29 ContentSetting GetPermissionStatus( |
31 content::MediaStreamRequestResult* denial_reason) const; | 30 content::MediaStreamRequestResult* denial_reason) const; |
32 | 31 |
33 // Returns the status of the permission as with GetPermissionStatus but also | 32 // Returns the status of the permission as with GetPermissionStatus but also |
34 // checks that the specified |device_id| is an available device. | 33 // checks that the specified |device_id| is an available device. |
35 ContentSetting GetPermissionStatusWithDeviceRequired( | 34 ContentSetting GetPermissionStatusWithDeviceRequired( |
36 const std::string& device_id, | 35 const std::string& device_id, |
37 content::MediaStreamRequestResult* denial_reason) const; | 36 content::MediaStreamRequestResult* denial_reason) const; |
38 | 37 |
39 private: | 38 private: |
40 ContentSetting GetStoredContentSetting( | |
41 MediaStreamDevicePermissionContext* media_device_permission_context) | |
42 const; | |
43 bool HasAvailableDevices(const std::string& device_id) const; | 39 bool HasAvailableDevices(const std::string& device_id) const; |
44 | 40 |
45 const ContentSettingsType content_type_; | 41 const ContentSettingsType content_type_; |
46 const GURL requesting_origin_; | 42 const GURL requesting_origin_; |
47 const GURL embedding_origin_; | 43 const GURL embedding_origin_; |
48 const std::string device_id_; | 44 const std::string device_id_; |
49 Profile* const profile_; | 45 Profile* const profile_; |
50 | 46 |
51 DISALLOW_COPY_AND_ASSIGN(MediaPermission); | 47 DISALLOW_COPY_AND_ASSIGN(MediaPermission); |
52 }; | 48 }; |
53 | 49 |
54 #endif // CHROME_BROWSER_MEDIA_WEBRTC_MEDIA_PERMISSION_H_ | 50 #endif // CHROME_BROWSER_MEDIA_WEBRTC_MEDIA_PERMISSION_H_ |
OLD | NEW |