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