Chromium Code Reviews| 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 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "chrome/browser/permissions/permission_request.h" | 12 #include "chrome/browser/permissions/permission_request.h" |
| 13 #include "components/content_settings/core/common/content_settings.h" | 13 #include "components/content_settings/core/common/content_settings.h" |
| 14 #include "content/public/browser/web_contents_delegate.h" | 14 #include "content/public/browser/web_contents_delegate.h" |
| 15 | 15 |
| 16 class MediaStreamDevicesController; | |
| 16 class Profile; | 17 class Profile; |
| 17 class TabSpecificContentSettings; | 18 class TabSpecificContentSettings; |
| 18 | 19 |
| 19 namespace content { | 20 namespace content { |
| 20 class WebContents; | 21 class WebContents; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace user_prefs { | 24 namespace user_prefs { |
| 24 class PrefRegistrySyncable; | 25 class PrefRegistrySyncable; |
| 25 } | 26 } |
| 26 | 27 |
| 27 namespace policy { | 28 namespace policy { |
| 28 class MediaStreamDevicesControllerBrowserTest; | 29 class MediaStreamDevicesControllerBrowserTest; |
| 29 } | 30 } |
| 30 | 31 |
| 31 namespace test { | 32 namespace test { |
| 32 class MediaStreamDevicesControllerTestApi; | 33 class MediaStreamDevicesControllerTestApi; |
| 33 } | 34 } |
| 34 | 35 |
| 36 namespace internal { | |
| 37 // Delegate showing permission prompts. | |
|
sky
2017/03/23 22:59:46
Why does this need to move? What error happens wit
Tom (Use chromium acct)
2017/03/23 23:45:14
Subclasses cannot derive from PermissionPromptDele
| |
| 38 class PermissionPromptDelegate { | |
| 39 public: | |
| 40 virtual void ShowPrompt( | |
| 41 bool user_gesture, | |
| 42 content::WebContents* web_contents, | |
| 43 std::unique_ptr<MediaStreamDevicesController> controller) = 0; | |
| 44 }; | |
| 45 } | |
| 46 | |
| 35 class MediaStreamDevicesController : public PermissionRequest { | 47 class MediaStreamDevicesController : public PermissionRequest { |
| 36 public: | 48 public: |
| 37 static void RequestPermissions( | 49 static void RequestPermissions( |
| 38 content::WebContents* web_contents, | 50 content::WebContents* web_contents, |
| 39 const content::MediaStreamRequest& request, | 51 const content::MediaStreamRequest& request, |
| 40 const content::MediaResponseCallback& callback); | 52 const content::MediaResponseCallback& callback); |
| 41 | 53 |
| 42 // Registers the prefs backing the audio and video policies. | 54 // Registers the prefs backing the audio and video policies. |
| 43 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 55 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 44 | 56 |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 67 void PermissionDenied() override; | 79 void PermissionDenied() override; |
| 68 void Cancelled() override; | 80 void Cancelled() override; |
| 69 void RequestFinished() override; | 81 void RequestFinished() override; |
| 70 PermissionRequestType GetPermissionRequestType() const override; | 82 PermissionRequestType GetPermissionRequestType() const override; |
| 71 | 83 |
| 72 private: | 84 private: |
| 73 friend class MediaStreamDevicesControllerTest; | 85 friend class MediaStreamDevicesControllerTest; |
| 74 friend class test::MediaStreamDevicesControllerTestApi; | 86 friend class test::MediaStreamDevicesControllerTestApi; |
| 75 friend class policy::MediaStreamDevicesControllerBrowserTest; | 87 friend class policy::MediaStreamDevicesControllerBrowserTest; |
| 76 | 88 |
| 77 // Delegate showing permission prompts. | |
| 78 class PermissionPromptDelegate { | |
| 79 public: | |
| 80 virtual void ShowPrompt( | |
| 81 bool user_gesture, | |
| 82 content::WebContents* web_contents, | |
| 83 std::unique_ptr<MediaStreamDevicesController> controller) = 0; | |
| 84 }; | |
| 85 | |
| 86 class MediaPermissionStatus; | 89 class MediaPermissionStatus; |
| 87 class PermissionPromptDelegateImpl; | 90 class PermissionPromptDelegateImpl; |
| 88 | 91 |
| 89 static void RequestPermissionsWithDelegate( | 92 static void RequestPermissionsWithDelegate( |
| 90 content::WebContents* web_contents, | 93 content::WebContents* web_contents, |
| 91 const content::MediaStreamRequest& request, | 94 const content::MediaStreamRequest& request, |
| 92 const content::MediaResponseCallback& callback, | 95 const content::MediaResponseCallback& callback, |
| 93 PermissionPromptDelegate* delegate); | 96 internal::PermissionPromptDelegate* delegate); |
| 94 | 97 |
| 95 MediaStreamDevicesController(content::WebContents* web_contents, | 98 MediaStreamDevicesController(content::WebContents* web_contents, |
| 96 const content::MediaStreamRequest& request, | 99 const content::MediaStreamRequest& request, |
| 97 const content::MediaResponseCallback& callback, | 100 const content::MediaResponseCallback& callback, |
| 98 const MediaPermissionStatus& initial_permission); | 101 const MediaPermissionStatus& initial_permission); |
| 99 | 102 |
| 100 bool IsAllowedForAudio() const; | 103 bool IsAllowedForAudio() const; |
| 101 bool IsAllowedForVideo() const; | 104 bool IsAllowedForVideo() const; |
| 102 | 105 |
| 103 // Returns a list of devices available for the request for the given | 106 // Returns a list of devices available for the request for the given |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 // was created. | 161 // was created. |
| 159 TabSpecificContentSettings* content_settings_; | 162 TabSpecificContentSettings* content_settings_; |
| 160 | 163 |
| 161 // The original request for access to devices. | 164 // The original request for access to devices. |
| 162 const content::MediaStreamRequest request_; | 165 const content::MediaStreamRequest request_; |
| 163 | 166 |
| 164 // The callback that needs to be Run to notify WebRTC of whether access to | 167 // The callback that needs to be Run to notify WebRTC of whether access to |
| 165 // audio/video devices was granted or not. | 168 // audio/video devices was granted or not. |
| 166 content::MediaResponseCallback callback_; | 169 content::MediaResponseCallback callback_; |
| 167 | 170 |
| 168 std::unique_ptr<PermissionPromptDelegate> delegate_; | 171 std::unique_ptr<internal::PermissionPromptDelegate> delegate_; |
| 169 | 172 |
| 170 DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicesController); | 173 DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicesController); |
| 171 }; | 174 }; |
| 172 | 175 |
| 173 #endif // CHROME_BROWSER_MEDIA_WEBRTC_MEDIA_STREAM_DEVICES_CONTROLLER_H_ | 176 #endif // CHROME_BROWSER_MEDIA_WEBRTC_MEDIA_STREAM_DEVICES_CONTROLLER_H_ |
| OLD | NEW |