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 #include "content/browser/renderer_host/media/video_capture_host.h" | 5 #include "content/browser/renderer_host/media/video_capture_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "content/browser/renderer_host/media/media_stream_manager.h" | 10 #include "content/browser/renderer_host/media/media_stream_manager.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 // There are 5 states: | 31 // There are 5 states: |
32 // kStarting: host has requested a controller, but has not got it yet. | 32 // kStarting: host has requested a controller, but has not got it yet. |
33 // kStarted: host got a controller and has called StartCapture. | 33 // kStarted: host got a controller and has called StartCapture. |
34 // kStopping: renderer process requests StopCapture before host gets | 34 // kStopping: renderer process requests StopCapture before host gets |
35 // a controller. | 35 // a controller. |
36 // kStopped: host has called StopCapture. | 36 // kStopped: host has called StopCapture. |
37 // kError: an error occurred and capture is stopped consequently. | 37 // kError: an error occurred and capture is stopped consequently. |
38 video_capture::State state; | 38 video_capture::State state; |
39 }; | 39 }; |
40 | 40 |
41 VideoCaptureHost::VideoCaptureHost( | 41 VideoCaptureHost::VideoCaptureHost(content::ResourceContext* resource_context) |
42 const content::ResourceContext* resource_context) | |
43 : resource_context_(resource_context) { | 42 : resource_context_(resource_context) { |
44 } | 43 } |
45 | 44 |
46 VideoCaptureHost::~VideoCaptureHost() {} | 45 VideoCaptureHost::~VideoCaptureHost() {} |
47 | 46 |
48 void VideoCaptureHost::OnChannelClosing() { | 47 void VideoCaptureHost::OnChannelClosing() { |
49 BrowserMessageFilter::OnChannelClosing(); | 48 BrowserMessageFilter::OnChannelClosing(); |
50 | 49 |
51 // Since the IPC channel is gone, close all requested VideCaptureDevices. | 50 // Since the IPC channel is gone, close all requested VideCaptureDevices. |
52 for (EntryMap::iterator it = entries_.begin(); it != entries_.end(); it++) { | 51 for (EntryMap::iterator it = entries_.begin(); it != entries_.end(); it++) { |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 if (it->second->controller) { | 278 if (it->second->controller) { |
280 GetVideoCaptureManager()->RemoveController(it->second->controller, this); | 279 GetVideoCaptureManager()->RemoveController(it->second->controller, this); |
281 } | 280 } |
282 delete it->second; | 281 delete it->second; |
283 entries_.erase(id); | 282 entries_.erase(id); |
284 } | 283 } |
285 } | 284 } |
286 | 285 |
287 media_stream::VideoCaptureManager* VideoCaptureHost::GetVideoCaptureManager() { | 286 media_stream::VideoCaptureManager* VideoCaptureHost::GetVideoCaptureManager() { |
288 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 287 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
289 return resource_context_->media_stream_manager()->video_capture_manager(); | 288 return resource_context_->GetMediaStreamManager()->video_capture_manager(); |
290 } | 289 } |
OLD | NEW |