| 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" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "content/public/common/media_stream_request.h" | 12 #include "content/public/common/media_stream_request.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 | 15 |
| 16 class RenderViewHostDelegate; | 16 class RenderViewHostDelegate; |
| 17 | 17 |
| 18 // MediaStreamUIProxy proxies calls to media stream UI between IO thread and UI | 18 // MediaStreamUIProxy proxies calls to media stream UI between IO thread and UI |
| 19 // thread. One instance of this class is create per MediaStream object. It must | 19 // thread. One instance of this class is create per MediaStream object. It must |
| 20 // be create, used and destroyed on IO thread. | 20 // be create, used and destroyed on IO thread. |
| 21 class CONTENT_EXPORT MediaStreamUIProxy { | 21 class CONTENT_EXPORT MediaStreamUIProxy { |
| 22 public: | 22 public: |
| 23 typedef base::Callback< | 23 typedef base::Callback< |
| 24 void (const MediaStreamDevices& devices)> ResponseCallback; | 24 void (const MediaStreamDevices& devices, |
| 25 content::MediaStreamRequestResult result)> |
| 26 ResponseCallback; |
| 25 | 27 |
| 26 static scoped_ptr<MediaStreamUIProxy> Create(); | 28 static scoped_ptr<MediaStreamUIProxy> Create(); |
| 27 static scoped_ptr<MediaStreamUIProxy> CreateForTests( | 29 static scoped_ptr<MediaStreamUIProxy> CreateForTests( |
| 28 RenderViewHostDelegate* render_delegate); | 30 RenderViewHostDelegate* render_delegate); |
| 29 | 31 |
| 30 virtual ~MediaStreamUIProxy(); | 32 virtual ~MediaStreamUIProxy(); |
| 31 | 33 |
| 32 // Requests access for the MediaStream by calling | 34 // Requests access for the MediaStream by calling |
| 33 // WebContentsDelegate::RequestMediaAccessPermission(). The specified | 35 // WebContentsDelegate::RequestMediaAccessPermission(). The specified |
| 34 // |response_callback| is called when the WebContentsDelegate approves or | 36 // |response_callback| is called when the WebContentsDelegate approves or |
| (...skipping 10 matching lines...) Expand all Loading... |
| 45 void SetRenderViewHostDelegateForTests(RenderViewHostDelegate* delegate); | 47 void SetRenderViewHostDelegateForTests(RenderViewHostDelegate* delegate); |
| 46 | 48 |
| 47 protected: | 49 protected: |
| 48 MediaStreamUIProxy(RenderViewHostDelegate* test_render_delegate); | 50 MediaStreamUIProxy(RenderViewHostDelegate* test_render_delegate); |
| 49 | 51 |
| 50 private: | 52 private: |
| 51 class Core; | 53 class Core; |
| 52 friend class Core; | 54 friend class Core; |
| 53 friend class FakeMediaStreamUIProxy; | 55 friend class FakeMediaStreamUIProxy; |
| 54 | 56 |
| 55 void ProcessAccessRequestResponse(const MediaStreamDevices& devices); | 57 void ProcessAccessRequestResponse( |
| 58 const MediaStreamDevices& devices, |
| 59 content::MediaStreamRequestResult result); |
| 56 void ProcessStopRequestFromUI(); | 60 void ProcessStopRequestFromUI(); |
| 57 | 61 |
| 58 scoped_ptr<Core> core_; | 62 scoped_ptr<Core> core_; |
| 59 ResponseCallback response_callback_; | 63 ResponseCallback response_callback_; |
| 60 base::Closure stop_callback_; | 64 base::Closure stop_callback_; |
| 61 | 65 |
| 62 base::WeakPtrFactory<MediaStreamUIProxy> weak_factory_; | 66 base::WeakPtrFactory<MediaStreamUIProxy> weak_factory_; |
| 63 | 67 |
| 64 DISALLOW_COPY_AND_ASSIGN(MediaStreamUIProxy); | 68 DISALLOW_COPY_AND_ASSIGN(MediaStreamUIProxy); |
| 65 }; | 69 }; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 79 | 83 |
| 80 private: | 84 private: |
| 81 MediaStreamDevices devices_; | 85 MediaStreamDevices devices_; |
| 82 | 86 |
| 83 DISALLOW_COPY_AND_ASSIGN(FakeMediaStreamUIProxy); | 87 DISALLOW_COPY_AND_ASSIGN(FakeMediaStreamUIProxy); |
| 84 }; | 88 }; |
| 85 | 89 |
| 86 } // namespace content | 90 } // namespace content |
| 87 | 91 |
| 88 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_UI_PROXY_H_ | 92 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_UI_PROXY_H_ |
| OLD | NEW |