Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1361)

Unified Diff: content/browser/renderer_host/media/video_capture_manager.cc

Issue 248113003: Fix for closing the desktop sharing notification bar when the shared window is closed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments and add a test Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/media/video_capture_manager.cc
diff --git a/content/browser/renderer_host/media/video_capture_manager.cc b/content/browser/renderer_host/media/video_capture_manager.cc
index a7cca9c22665fb08cd80f97f94c23d3908098d92..df56e0196a3270d83d3a9801cbf5364057a33af0 100644
--- a/content/browser/renderer_host/media/video_capture_manager.cc
+++ b/content/browser/renderer_host/media/video_capture_manager.cc
@@ -160,8 +160,7 @@ void VideoCaptureManager::Close(int capture_session_id) {
DCHECK(listener_);
DVLOG(1) << "VideoCaptureManager::Close, id " << capture_session_id;
- std::map<media::VideoCaptureSessionId, MediaStreamDevice>::iterator
- session_it = sessions_.find(capture_session_id);
+ SessionMap::iterator session_it = sessions_.find(capture_session_id);
if (session_it == sessions_.end()) {
NOTREACHED();
return;
@@ -312,7 +311,8 @@ void VideoCaptureManager::StartCaptureForClient(
void VideoCaptureManager::StopCaptureForClient(
VideoCaptureController* controller,
VideoCaptureControllerID client_id,
- VideoCaptureControllerEventHandler* client_handler) {
+ VideoCaptureControllerEventHandler* client_handler,
+ bool aborted_due_to_error) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
DCHECK(controller);
DCHECK(client_handler);
@@ -322,6 +322,16 @@ void VideoCaptureManager::StopCaptureForClient(
NOTREACHED();
return;
}
+ if (aborted_due_to_error) {
+ SessionMap::iterator it;
+ for (it = sessions_.begin(); it != sessions_.end(); ++it) {
+ if (it->second.type == entry->stream_type &&
+ it->second.id == entry->id) {
+ listener_->Aborted(it->second.type, it->first);
+ break;
+ }
+ }
+ }
// Detach client from controller.
media::VideoCaptureSessionId session_id =
@@ -339,8 +349,7 @@ bool VideoCaptureManager::GetDeviceSupportedFormats(
DCHECK_CURRENTLY_ON(BrowserThread::IO);
DCHECK(supported_formats->empty());
- std::map<media::VideoCaptureSessionId, MediaStreamDevice>::iterator it =
- sessions_.find(capture_session_id);
+ SessionMap::iterator it = sessions_.find(capture_session_id);
if (it == sessions_.end())
return false;
DVLOG(1) << "GetDeviceSupportedFormats for device: " << it->second.name;
@@ -359,8 +368,7 @@ bool VideoCaptureManager::GetDeviceFormatsInUse(
DCHECK_CURRENTLY_ON(BrowserThread::IO);
DCHECK(formats_in_use->empty());
- std::map<media::VideoCaptureSessionId, MediaStreamDevice>::iterator it =
- sessions_.find(capture_session_id);
+ SessionMap::iterator it = sessions_.find(capture_session_id);
if (it == sessions_.end())
return false;
DVLOG(1) << "GetDeviceFormatsInUse for device: " << it->second.name;
@@ -380,8 +388,7 @@ void VideoCaptureManager::SetDesktopCaptureWindowId(
media::VideoCaptureSessionId session_id,
gfx::NativeViewId window_id) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
- std::map<media::VideoCaptureSessionId, MediaStreamDevice>::iterator
- session_it = sessions_.find(session_id);
+ SessionMap::iterator session_it = sessions_.find(session_id);
if (session_it == sessions_.end()) {
device_task_runner_->PostTask(
FROM_HERE,
@@ -567,9 +574,9 @@ VideoCaptureManager::GetDeviceEntryForMediaStreamDevice(
VideoCaptureManager::DeviceEntry*
VideoCaptureManager::GetDeviceEntryForController(
- const VideoCaptureController* controller) {
+ const VideoCaptureController* controller) const {
// Look up |controller| in |devices_|.
- for (DeviceEntries::iterator it = devices_.begin();
+ for (DeviceEntries::const_iterator it = devices_.begin();
it != devices_.end(); ++it) {
if ((*it)->video_capture_controller.get() == controller) {
return *it;
@@ -602,8 +609,7 @@ VideoCaptureManager::DeviceEntry* VideoCaptureManager::GetOrCreateDeviceEntry(
media::VideoCaptureSessionId capture_session_id) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
- std::map<media::VideoCaptureSessionId, MediaStreamDevice>::iterator
- session_it = sessions_.find(capture_session_id);
+ SessionMap::iterator session_it = sessions_.find(capture_session_id);
if (session_it == sessions_.end()) {
return NULL;
}

Powered by Google App Engine
This is Rietveld 408576698