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

Unified Diff: chrome/browser/ui/webui/media_internals_proxy.h

Issue 7272036: Make MediaInternalsUI talk to MediaInternals. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Responding to comments Created 9 years, 6 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 side-by-side diff with in-line comments
Download patch
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_
« no previous file with comments | « no previous file | chrome/browser/ui/webui/media_internals_proxy.cc » ('j') | chrome/browser/ui/webui/media_internals_ui.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698