| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_DEVICES_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_WEBRTC_MEDIA_STREAM_DEVICES_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_MEDIA_WEBRTC_MEDIA_STREAM_DEVICES_CONTROLLER_H_ | 6 #define CHROME_BROWSER_MEDIA_WEBRTC_MEDIA_STREAM_DEVICES_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 void PermissionDenied() override; | 78 void PermissionDenied() override; |
| 79 void Cancelled() override; | 79 void Cancelled() override; |
| 80 void RequestFinished() override; | 80 void RequestFinished() override; |
| 81 PermissionRequestType GetPermissionRequestType() const override; | 81 PermissionRequestType GetPermissionRequestType() const override; |
| 82 | 82 |
| 83 private: | 83 private: |
| 84 friend class MediaStreamDevicesControllerTest; | 84 friend class MediaStreamDevicesControllerTest; |
| 85 friend class test::MediaStreamDevicesControllerTestApi; | 85 friend class test::MediaStreamDevicesControllerTestApi; |
| 86 friend class policy::MediaStreamDevicesControllerBrowserTest; | 86 friend class policy::MediaStreamDevicesControllerBrowserTest; |
| 87 | 87 |
| 88 class MediaPermissionStatus; | |
| 89 class PermissionPromptDelegateImpl; | 88 class PermissionPromptDelegateImpl; |
| 90 | 89 |
| 91 static void RequestPermissionsWithDelegate( | 90 static void RequestPermissionsWithDelegate( |
| 92 const content::MediaStreamRequest& request, | 91 const content::MediaStreamRequest& request, |
| 93 const content::MediaResponseCallback& callback, | 92 const content::MediaResponseCallback& callback, |
| 94 internal::PermissionPromptDelegate* delegate); | 93 internal::PermissionPromptDelegate* delegate); |
| 95 | 94 |
| 96 MediaStreamDevicesController(content::WebContents* web_contents, | 95 MediaStreamDevicesController(content::WebContents* web_contents, |
| 97 const content::MediaStreamRequest& request, | 96 const content::MediaStreamRequest& request, |
| 98 const content::MediaResponseCallback& callback, | 97 const content::MediaResponseCallback& callback); |
| 99 const MediaPermissionStatus& initial_permission); | |
| 100 | 98 |
| 101 bool IsAllowedForAudio() const; | 99 bool IsAllowedForAudio() const; |
| 102 bool IsAllowedForVideo() const; | 100 bool IsAllowedForVideo() const; |
| 103 | 101 |
| 104 // Returns a list of devices available for the request for the given | 102 // Returns a list of devices available for the request for the given |
| 105 // audio/video permission settings. | 103 // audio/video permission settings. |
| 106 content::MediaStreamDevices GetDevices(ContentSetting audio_setting, | 104 content::MediaStreamDevices GetDevices(ContentSetting audio_setting, |
| 107 ContentSetting video_setting); | 105 ContentSetting video_setting); |
| 108 | 106 |
| 109 // Runs |callback_| with the given audio/video permission settings. If neither | 107 // Runs |callback_| with the given audio/video permission settings. If neither |
| (...skipping 10 matching lines...) Expand all Loading... |
| 120 | 118 |
| 121 // Called when the permission has been set to update the | 119 // Called when the permission has been set to update the |
| 122 // TabSpecificContentSettings. | 120 // TabSpecificContentSettings. |
| 123 void UpdateTabSpecificContentSettings(ContentSetting audio_setting, | 121 void UpdateTabSpecificContentSettings(ContentSetting audio_setting, |
| 124 ContentSetting video_setting) const; | 122 ContentSetting video_setting) const; |
| 125 | 123 |
| 126 // Returns the content settings for the given content type and request. | 124 // Returns the content settings for the given content type and request. |
| 127 ContentSetting GetContentSetting( | 125 ContentSetting GetContentSetting( |
| 128 ContentSettingsType content_type, | 126 ContentSettingsType content_type, |
| 129 const content::MediaStreamRequest& request, | 127 const content::MediaStreamRequest& request, |
| 130 bool was_requested, | |
| 131 bool was_initially_blocked, | |
| 132 content::MediaStreamRequestResult* denial_reason) const; | 128 content::MediaStreamRequestResult* denial_reason) const; |
| 133 | 129 |
| 134 // Returns the content setting that should apply given an old content setting | 130 // Returns the content setting that should apply given an old content setting |
| 135 // and a user decision that has been made. If a user isn't being asked for one | 131 // and a user decision that has been made. If a user isn't being asked for one |
| 136 // of audio/video then we shouldn't change that setting, even if they accept | 132 // of audio/video then we shouldn't change that setting, even if they accept |
| 137 // the dialog. | 133 // the dialog. |
| 138 ContentSetting GetNewSetting(ContentSettingsType content_type, | 134 ContentSetting GetNewSetting(ContentSettingsType content_type, |
| 139 ContentSetting old_setting, | 135 ContentSetting old_setting, |
| 140 ContentSetting user_decision) const; | 136 ContentSetting user_decision) const; |
| 141 | 137 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 165 // The callback that needs to be Run to notify WebRTC of whether access to | 161 // The callback that needs to be Run to notify WebRTC of whether access to |
| 166 // audio/video devices was granted or not. | 162 // audio/video devices was granted or not. |
| 167 content::MediaResponseCallback callback_; | 163 content::MediaResponseCallback callback_; |
| 168 | 164 |
| 169 std::unique_ptr<internal::PermissionPromptDelegate> delegate_; | 165 std::unique_ptr<internal::PermissionPromptDelegate> delegate_; |
| 170 | 166 |
| 171 DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicesController); | 167 DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicesController); |
| 172 }; | 168 }; |
| 173 | 169 |
| 174 #endif // CHROME_BROWSER_MEDIA_WEBRTC_MEDIA_STREAM_DEVICES_CONTROLLER_H_ | 170 #endif // CHROME_BROWSER_MEDIA_WEBRTC_MEDIA_STREAM_DEVICES_CONTROLLER_H_ |
| OLD | NEW |