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