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

Unified Diff: components/devtools_bridge/client/js/web_client.js

Issue 746663002: Stub for WebRTCDeviceProvider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webclient
Patch Set: Created 6 years, 1 month 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: components/devtools_bridge/client/js/web_client.js
diff --git a/components/devtools_bridge/client/js/web_client.js b/components/devtools_bridge/client/js/web_client.js
new file mode 100644
index 0000000000000000000000000000000000000000..c376998f9775fce73e5424125b474f9756438a92
--- /dev/null
+++ b/components/devtools_bridge/client/js/web_client.js
@@ -0,0 +1,29 @@
+// Copyright 2014 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.
+
+/**
+ * Main class for interacting with C++ WebClient.
+ *
+ * @constructor
+ */
+function WebClient() {
+ this.sessions_ = {};
+ this.gcdClient_ = new GCDClient();
+}
+
+WebClient.prototype.startSession = function(deviceId) {
+ this.sessions_[deviceId] = new ClientSession(deviceId, this.gcdClient_);
+ this.sessions_[deviceId].start();
+};
+
+WebClient.prototype.stopSession = function(deviceId) {
+ this.sessions_[deviceId].stop();
+ delete this.sessions_[deviceId];
+};
+
+window.addEventListener('load', function() {
+ window.WebClient.instance = new WebClient();
+ if (chrome.send)
+ chrome.send('loaded');
+});

Powered by Google App Engine
This is Rietveld 408576698