Index: chrome/browser/ui/webui/media_internals_proxy.h |
diff --git a/chrome/browser/ui/webui/media_internals_proxy.h b/chrome/browser/ui/webui/media_internals_proxy.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..083f08434d225d7c6a28f5c7ae9a9cdc1e8405be |
--- /dev/null |
+++ b/chrome/browser/ui/webui/media_internals_proxy.h |
@@ -0,0 +1,52 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_UI_WEBUI_MEDIA_INTERNALS_PROXY_H_ |
+#define CHROME_BROWSER_UI_WEBUI_MEDIA_INTERNALS_PROXY_H_ |
+#pragma once |
+ |
+#include "base/memory/ref_counted.h" |
+#include "base/string16.h" |
+#include "chrome/browser/media/media_internals_observer.h" |
+ |
+class IOThread; |
+class MediaInternalsUI; |
+ |
+// This class is a proxy between MediaInternals (on the IO thread) and |
+// MediaInternalsUI (on the UI thread). |
+// It is ref_counted to ensure that it completes all pending Tasks on both |
+// threads before destruction. |
+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
|
+ : public MediaInternalsObserver, |
+ public base::RefCountedThreadSafe<MediaInternalsProxy> { |
+ public: |
+ MediaInternalsProxy(); |
+ |
+ // Methods for MediaInternalsUI. Called on the UI thread. |
+ // Register a UI to receive callbacks from MediaInternals. |
+ 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.
|
+ // Unregister the same. |
+ void DetachUI(); |
+ // Have MediaInternals send all the data it has. |
+ void GetEverything(); |
+ |
+ // MediaInternalsObserver implementation. Called on the IO thread. |
+ virtual void OnUpdate(const string16& update); |
+ |
+ private: |
+ friend class base::RefCountedThreadSafe<MediaInternalsProxy>; |
+ virtual ~MediaInternalsProxy(); |
+ |
+ void ObserveMediaInternalsOnIOThread(); |
+ void StopObservingMediaInternalsOnIOThread(); |
+ void GetEverythingOnIOThread(); |
+ void UpdateUIOnUIThread(const string16& update); |
+ |
+ MediaInternalsUI* ui_; |
+ IOThread* io_thread_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(MediaInternalsProxy); |
+}; |
+ |
+#endif // CHROME_BROWSER_UI_WEBUI_MEDIA_INTERNALS_PROXY_H_ |