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/audio_stream_indicator.h" | 5 #include "chrome/browser/media/audio_stream_indicator.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "chrome/browser/tab_contents/tab_util.h" | 8 #include "chrome/browser/tab_contents/tab_util.h" |
9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
10 #include "content/public/browser/invalidate_type.h" | 10 #include "content/public/browser/invalidate_type.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 int render_view_id, | 57 int render_view_id, |
58 int stream_id, | 58 int stream_id, |
59 bool playing) { | 59 bool playing) { |
60 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 60 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
61 RenderViewId id(render_process_id, render_view_id); | 61 RenderViewId id(render_process_id, render_view_id); |
62 if (playing) { | 62 if (playing) { |
63 audio_streams_[id].insert(stream_id); | 63 audio_streams_[id].insert(stream_id); |
64 } else { | 64 } else { |
65 std::map<RenderViewId, std::set<int> >::iterator it = | 65 std::map<RenderViewId, std::set<int> >::iterator it = |
66 audio_streams_.find(id); | 66 audio_streams_.find(id); |
67 if (it != audio_streams_.end()) | 67 if (it == audio_streams_.end()) |
68 return; | 68 return; |
69 | 69 |
70 it->second.erase(stream_id); | 70 it->second.erase(stream_id); |
71 if (it->second.empty()) | 71 if (it->second.empty()) |
72 audio_streams_.erase(it); | 72 audio_streams_.erase(it); |
73 } | 73 } |
74 | 74 |
75 WebContents* web_contents = tab_util::GetWebContentsByID(render_process_id, | 75 WebContents* web_contents = tab_util::GetWebContentsByID(render_process_id, |
76 render_view_id); | 76 render_view_id); |
77 if (web_contents) | 77 if (web_contents) |
78 web_contents->NotifyNavigationStateChanged(content::INVALIDATE_TYPE_TAB); | 78 web_contents->NotifyNavigationStateChanged(content::INVALIDATE_TYPE_TAB); |
79 } | 79 } |
OLD | NEW |