| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 void PermissionGranted() override; | 62 void PermissionGranted() override; |
| 63 void PermissionDenied() override; | 63 void PermissionDenied() override; |
| 64 void Cancelled() override; | 64 void Cancelled() override; |
| 65 void RequestFinished() override; | 65 void RequestFinished() override; |
| 66 PermissionRequestType GetPermissionRequestType() const override; | 66 PermissionRequestType GetPermissionRequestType() const override; |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 friend class MediaStreamDevicesControllerTest; | 69 friend class MediaStreamDevicesControllerTest; |
| 70 friend class policy::MediaStreamDevicesControllerBrowserTest; | 70 friend class policy::MediaStreamDevicesControllerBrowserTest; |
| 71 | 71 |
| 72 // Delegate showing permission prompts. |
| 73 class PermissionPromptDelegate { |
| 74 public: |
| 75 virtual void ShowPrompt( |
| 76 bool user_gesture, |
| 77 content::WebContents* web_contents, |
| 78 std::unique_ptr<MediaStreamDevicesController> controller) = 0; |
| 79 }; |
| 80 |
| 81 class PermissionPromptDelegateImpl; |
| 82 |
| 83 static void RequestPermissionsWithDelegate( |
| 84 content::WebContents* web_contents, |
| 85 const content::MediaStreamRequest& request, |
| 86 const content::MediaResponseCallback& callback, |
| 87 PermissionPromptDelegate* delegate); |
| 88 |
| 72 MediaStreamDevicesController(content::WebContents* web_contents, | 89 MediaStreamDevicesController(content::WebContents* web_contents, |
| 73 const content::MediaStreamRequest& request, | 90 const content::MediaStreamRequest& request, |
| 74 const content::MediaResponseCallback& callback); | 91 const content::MediaResponseCallback& callback); |
| 75 | 92 |
| 76 bool IsAllowedForAudio() const; | 93 bool IsAllowedForAudio() const; |
| 77 bool IsAllowedForVideo() const; | 94 bool IsAllowedForVideo() const; |
| 78 | 95 |
| 79 // Returns a list of devices available for the request for the given | 96 // Returns a list of devices available for the request for the given |
| 80 // audio/video permission settings. | 97 // audio/video permission settings. |
| 81 content::MediaStreamDevices GetDevices(ContentSetting audio_setting, | 98 content::MediaStreamDevices GetDevices(ContentSetting audio_setting, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 // was created. | 149 // was created. |
| 133 TabSpecificContentSettings* content_settings_; | 150 TabSpecificContentSettings* content_settings_; |
| 134 | 151 |
| 135 // The original request for access to devices. | 152 // The original request for access to devices. |
| 136 const content::MediaStreamRequest request_; | 153 const content::MediaStreamRequest request_; |
| 137 | 154 |
| 138 // The callback that needs to be Run to notify WebRTC of whether access to | 155 // The callback that needs to be Run to notify WebRTC of whether access to |
| 139 // audio/video devices was granted or not. | 156 // audio/video devices was granted or not. |
| 140 content::MediaResponseCallback callback_; | 157 content::MediaResponseCallback callback_; |
| 141 | 158 |
| 159 std::unique_ptr<PermissionPromptDelegate> delegate_; |
| 160 |
| 142 DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicesController); | 161 DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicesController); |
| 143 }; | 162 }; |
| 144 | 163 |
| 145 #endif // CHROME_BROWSER_MEDIA_WEBRTC_MEDIA_STREAM_DEVICES_CONTROLLER_H_ | 164 #endif // CHROME_BROWSER_MEDIA_WEBRTC_MEDIA_STREAM_DEVICES_CONTROLLER_H_ |
| OLD | NEW |