OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_UI_PROXY_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_UI_PROXY_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_UI_PROXY_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_UI_PROXY_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 static scoped_ptr<MediaStreamUIProxy> Create(); | 31 static scoped_ptr<MediaStreamUIProxy> Create(); |
32 static scoped_ptr<MediaStreamUIProxy> CreateForTests( | 32 static scoped_ptr<MediaStreamUIProxy> CreateForTests( |
33 RenderFrameHostDelegate* render_delegate); | 33 RenderFrameHostDelegate* render_delegate); |
34 | 34 |
35 virtual ~MediaStreamUIProxy(); | 35 virtual ~MediaStreamUIProxy(); |
36 | 36 |
37 // Requests access for the MediaStream by calling | 37 // Requests access for the MediaStream by calling |
38 // WebContentsDelegate::RequestMediaAccessPermission(). The specified | 38 // WebContentsDelegate::RequestMediaAccessPermission(). The specified |
39 // |response_callback| is called when the WebContentsDelegate approves or | 39 // |response_callback| is called when the WebContentsDelegate approves or |
40 // denies request. | 40 // denies request. |
41 virtual void RequestAccess(const MediaStreamRequest& request, | 41 virtual void RequestAccess(scoped_ptr<MediaStreamRequest> request, |
42 const ResponseCallback& response_callback); | 42 const ResponseCallback& response_callback); |
43 | 43 |
44 // Checks if we have permission to access the microphone or camera. Note that | 44 // Checks if we have permission to access the microphone or camera. Note that |
45 // this does not query the user, it checks any stored settings such as policy | 45 // this does not query the user, it checks any stored settings such as policy |
46 // or extension permissions. |type| must be MEDIA_DEVICE_AUDIO_CAPTURE | 46 // or extension permissions. |type| must be MEDIA_DEVICE_AUDIO_CAPTURE |
47 // or MEDIA_DEVICE_VIDEO_CAPTURE. | 47 // or MEDIA_DEVICE_VIDEO_CAPTURE. |
48 virtual void CheckAccess(const GURL& security_origin, | 48 virtual void CheckAccess(const GURL& security_origin, |
49 MediaStreamType type, | 49 MediaStreamType type, |
50 int render_process_id, | 50 int render_process_id, |
51 int render_frame_id, | 51 int render_frame_id, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 class CONTENT_EXPORT FakeMediaStreamUIProxy : public MediaStreamUIProxy { | 90 class CONTENT_EXPORT FakeMediaStreamUIProxy : public MediaStreamUIProxy { |
91 public: | 91 public: |
92 explicit FakeMediaStreamUIProxy(); | 92 explicit FakeMediaStreamUIProxy(); |
93 ~FakeMediaStreamUIProxy() override; | 93 ~FakeMediaStreamUIProxy() override; |
94 | 94 |
95 void SetAvailableDevices(const MediaStreamDevices& devices); | 95 void SetAvailableDevices(const MediaStreamDevices& devices); |
96 void SetMicAccess(bool access); | 96 void SetMicAccess(bool access); |
97 void SetCameraAccess(bool access); | 97 void SetCameraAccess(bool access); |
98 | 98 |
99 // MediaStreamUIProxy overrides. | 99 // MediaStreamUIProxy overrides. |
100 void RequestAccess(const MediaStreamRequest& request, | 100 void RequestAccess(scoped_ptr<MediaStreamRequest> request, |
101 const ResponseCallback& response_callback) override; | 101 const ResponseCallback& response_callback) override; |
102 void CheckAccess(const GURL& security_origin, | 102 void CheckAccess(const GURL& security_origin, |
103 MediaStreamType type, | 103 MediaStreamType type, |
104 int render_process_id, | 104 int render_process_id, |
105 int render_frame_id, | 105 int render_frame_id, |
106 const base::Callback<void(bool)>& callback) override; | 106 const base::Callback<void(bool)>& callback) override; |
107 void OnStarted(const base::Closure& stop_callback, | 107 void OnStarted(const base::Closure& stop_callback, |
108 const WindowIdCallback& window_id_callback) override; | 108 const WindowIdCallback& window_id_callback) override; |
109 | 109 |
110 private: | 110 private: |
111 // This is used for RequestAccess(). | 111 // This is used for RequestAccess(). |
112 MediaStreamDevices devices_; | 112 MediaStreamDevices devices_; |
113 | 113 |
114 // These are used for CheckAccess(). | 114 // These are used for CheckAccess(). |
115 bool mic_access_; | 115 bool mic_access_; |
116 bool camera_access_; | 116 bool camera_access_; |
117 | 117 |
118 DISALLOW_COPY_AND_ASSIGN(FakeMediaStreamUIProxy); | 118 DISALLOW_COPY_AND_ASSIGN(FakeMediaStreamUIProxy); |
119 }; | 119 }; |
120 | 120 |
121 } // namespace content | 121 } // namespace content |
122 | 122 |
123 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_UI_PROXY_H_ | 123 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_UI_PROXY_H_ |
OLD | NEW |