Chromium Code Reviews| 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..d3f489cb3da888b000c92faca943d696b87b25fd |
| --- /dev/null |
| +++ b/components/devtools_bridge/client/js/web_client.js |
| @@ -0,0 +1,30 @@ |
| +// 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. |
| + |
| +/** |
| + * |
| + * @constructor |
| + */ |
| +function WebClient() { |
| + this.sessions_ = {}; |
|
mnaganov (inactive)
2014/11/21 21:19:38
Wrong indentation.
SeRya
2014/11/24 11:10:06
Done.
|
| + this.gcdClient_ = new GCDClient(); |
| +} |
| + |
| +WebClient.prototype.startSession = function(deviceId) { |
| + console.log("Starting session " + deviceId); |
|
mnaganov (inactive)
2014/11/21 21:19:38
Please prefer using single quotes.
|
| + this.sessions_[deviceId] = new ClientSession(deviceId, this.gcdClient_); |
| + this.sessions_[deviceId].start(); |
| +}; |
| + |
| +WebClient.prototype.stopSession = function(deviceId) { |
| + console.log("Stopping session " + deviceId); |
| + this.sessions_[deviceId].stop(); |
| + delete this.sessions_[deviceId]; |
| +}; |
| + |
| +window.addEventListener("load", function() { |
| + window.WebClient.instance = new WebClient(); |
| + if (chrome.send) |
| + chrome.send('loaded'); |
| +}); |