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_STREAM_DEVICE_PERMISSION_CONTEXT_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_WEBRTC_MEDIA_STREAM_DEVICE_PERMISSION_CONTEXT_H_ |
6 #define CHROME_BROWSER_MEDIA_WEBRTC_MEDIA_STREAM_DEVICE_PERMISSION_CONTEXT_H_ | 6 #define CHROME_BROWSER_MEDIA_WEBRTC_MEDIA_STREAM_DEVICE_PERMISSION_CONTEXT_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "chrome/browser/permissions/permission_context_base.h" | 9 #include "chrome/browser/permissions/permission_context_base.h" |
10 #include "components/content_settings/core/common/content_settings_types.h" | 10 #include "components/content_settings/core/common/content_settings_types.h" |
11 | 11 |
12 // Common class which handles the mic and camera permissions. | 12 // Common class which handles the mic and camera permissions. |
13 class MediaStreamDevicePermissionContext : public PermissionContextBase { | 13 class MediaStreamDevicePermissionContext : public PermissionContextBase { |
14 public: | 14 public: |
15 MediaStreamDevicePermissionContext(Profile* profile, | 15 MediaStreamDevicePermissionContext(Profile* profile, |
16 ContentSettingsType content_settings_type); | 16 ContentSettingsType content_settings_type); |
17 ~MediaStreamDevicePermissionContext() override; | 17 ~MediaStreamDevicePermissionContext() override; |
18 | 18 |
19 // PermissionContextBase: | 19 // PermissionContextBase: |
20 void RequestPermission(content::WebContents* web_contents, | 20 void DecidePermission(content::WebContents* web_contents, |
21 const PermissionRequestID& id, | 21 const PermissionRequestID& id, |
22 const GURL& requesting_frame, | 22 const GURL& requesting_origin, |
23 bool user_gesture, | 23 const GURL& embedding_origin, |
24 const BrowserPermissionCallback& callback) override; | 24 bool user_gesture, |
| 25 const BrowserPermissionCallback& callback) override; |
25 | 26 |
26 // TODO(xhwang): GURL.GetOrigin() shouldn't be used as the origin. Need to | 27 // TODO(xhwang): GURL.GetOrigin() shouldn't be used as the origin. Need to |
27 // refactor to use url::Origin. crbug.com/527149 is filed for this. | 28 // refactor to use url::Origin. crbug.com/527149 is filed for this. |
28 ContentSetting GetPermissionStatusInternal( | 29 ContentSetting GetPermissionStatusInternal( |
29 content::RenderFrameHost* render_frame_host, | 30 content::RenderFrameHost* render_frame_host, |
30 const GURL& requesting_origin, | 31 const GURL& requesting_origin, |
31 const GURL& embedding_origin) const override; | 32 const GURL& embedding_origin) const override; |
32 | 33 |
33 void ResetPermission(const GURL& requesting_origin, | 34 void ResetPermission(const GURL& requesting_origin, |
34 const GURL& embedding_origin) override; | 35 const GURL& embedding_origin) override; |
35 | 36 |
36 void CancelPermissionRequest(content::WebContents* web_contents, | 37 void CancelPermissionRequest(content::WebContents* web_contents, |
37 const PermissionRequestID& id) override; | 38 const PermissionRequestID& id) override; |
38 | 39 |
39 private: | 40 private: |
40 // PermissionContextBase: | 41 // PermissionContextBase: |
41 bool IsRestrictedToSecureOrigins() const override; | 42 bool IsRestrictedToSecureOrigins() const override; |
42 | 43 |
43 ContentSettingsType content_settings_type_; | 44 ContentSettingsType content_settings_type_; |
44 | 45 |
45 DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicePermissionContext); | 46 DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicePermissionContext); |
46 }; | 47 }; |
47 | 48 |
48 #endif // CHROME_BROWSER_MEDIA_WEBRTC_MEDIA_STREAM_DEVICE_PERMISSION_CONTEXT_H_ | 49 #endif // CHROME_BROWSER_MEDIA_WEBRTC_MEDIA_STREAM_DEVICE_PERMISSION_CONTEXT_H_ |
OLD | NEW |