OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/media/media_stream_capture_indicator.h" | 5 #include "chrome/browser/media/media_stream_capture_indicator.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
416 UpdateStatusTrayIconContextMenu(); | 416 UpdateStatusTrayIconContextMenu(); |
417 | 417 |
418 ShowBalloon(render_process_id, render_view_id, audio, video); | 418 ShowBalloon(render_process_id, render_view_id, audio, video); |
419 } | 419 } |
420 | 420 |
421 void MediaStreamCaptureIndicator::RemoveCaptureDeviceTab( | 421 void MediaStreamCaptureIndicator::RemoveCaptureDeviceTab( |
422 int render_process_id, | 422 int render_process_id, |
423 int render_view_id, | 423 int render_view_id, |
424 const content::MediaStreamDevices& devices) { | 424 const content::MediaStreamDevices& devices) { |
425 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 425 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
426 | |
427 CaptureDeviceTabs::iterator iter = std::find_if( | 426 CaptureDeviceTabs::iterator iter = std::find_if( |
428 tabs_.begin(), tabs_.end(), TabEquals(render_process_id, render_view_id)); | 427 tabs_.begin(), tabs_.end(), TabEquals(render_process_id, render_view_id)); |
429 DCHECK(iter != tabs_.end()); | |
430 | 428 |
431 content::MediaStreamDevices::const_iterator dev = devices.begin(); | 429 if (iter != tabs_.end()) { |
Ami GONE FROM CHROMIUM
2012/08/24 17:57:57
Do you understand how it can happen that this is =
no longer working on chromium
2012/08/24 18:09:58
Yes. This happens when we have multiple tabs using
| |
432 for (; dev != devices.end(); ++dev) { | 430 content::MediaStreamDevices::const_iterator dev = devices.begin(); |
433 DCHECK(dev->type == content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE || | 431 for (; dev != devices.end(); ++dev) { |
434 dev->type == content::MEDIA_STREAM_DEVICE_TYPE_VIDEO_CAPTURE); | 432 DCHECK(dev->type == content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE || |
435 if (dev->type == content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE) | 433 dev->type == content::MEDIA_STREAM_DEVICE_TYPE_VIDEO_CAPTURE); |
436 --iter->audio_ref_count; | 434 if (dev->type == content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE) |
437 else | 435 --iter->audio_ref_count; |
438 --iter->video_ref_count; | 436 else |
437 --iter->video_ref_count; | |
439 | 438 |
440 DCHECK_GE(iter->audio_ref_count, 0); | 439 DCHECK_GE(iter->audio_ref_count, 0); |
441 DCHECK_GE(iter->video_ref_count, 0); | 440 DCHECK_GE(iter->video_ref_count, 0); |
441 } | |
442 | |
443 // Remove the tab if all the devices have been closed. | |
444 if (iter->audio_ref_count == 0 && iter->video_ref_count == 0) | |
445 tabs_.erase(iter); | |
442 } | 446 } |
443 | 447 |
444 // Remove the tab if all the devices have been closed. | |
445 if (iter->audio_ref_count == 0 && iter->video_ref_count == 0) | |
446 tabs_.erase(iter); | |
447 | |
448 UpdateStatusTrayIconContextMenu(); | 448 UpdateStatusTrayIconContextMenu(); |
Ami GONE FROM CHROMIUM
2012/08/24 17:57:57
Do you want to do this even if iter==tabs_.end() (
no longer working on chromium
2012/08/24 18:09:58
Good question, I think both ways work the same. Bu
Ami GONE FROM CHROMIUM
2012/08/24 18:21:41
I don't know the code to make a call. It's up to
| |
449 } | 449 } |
450 | 450 |
451 void MediaStreamCaptureIndicator::EnsureImageLoadingTracker() { | 451 void MediaStreamCaptureIndicator::EnsureImageLoadingTracker() { |
452 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 452 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
453 if (tracker_.get()) | 453 if (tracker_.get()) |
454 return; | 454 return; |
455 | 455 |
456 tracker_.reset(new ImageLoadingTracker(this)); | 456 tracker_.reset(new ImageLoadingTracker(this)); |
457 pending_messages_.clear(); | 457 pending_messages_.clear(); |
458 request_index_ = 0; | 458 request_index_ = 0; |
459 } | 459 } |
OLD | NEW |