Chromium Code Reviews| Index: components/devtools_bridge/client/js/client_session.js |
| diff --git a/components/devtools_bridge/client/js/client_session.js b/components/devtools_bridge/client/js/client_session.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a9d677de6b7b0ca1422ad2563465d54e4c04f1ea |
| --- /dev/null |
| +++ b/components/devtools_bridge/client/js/client_session.js |
| @@ -0,0 +1,34 @@ |
| +// 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. |
| + |
| +function ClientSession(deviceId, gcdClient) { |
| + this.deviceId_ = deviceId; |
| + this.connection_ = new webkitRTCPeerConnection(null, null); |
| + this.gcdClient_ = gcdClient; |
| +} |
| + |
| +ClientSession.prototype.start = function() { |
| + this.connection_.createOffer(this.onOfferCreated_.bind(this), |
| + this.onOfferFailed_.bind(this), |
| + {}); |
| +}; |
| + |
| +ClientSession.prototype.stop = function() { |
| +}; |
| + |
| +ClientSession.prototype.onOfferCreated_ = function(offer) { |
| + this.gcdClient_.sendCommand({ |
| + 'deviceId': this.deviceId_, |
| + 'name': 'base._startSession', |
| + 'parameters': { |
| + '_sessionId': this.id_, |
|
mnaganov (inactive)
2014/11/21 21:19:38
I don't see initialization of 'id_' field.
SeRya
2014/11/24 11:10:06
Done.
|
| + '_config': '{}', |
| + '_offer': offer.sdp |
|
mnaganov (inactive)
2014/11/21 21:19:38
Missing quotes around the RHS value?
SeRya
2014/11/24 11:10:06
Don't see anything wrong. Key is quotes, value sho
mnaganov (inactive)
2014/11/24 11:47:20
Oh, sorry. I didn't notice that 'offer' is the arg
|
| + } |
| + }); |
| +}; |
| + |
| +ClientSession.prototype.onOfferFailed_ = function(error) { |
| + console.log("Offer failed: " + error); |
|
mnaganov (inactive)
2014/11/21 21:19:38
Please prefer using single quotes.
SeRya
2014/11/24 11:10:06
Done.
|
| +}; |