OLD | NEW |
---|---|
(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_PROXY_H_ | |
6 #define CHROME_BROWSER_UI_WEBUI_MEDIA_INTERNALS_PROXY_H_ | |
7 #pragma once | |
8 | |
9 #include "base/memory/ref_counted.h" | |
10 #include "base/string16.h" | |
11 #include "chrome/browser/media/media_internals_observer.h" | |
12 | |
13 class IOThread; | |
14 class MediaInternalsUI; | |
15 | |
16 // This class is a proxy between MediaInternals (on the IO thread) and | |
17 // MediaInternalsUI (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 | |
Evan Stade
2011/06/29 20:13:01
seems this class should be a WebUIMessageHandler (
Scott Franklin
2011/06/29 23:47:08
As far as I can see, all of those still have proxi
Evan Stade
2011/06/30 22:24:27
Most chrome:// pages have handlers but not dedicat
| |
21 : public MediaInternalsObserver, | |
22 public base::RefCountedThreadSafe<MediaInternalsProxy> { | |
23 public: | |
24 MediaInternalsProxy(); | |
25 | |
26 // Methods for MediaInternalsUI. Called on the UI thread. | |
27 // Register a UI to receive callbacks from MediaInternals. | |
28 void AttachUI(MediaInternalsUI* ui); | |
scherkus (not reviewing)
2011/06/29 18:49:32
pedantic nit: space out these methods w/ one blank
Scott Franklin
2011/06/29 23:47:08
Done.
| |
29 // Unregister the same. | |
30 void DetachUI(); | |
31 // Have MediaInternals send all the data it has. | |
32 void GetEverything(); | |
33 | |
34 // MediaInternalsObserver implementation. Called on the IO thread. | |
35 virtual void OnUpdate(const string16& update); | |
36 | |
37 private: | |
38 friend class base::RefCountedThreadSafe<MediaInternalsProxy>; | |
39 virtual ~MediaInternalsProxy(); | |
40 | |
41 void ObserveMediaInternalsOnIOThread(); | |
42 void StopObservingMediaInternalsOnIOThread(); | |
43 void GetEverythingOnIOThread(); | |
44 void UpdateUIOnUIThread(const string16& update); | |
45 | |
46 MediaInternalsUI* ui_; | |
47 IOThread* io_thread_; | |
48 | |
49 DISALLOW_COPY_AND_ASSIGN(MediaInternalsProxy); | |
50 }; | |
51 | |
52 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_INTERNALS_PROXY_H_ | |
OLD | NEW |