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

Side by Side Diff: chrome/browser/ui/webui/media_internals/media_internals_proxy.h

Issue 7272036: Make MediaInternalsUI talk to MediaInternals. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Splitting it all up. 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 #ifndef CHROME_BROWSER_UI_WEBUI_MEDIA_INTERNALS_MEDIA_INTERNALS_PROXY_H_
6 #define CHROME_BROWSER_UI_WEBUI_MEDIA_INTERNALS_MEDIA_INTERNALS_PROXY_H_
7 #pragma once
8
9 #include "base/string16.h"
10 #include "base/memory/ref_counted.h"
11 #include "chrome/browser/media/media_internals_observer.h"
12
13 class IOThread;
14 class MediaInternalsMessageHandler;
15
16 // This class is a proxy between MediaInternals (on the IO thread) and
17 // MediaInternalsMessageHandler (on the UI thread).
18 // It is ref_counted to ensure that it completes all pending Tasks on both
19 // threads before destruction.
20 class MediaInternalsProxy
21 : public MediaInternalsObserver,
22 public base::RefCountedThreadSafe<MediaInternalsProxy> {
23 public:
24 MediaInternalsProxy();
25
26 // Register a Handler and start receiving callbacks from MediaInternals.
27 void Attach(MediaInternalsMessageHandler* handler);
28
29 // Unregister the same and stop receiving callbacks.
30 void Detach();
31
32 // Have MediaInternals send all the data it has.
33 void GetEverything();
34
35 // MediaInternalsObserver implementation. Called on the IO thread.
36 virtual void OnUpdate(const string16& update);
37
38 private:
39 friend class base::RefCountedThreadSafe<MediaInternalsProxy>;
40 virtual ~MediaInternalsProxy();
41
42 void ObserveMediaInternalsOnIOThread();
43 void StopObservingMediaInternalsOnIOThread();
44 void GetEverythingOnIOThread();
45 void UpdateUIOnUIThread(const string16& update);
46
47 MediaInternalsMessageHandler* handler_;
48 IOThread* io_thread_;
49
50 DISALLOW_COPY_AND_ASSIGN(MediaInternalsProxy);
51 };
52
53 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_INTERNALS_MEDIA_INTERNALS_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698