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

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

Issue 7273089: Display active audio streams on chrome://media-internals. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Removing silliness. Created 9 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/resources/media_internals.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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"
11 #include "content/browser/browser_thread.h" 11 #include "content/browser/browser_thread.h"
12 #include "content/browser/webui/web_ui.h" 12 #include "content/browser/webui/web_ui.h"
13 13
14 // The names of the javascript functions to call with updates. 14 // The names of the javascript functions to call with updates.
15 static const char kDeleteItemFunction[] = "onItemDeleted"; 15 static const char kDeleteItemFunction[] = "media.onItemDeleted";
16 static const char kAudioUpdateFunction[] = "onAudioUpdate"; 16 static const char kAudioUpdateFunction[] = "media.addAudioStream";
17 static const char kSendEverythingFunction[] = "onReceiveEverything"; 17 static const char kSendEverythingFunction[] = "media.onReceiveEverything";
18 18
19 MediaInternals::~MediaInternals() {} 19 MediaInternals::~MediaInternals() {}
20 20
21 void MediaInternals::OnDeleteAudioStream(void* host, int stream_id) { 21 void MediaInternals::OnDeleteAudioStream(void* host, int stream_id) {
22 DCHECK(CalledOnValidThread()); 22 DCHECK(CalledOnValidThread());
23 std::string stream = base::StringPrintf("audio_streams.%p:%d", 23 std::string stream = base::StringPrintf("audio_streams.%p:%d",
24 host, stream_id); 24 host, stream_id);
25 DeleteItem(stream); 25 DeleteItem(stream);
26 } 26 }
27 27
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 void MediaInternals::SendUpdate(const std::string& function, Value* value) { 92 void MediaInternals::SendUpdate(const std::string& function, Value* value) {
93 // Only bother serializing the update to JSON if someone is watching. 93 // Only bother serializing the update to JSON if someone is watching.
94 if (observers_.size()) { 94 if (observers_.size()) {
95 std::vector<const Value*> args; 95 std::vector<const Value*> args;
96 args.push_back(value); 96 args.push_back(value);
97 string16 update = WebUI::GetJavascriptCall(function, args); 97 string16 update = WebUI::GetJavascriptCall(function, args);
98 FOR_EACH_OBSERVER(MediaInternalsObserver, observers_, OnUpdate(update)); 98 FOR_EACH_OBSERVER(MediaInternalsObserver, observers_, OnUpdate(update));
99 } 99 }
100 } 100 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/media_internals.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698