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

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

Issue 11876007: Connecting webrtc-internals WebUI frontend with the backend (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@main
Patch Set: Created 7 years, 11 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/webrtc_internals_proxy.h
diff --git a/chrome/browser/ui/webui/webrtc_internals_proxy.h b/chrome/browser/ui/webui/webrtc_internals_proxy.h
new file mode 100644
index 0000000000000000000000000000000000000000..5692db2558b7028578ad4437178ba0cfae4e5951
--- /dev/null
+++ b/chrome/browser/ui/webui/webrtc_internals_proxy.h
@@ -0,0 +1,53 @@
+// Copyright (c) 2013 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_WEBRTC_INTERNALS_PROXY_H_
+#define CHROME_BROWSER_UI_WEBUI_WEBRTC_INTERNALS_PROXY_H_
+
+#include "base/memory/ref_counted.h"
+#include "base/string16.h"
+#include "chrome/browser/media/webrtc_internals_ui_observer.h"
+#include "content/public/browser/browser_thread.h"
+
+class WebRTCInternalsMessageHandler;
+
+// This class is a proxy between WebRTCInternals on the IO thread and
+// WebRTCInternalsMessageHandler on the UI thread.
+// It is ref_counted to ensure that it completes all pending tasks on both
+// threads before destruction.
+class WebRTCInternalsProxy
+ : public WebRTCInternalsUIObserver,
+ public base::RefCountedThreadSafe<
+ WebRTCInternalsProxy,
+ content::BrowserThread::DeleteOnUIThread> {
+ public:
+ WebRTCInternalsProxy();
+
+ // WebRTCInternalsUIObserver override
vrk (LEFT CHROMIUM) 2013/01/15 22:54:13 nit: period at end of sentence.
jiayl 2013/01/15 23:03:31 Done.
+ virtual void OnUpdate(const std::string& command,
+ const base::Value* args) OVERRIDE;
+
+ // Attach a handler and start receiving callbacks from WebRTCInternals.
+ void Attach(WebRTCInternalsMessageHandler* handler);
+
+ // Detach the handler and stop receiving callbacks.
+ void Detach();
+
+ private:
+ friend struct content::BrowserThread::DeleteOnThread<
+ content::BrowserThread::UI>;
+ friend class base::DeleteHelper<WebRTCInternalsProxy>;
+
+ virtual ~WebRTCInternalsProxy();
+
+ void ObserveWebRTCInternalsOnIOThread();
+ void StopObservingWebRTCInternalsOnIOThread();
+ void UpdateOnUIThread(const string16& update);
+
+ WebRTCInternalsMessageHandler* handler_;
+
+ DISALLOW_COPY_AND_ASSIGN(WebRTCInternalsProxy);
+};
+
+#endif // CHROME_BROWSER_UI_WEBUI_WEBRTC_INTERNALS_PROXY_H_

Powered by Google App Engine
This is Rietveld 408576698