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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 } | 468 } |
469 | 469 |
470 DCHECK_GE(iter->audio_ref_count, 0); | 470 DCHECK_GE(iter->audio_ref_count, 0); |
471 DCHECK_GE(iter->video_ref_count, 0); | 471 DCHECK_GE(iter->video_ref_count, 0); |
472 } | 472 } |
473 | 473 |
474 // Remove the tab if all the devices have been closed. | 474 // Remove the tab if all the devices have been closed. |
475 if (iter->audio_ref_count == 0 && iter->video_ref_count == 0 && | 475 if (iter->audio_ref_count == 0 && iter->video_ref_count == 0 && |
476 iter->tab_capture_ref_count == 0) | 476 iter->tab_capture_ref_count == 0) |
477 tabs_.erase(iter); | 477 tabs_.erase(iter); |
| 478 |
| 479 // Notify the cached web_contents if the render view has changed. We expect |
| 480 // that it is still valid since we get a capture indicator removed event |
| 481 // before the web_contents is destroyed. |
| 482 if (!web_contents && iter->web_contents) |
| 483 web_contents = iter->web_contents; |
478 } | 484 } |
479 | 485 |
480 if (web_contents) | 486 if (web_contents) |
481 web_contents->NotifyNavigationStateChanged(content::INVALIDATE_TYPE_TAB); | 487 web_contents->NotifyNavigationStateChanged(content::INVALIDATE_TYPE_TAB); |
482 | 488 |
483 if (!status_icon_) | 489 if (!status_icon_) |
484 return; | 490 return; |
485 | 491 |
486 UpdateStatusTrayIconContextMenu(); | 492 UpdateStatusTrayIconContextMenu(); |
487 } | 493 } |
(...skipping 24 matching lines...) Expand all Loading... |
512 return false; | 518 return false; |
513 | 519 |
514 CaptureDeviceTabs::const_iterator iter = std::find_if( | 520 CaptureDeviceTabs::const_iterator iter = std::find_if( |
515 tabs_.begin(), tabs_.end(), TabEquals(web_contents, | 521 tabs_.begin(), tabs_.end(), TabEquals(web_contents, |
516 render_process_id, | 522 render_process_id, |
517 render_view_id)); | 523 render_view_id)); |
518 if (iter == tabs_.end()) | 524 if (iter == tabs_.end()) |
519 return false; | 525 return false; |
520 return (iter->tab_capture_ref_count > 0); | 526 return (iter->tab_capture_ref_count > 0); |
521 } | 527 } |
OLD | NEW |