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

Unified Diff: chrome/browser/media/media_stream_capture_indicator.cc

Issue 10829190: Resolve the problems where we can leak the system tray UI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed testbots. Created 8 years, 4 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
« no previous file with comments | « no previous file | content/browser/renderer_host/media/media_stream_device_settings.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/media/media_stream_capture_indicator.cc
diff --git a/chrome/browser/media/media_stream_capture_indicator.cc b/chrome/browser/media/media_stream_capture_indicator.cc
index 68d56432d159b180f53138cd8b54fd3233c8925e..88e1a38ee79e0aa165fbaf94178e31e6a1168d21 100644
--- a/chrome/browser/media/media_stream_capture_indicator.cc
+++ b/chrome/browser/media/media_stream_capture_indicator.cc
@@ -214,7 +214,6 @@ void MediaStreamCaptureIndicator::DoDevicesClosedOnUIThread(
if (!status_icon_)
return;
- DCHECK(!tabs_.empty());
RemoveCaptureDeviceTab(render_process_id, render_view_id, devices);
}
@@ -307,6 +306,7 @@ void MediaStreamCaptureIndicator::OnImageLoaded(
void MediaStreamCaptureIndicator::Hide() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK(tabs_.empty());
if (!status_icon_)
return;
@@ -332,9 +332,11 @@ void MediaStreamCaptureIndicator::UpdateStatusTrayIconContextMenu() {
iter != tabs_.end(); ++iter) {
string16 tab_title = GetTitle(iter->render_process_id,
iter->render_view_id);
- // The tab has gone away.
- if (tab_title.empty())
+ if (tab_title.empty()) {
+ // Delete the entry since the tab has gone away.
+ tabs_.erase(iter);
continue;
+ }
// Check if any audio and video devices have been used.
audio = audio || iter->audio_ref_count > 0;
@@ -351,9 +353,10 @@ void MediaStreamCaptureIndicator::UpdateStatusTrayIconContextMenu() {
++command_id;
}
- // All the tabs have gone away.
- if (!audio && !video)
+ if (!audio && !video) {
+ Hide();
return;
+ }
// The icon will take the ownership of the passed context menu.
status_icon_->SetContextMenu(menu.release());
@@ -439,9 +442,6 @@ void MediaStreamCaptureIndicator::RemoveCaptureDeviceTab(
if (iter->audio_ref_count == 0 && iter->video_ref_count == 0)
tabs_.erase(iter);
- if (tabs_.empty())
- Hide();
- else
- UpdateStatusTrayIconContextMenu();
+ UpdateStatusTrayIconContextMenu();
}
« no previous file with comments | « no previous file | content/browser/renderer_host/media/media_stream_device_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698