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

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

Issue 7566054: Revert 95542 - Plumb media data from renderers up to MediaInternals in the browser process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 4 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) 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 #include "media/base/media_log_event.h"
14 13
15 // The names of the javascript functions to call with updates. 14 // The names of the javascript functions to call with updates.
16 static const char kDeleteItemFunction[] = "media.onItemDeleted"; 15 static const char kDeleteItemFunction[] = "media.onItemDeleted";
17 static const char kAudioUpdateFunction[] = "media.addAudioStream"; 16 static const char kAudioUpdateFunction[] = "media.addAudioStream";
18 static const char kSendEverythingFunction[] = "media.onReceiveEverything"; 17 static const char kSendEverythingFunction[] = "media.onReceiveEverything";
19 18
20 MediaInternals::~MediaInternals() {} 19 MediaInternals::~MediaInternals() {}
21 20
22 void MediaInternals::OnDeleteAudioStream(void* host, int stream_id) { 21 void MediaInternals::OnDeleteAudioStream(void* host, int stream_id) {
23 DCHECK(CalledOnValidThread()); 22 DCHECK(CalledOnValidThread());
(...skipping 16 matching lines...) Expand all
40 "status", Value::CreateStringValue(status)); 39 "status", Value::CreateStringValue(status));
41 } 40 }
42 41
43 void MediaInternals::OnSetAudioStreamVolume( 42 void MediaInternals::OnSetAudioStreamVolume(
44 void* host, int stream_id, double volume) { 43 void* host, int stream_id, double volume) {
45 DCHECK(CalledOnValidThread()); 44 DCHECK(CalledOnValidThread());
46 UpdateAudioStream(host, stream_id, 45 UpdateAudioStream(host, stream_id,
47 "volume", Value::CreateDoubleValue(volume)); 46 "volume", Value::CreateDoubleValue(volume));
48 } 47 }
49 48
50 void MediaInternals::OnMediaEvent(
51 int render_process_id, const media::MediaLogEvent& event) {
52 DCHECK(CalledOnValidThread());
53 // TODO(scottfr): Handle |event|. Record status information in data_ and pass
54 // |event| along to observers.
55 }
56
57 void MediaInternals::AddObserver(MediaInternalsObserver* observer) { 49 void MediaInternals::AddObserver(MediaInternalsObserver* observer) {
58 DCHECK(CalledOnValidThread()); 50 DCHECK(CalledOnValidThread());
59 observers_.AddObserver(observer); 51 observers_.AddObserver(observer);
60 } 52 }
61 53
62 void MediaInternals::RemoveObserver(MediaInternalsObserver* observer) { 54 void MediaInternals::RemoveObserver(MediaInternalsObserver* observer) {
63 DCHECK(CalledOnValidThread()); 55 DCHECK(CalledOnValidThread());
64 observers_.RemoveObserver(observer); 56 observers_.RemoveObserver(observer);
65 } 57 }
66 58
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 91
100 void MediaInternals::SendUpdate(const std::string& function, Value* value) { 92 void MediaInternals::SendUpdate(const std::string& function, Value* value) {
101 // Only bother serializing the update to JSON if someone is watching. 93 // Only bother serializing the update to JSON if someone is watching.
102 if (observers_.size()) { 94 if (observers_.size()) {
103 std::vector<const Value*> args; 95 std::vector<const Value*> args;
104 args.push_back(value); 96 args.push_back(value);
105 string16 update = WebUI::GetJavascriptCall(function, args); 97 string16 update = WebUI::GetJavascriptCall(function, args);
106 FOR_EACH_OBSERVER(MediaInternalsObserver, observers_, OnUpdate(update)); 98 FOR_EACH_OBSERVER(MediaInternalsObserver, observers_, OnUpdate(update));
107 } 99 }
108 } 100 }
OLDNEW
« no previous file with comments | « chrome/browser/media/media_internals.h ('k') | content/browser/renderer_host/media/media_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698