OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // VideoCaptureHost serves video capture related messages from | 5 // VideoCaptureHost serves video capture related messages from |
6 // VideCaptureMessageFilter which lives inside the render process. | 6 // VideCaptureMessageFilter which lives inside the render process. |
7 // | 7 // |
8 // This class is owned by BrowserRenderProcessHost, and instantiated on UI | 8 // This class is owned by BrowserRenderProcessHost, and instantiated on UI |
9 // thread, but all other operations and method calls happen on IO thread. | 9 // thread, but all other operations and method calls happen on IO thread. |
10 // | 10 // |
(...skipping 25 matching lines...) Expand all Loading... |
36 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_ | 36 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_ |
37 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_ | 37 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_ |
38 | 38 |
39 #include <map> | 39 #include <map> |
40 | 40 |
41 #include "base/memory/ref_counted.h" | 41 #include "base/memory/ref_counted.h" |
42 #include "content/browser/browser_message_filter.h" | 42 #include "content/browser/browser_message_filter.h" |
43 #include "content/browser/renderer_host/media/video_capture_controller.h" | 43 #include "content/browser/renderer_host/media/video_capture_controller.h" |
44 #include "ipc/ipc_message.h" | 44 #include "ipc/ipc_message.h" |
45 | 45 |
| 46 namespace content { |
| 47 class ResourceContext; |
| 48 } // namespace content |
| 49 |
46 class VideoCaptureHost | 50 class VideoCaptureHost |
47 : public BrowserMessageFilter, | 51 : public BrowserMessageFilter, |
48 public VideoCaptureControllerEventHandler { | 52 public VideoCaptureControllerEventHandler { |
49 public: | 53 public: |
50 VideoCaptureHost(); | 54 explicit VideoCaptureHost(const content::ResourceContext* resource_context); |
51 | 55 |
52 // BrowserMessageFilter implementation. | 56 // BrowserMessageFilter implementation. |
53 virtual void OnChannelClosing(); | 57 virtual void OnChannelClosing(); |
54 virtual void OnDestruct() const; | 58 virtual void OnDestruct() const; |
55 virtual bool OnMessageReceived(const IPC::Message& message, | 59 virtual bool OnMessageReceived(const IPC::Message& message, |
56 bool* message_was_ok); | 60 bool* message_was_ok); |
57 | 61 |
58 // VideoCaptureControllerEventHandler implementation. | 62 // VideoCaptureControllerEventHandler implementation. |
59 virtual void OnError(const VideoCaptureControllerID& id); | 63 virtual void OnError(const VideoCaptureControllerID& id); |
60 virtual void OnBufferCreated(const VideoCaptureControllerID& id, | 64 virtual void OnBufferCreated(const VideoCaptureControllerID& id, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 // Handle error coming from VideoCaptureDevice. | 124 // Handle error coming from VideoCaptureDevice. |
121 void DoHandleError(int device_id); | 125 void DoHandleError(int device_id); |
122 | 126 |
123 typedef std::map<VideoCaptureControllerID, | 127 typedef std::map<VideoCaptureControllerID, |
124 scoped_refptr<VideoCaptureController> >EntryMap; | 128 scoped_refptr<VideoCaptureController> >EntryMap; |
125 | 129 |
126 // A map of VideoCaptureControllerID to VideoCaptureController | 130 // A map of VideoCaptureControllerID to VideoCaptureController |
127 // objects that is currently active. | 131 // objects that is currently active. |
128 EntryMap entries_; | 132 EntryMap entries_; |
129 | 133 |
| 134 // Used to get a pointer to VideoCaptureManager to start/stop capture devices. |
| 135 const content::ResourceContext* resource_context_; |
| 136 |
130 DISALLOW_COPY_AND_ASSIGN(VideoCaptureHost); | 137 DISALLOW_COPY_AND_ASSIGN(VideoCaptureHost); |
131 }; | 138 }; |
132 | 139 |
133 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_ | 140 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_ |
OLD | NEW |