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

Side by Side Diff: chrome/browser/ui/webui/media_internals_proxy.cc

Issue 7272036: Make MediaInternalsUI talk to MediaInternals. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Moving MediaInternalsProxy to its own file. 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/webui/media_internals_proxy.h"
6
7 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/io_thread.h"
9 #include "chrome/browser/media/media_internals.h"
10 #include "chrome/browser/ui/webui/media_internals_ui.h"
11
12 MediaInternalsProxy::MediaInternalsProxy() {
13 io_thread_ = g_browser_process->io_thread();
14 };
scherkus (not reviewing) 2011/06/29 17:55:12 remove ;
Scott Franklin 2011/06/29 18:44:33 Done.
15
16 void MediaInternalsProxy::SetUI(MediaInternalsUI* ui) {
17 ui_ = ui;
scherkus (not reviewing) 2011/06/29 17:55:12 since these are public methods add DCHECK for bein
Scott Franklin 2011/06/29 18:44:33 Done.
18 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
19 NewRunnableMethod(this,
20 &MediaInternalsProxy::ObserveMediaInternalsOnIOThread));
21 };
scherkus (not reviewing) 2011/06/29 17:55:12 remove ;
Scott Franklin 2011/06/29 18:44:33 Done.
22
23 void MediaInternalsProxy::RemoveUI() {
24 ui_ = NULL;
scherkus (not reviewing) 2011/06/29 17:55:12 ditto
Scott Franklin 2011/06/29 18:44:33 Done.
25 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
26 NewRunnableMethod(this,
27 &MediaInternalsProxy::StopObservingMediaInternalsOnIOThread));
28 }
29
30 void MediaInternalsProxy::GetEverything() {
31 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
32 NewRunnableMethod(this, &MediaInternalsProxy::GetEverythingOnIOThread));
33 }
34
35 void MediaInternalsProxy::OnUpdate(const string16& update) {
36 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
37 NewRunnableMethod(this,
38 &MediaInternalsProxy::UpdateUIOnUIThread, update));
39 }
40
41 MediaInternalsProxy::~MediaInternalsProxy() {}
42
43 void MediaInternalsProxy::ObserveMediaInternalsOnIOThread() {
44 io_thread_->globals()->media.media_internals->AddUI(this);
45 }
46
47 void MediaInternalsProxy::StopObservingMediaInternalsOnIOThread() {
48 io_thread_->globals()->media.media_internals->RemoveUI(this);
49 }
50
51 void MediaInternalsProxy::GetEverythingOnIOThread() {
52 io_thread_->globals()->media.media_internals->SendEverything();
53 }
54
55 void MediaInternalsProxy::UpdateUIOnUIThread(const string16& update) {
56 // Don't forward updates to a destructed UI.
57 if (ui_)
58 ui_->OnUpdate(update);
59 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698