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_internals.h" | 5 #include "chrome/browser/media/media_internals.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/string16.h" | 8 #include "base/string16.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 10 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 96 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
97 media_devices_dispatcher_->VideoCaptureDevicesChanged(devices); | 97 media_devices_dispatcher_->VideoCaptureDevicesChanged(devices); |
98 } | 98 } |
99 | 99 |
100 void MediaInternals::OnMediaRequestStateChanged( | 100 void MediaInternals::OnMediaRequestStateChanged( |
101 int render_process_id, | 101 int render_process_id, |
102 int render_view_id, | 102 int render_view_id, |
103 const content::MediaStreamDevice& device, | 103 const content::MediaStreamDevice& device, |
104 content::MediaRequestState state) { | 104 content::MediaRequestState state) { |
105 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 105 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 106 |
106 if (observers_.size()) { | 107 if (observers_.size()) { |
107 FOR_EACH_OBSERVER(MediaInternalsObserver, observers_, | 108 FOR_EACH_OBSERVER( |
108 OnRequestUpdate(device, state)); | 109 MediaInternalsObserver, observers_, OnRequestUpdate(render_process_id, |
| 110 render_view_id, |
| 111 device, |
| 112 state)); |
109 } | 113 } |
110 } | 114 } |
111 | 115 |
112 void MediaInternals::AddObserver(MediaInternalsObserver* observer) { | 116 void MediaInternals::AddObserver(MediaInternalsObserver* observer) { |
113 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 117 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
114 observers_.AddObserver(observer); | 118 observers_.AddObserver(observer); |
115 } | 119 } |
116 | 120 |
117 void MediaInternals::RemoveObserver(MediaInternalsObserver* observer) { | 121 void MediaInternals::RemoveObserver(MediaInternalsObserver* observer) { |
118 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 122 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 171 |
168 void MediaInternals::SendUpdate(const std::string& function, Value* value) { | 172 void MediaInternals::SendUpdate(const std::string& function, Value* value) { |
169 // Only bother serializing the update to JSON if someone is watching. | 173 // Only bother serializing the update to JSON if someone is watching. |
170 if (observers_.size()) { | 174 if (observers_.size()) { |
171 std::vector<const Value*> args; | 175 std::vector<const Value*> args; |
172 args.push_back(value); | 176 args.push_back(value); |
173 string16 update = content::WebUI::GetJavascriptCall(function, args); | 177 string16 update = content::WebUI::GetJavascriptCall(function, args); |
174 FOR_EACH_OBSERVER(MediaInternalsObserver, observers_, OnUpdate(update)); | 178 FOR_EACH_OBSERVER(MediaInternalsObserver, observers_, OnUpdate(update)); |
175 } | 179 } |
176 } | 180 } |
OLD | NEW |