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

Side by Side Diff: chrome/browser/media/media_stream_capture_indicator.cc

Issue 10831370: quick fix to a crash when closing down the browser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: quick fix the a crash 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 } 324 }
325 325
326 void MediaStreamCaptureIndicator::UpdateStatusTrayIconContextMenu() { 326 void MediaStreamCaptureIndicator::UpdateStatusTrayIconContextMenu() {
327 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 327 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
328 scoped_ptr<ui::SimpleMenuModel> menu(new ui::SimpleMenuModel(this)); 328 scoped_ptr<ui::SimpleMenuModel> menu(new ui::SimpleMenuModel(this));
329 329
330 bool audio = false; 330 bool audio = false;
331 bool video = false; 331 bool video = false;
332 int command_id = IDC_MEDIA_CONTEXT_MEDIA_STREAM_CAPTURE_LIST_FIRST; 332 int command_id = IDC_MEDIA_CONTEXT_MEDIA_STREAM_CAPTURE_LIST_FIRST;
333 for (CaptureDeviceTabs::iterator iter = tabs_.begin(); 333 for (CaptureDeviceTabs::iterator iter = tabs_.begin();
334 iter != tabs_.end(); ++iter) { 334 iter != tabs_.end();) {
335 string16 tab_title = GetTitle(iter->render_process_id, 335 string16 tab_title = GetTitle(iter->render_process_id,
336 iter->render_view_id); 336 iter->render_view_id);
337 if (tab_title.empty()) { 337 if (tab_title.empty()) {
338 // Delete the entry since the tab has gone away. 338 // Delete the entry since the tab has gone away.
339 tabs_.erase(iter); 339 iter = tabs_.erase(iter);
340 continue; 340 continue;
341 } 341 }
342 342
343 // Check if any audio and video devices have been used. 343 // Check if any audio and video devices have been used.
344 audio = audio || iter->audio_ref_count > 0; 344 audio = audio || iter->audio_ref_count > 0;
345 video = video || iter->video_ref_count > 0; 345 video = video || iter->video_ref_count > 0;
346 346
347 string16 message = l10n_util::GetStringFUTF16( 347 string16 message = l10n_util::GetStringFUTF16(
348 IDS_MEDIA_STREAM_STATUS_TRAY_MENU_ITEM, tab_title); 348 IDS_MEDIA_STREAM_STATUS_TRAY_MENU_ITEM, tab_title);
349 menu->AddItem(command_id, message); 349 menu->AddItem(command_id, message);
350 350
351 // If reaching the maximum number, no more item will be added to the menu. 351 // If reaching the maximum number, no more item will be added to the menu.
352 if (command_id == IDC_MEDIA_CONTEXT_MEDIA_STREAM_CAPTURE_LIST_LAST) 352 if (command_id == IDC_MEDIA_CONTEXT_MEDIA_STREAM_CAPTURE_LIST_LAST)
353 break; 353 break;
354 354
355 ++command_id; 355 ++command_id;
356 ++iter;
356 } 357 }
357 358
358 if (!audio && !video) { 359 if (!audio && !video) {
359 Hide(); 360 Hide();
360 return; 361 return;
361 } 362 }
362 363
363 // The icon will take the ownership of the passed context menu. 364 // The icon will take the ownership of the passed context menu.
364 status_icon_->SetContextMenu(menu.release()); 365 status_icon_->SetContextMenu(menu.release());
365 UpdateStatusTrayIconDisplay(audio, video); 366 UpdateStatusTrayIconDisplay(audio, video);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 450
450 void MediaStreamCaptureIndicator::EnsureImageLoadingTracker() { 451 void MediaStreamCaptureIndicator::EnsureImageLoadingTracker() {
451 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 452 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
452 if (tracker_.get()) 453 if (tracker_.get())
453 return; 454 return;
454 455
455 tracker_.reset(new ImageLoadingTracker(this)); 456 tracker_.reset(new ImageLoadingTracker(this));
456 pending_messages_.clear(); 457 pending_messages_.clear();
457 request_index_ = 0; 458 request_index_ = 0;
458 } 459 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698