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

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

Issue 10928043: Media Related changes for TabCapture API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes Created 8 years, 2 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
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_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_internals_observer.h" 10 #include "chrome/browser/media/media_internals_observer.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 void MediaInternals::OnCaptureDevicesClosed( 79 void MediaInternals::OnCaptureDevicesClosed(
80 int render_process_id, 80 int render_process_id,
81 int render_view_id, 81 int render_view_id,
82 const content::MediaStreamDevices& devices) { 82 const content::MediaStreamDevices& devices) {
83 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 83 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
84 media_stream_capture_indicator_->CaptureDevicesClosed(render_process_id, 84 media_stream_capture_indicator_->CaptureDevicesClosed(render_process_id,
85 render_view_id, 85 render_view_id,
86 devices); 86 devices);
87 } 87 }
88 88
89 void MediaInternals::OnMediaRequestStateChanged(
90 int render_process_id,
91 int render_view_id,
92 const content::MediaStreamDevice& device,
93 const content::MediaStreamRequest::RequestState state) {
94 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
95 if (observers_.size()) {
96 FOR_EACH_OBSERVER(MediaInternalsObserver, observers_,
97 OnRequestUpdate(device, state));
98 }
99 }
100
89 void MediaInternals::AddObserver(MediaInternalsObserver* observer) { 101 void MediaInternals::AddObserver(MediaInternalsObserver* observer) {
90 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 102 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
91 observers_.AddObserver(observer); 103 observers_.AddObserver(observer);
92 } 104 }
93 105
94 void MediaInternals::RemoveObserver(MediaInternalsObserver* observer) { 106 void MediaInternals::RemoveObserver(MediaInternalsObserver* observer) {
95 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 107 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
96 observers_.RemoveObserver(observer); 108 observers_.RemoveObserver(observer);
97 } 109 }
98 110
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 143
132 void MediaInternals::SendUpdate(const std::string& function, Value* value) { 144 void MediaInternals::SendUpdate(const std::string& function, Value* value) {
133 // Only bother serializing the update to JSON if someone is watching. 145 // Only bother serializing the update to JSON if someone is watching.
134 if (observers_.size()) { 146 if (observers_.size()) {
135 std::vector<const Value*> args; 147 std::vector<const Value*> args;
136 args.push_back(value); 148 args.push_back(value);
137 string16 update = content::WebUI::GetJavascriptCall(function, args); 149 string16 update = content::WebUI::GetJavascriptCall(function, args);
138 FOR_EACH_OBSERVER(MediaInternalsObserver, observers_, OnUpdate(update)); 150 FOR_EACH_OBSERVER(MediaInternalsObserver, observers_, OnUpdate(update));
139 } 151 }
140 } 152 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698