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

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

Issue 11451006: Make TabCapture requests use the target render process and render view id's for UI permissions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 8 years 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_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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698