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