| 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 Profile; | 16 class Profile; |
| 17 | 17 |
| 18 namespace content { |
| 19 class WebContents; |
| 20 } |
| 21 |
| 18 // Represents a permission for microphone/camera access. | 22 // Represents a permission for microphone/camera access. |
| 19 class MediaPermission { | 23 class MediaPermission { |
| 20 public: | 24 public: |
| 21 MediaPermission(ContentSettingsType content_type, | 25 MediaPermission(ContentSettingsType content_type, |
| 22 const GURL& requesting_origin, | 26 const GURL& requesting_origin, |
| 23 const GURL& embedding_origin, | 27 const GURL& embedding_origin, |
| 24 Profile* profile); | 28 Profile* profile, |
| 29 content::WebContents* web_contents); |
| 25 | 30 |
| 26 // Returns the status of the permission. If the setting is | 31 // Returns the status of the permission. If the setting is |
| 27 // CONTENT_SETTING_BLOCK, |denial_reason| will output the reason for it being | 32 // CONTENT_SETTING_BLOCK, |denial_reason| will output the reason for it being |
| 28 // blocked. | 33 // blocked. |
| 29 ContentSetting GetPermissionStatus( | 34 ContentSetting GetPermissionStatus( |
| 30 content::MediaStreamRequestResult* denial_reason) const; | 35 content::MediaStreamRequestResult* denial_reason) const; |
| 31 | 36 |
| 32 // Returns the status of the permission as with GetPermissionStatus but also | 37 // Returns the status of the permission as with GetPermissionStatus but also |
| 33 // checks that the specified |device_id| is an available device. | 38 // checks that the specified |device_id| is an available device. |
| 34 ContentSetting GetPermissionStatusWithDeviceRequired( | 39 ContentSetting GetPermissionStatusWithDeviceRequired( |
| 35 const std::string& device_id, | 40 const std::string& device_id, |
| 36 content::MediaStreamRequestResult* denial_reason) const; | 41 content::MediaStreamRequestResult* denial_reason) const; |
| 37 | 42 |
| 38 private: | 43 private: |
| 39 bool HasAvailableDevices(const std::string& device_id) const; | 44 bool HasAvailableDevices(const std::string& device_id) const; |
| 40 | 45 |
| 41 const ContentSettingsType content_type_; | 46 const ContentSettingsType content_type_; |
| 42 const GURL requesting_origin_; | 47 const GURL requesting_origin_; |
| 43 const GURL embedding_origin_; | 48 const GURL embedding_origin_; |
| 44 const std::string device_id_; | 49 const std::string device_id_; |
| 45 Profile* const profile_; | 50 Profile* const profile_; |
| 51 content::WebContents* const web_contents_; |
| 46 | 52 |
| 47 DISALLOW_COPY_AND_ASSIGN(MediaPermission); | 53 DISALLOW_COPY_AND_ASSIGN(MediaPermission); |
| 48 }; | 54 }; |
| 49 | 55 |
| 50 #endif // CHROME_BROWSER_MEDIA_WEBRTC_MEDIA_PERMISSION_H_ | 56 #endif // CHROME_BROWSER_MEDIA_WEBRTC_MEDIA_PERMISSION_H_ |
| OLD | NEW |