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

Side by Side Diff: remoting/webapp/hrd_helper_session.js

Issue 439923002: Hangout remote desktop part I - It2Me mode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 /**
6 * @fileoverview
7 * Class to communicate with the it2me background service via chrome runtime
8 * messages.
Jamie 2014/08/05 21:15:14 To do what? AFAICT, this class does two things: 1
kelvinp 2014/08/07 18:03:25 Done.
9 */
10
11 'use strict';
12
13 /** @suppress {duplicate} */
14 var remoting = remoting || {};
15
16 /**
17 * @constructor
18 */
19 remoting.HRDHelperSession = function() {
Jamie 2014/08/05 21:15:14 Can you come up with something more descriptive th
kelvinp 2014/08/07 18:03:25 Done.
20 /** @type {chrome.extension.Port} */
Jamie 2014/08/05 21:15:14 Add @private?
kelvinp 2014/08/07 18:03:25 Done.
21 this.port_ = null;
22 this.onSessionStateChangedHandler_ = this.onSessionStateChanged_.bind(this);
Jamie 2014/08/05 21:15:13 You only use this in one place, so there's no need
kelvinp 2014/08/07 18:03:25 Done.
23 };
24
25 remoting.HRDHelperSession.prototype.init = function() {
26 this.port_ = chrome.runtime.connect({name: 'it2me.helper.webapp'});
Jamie 2014/08/05 21:15:13 Are you missing an extension id here? Without one,
kelvinp 2014/08/07 18:03:25 This is intended. According to the documentation,
27
28 /** @type {base.EventSource} */
29 var hrdSessionEvents = remoting.hrdSessionEvents;
30 hrdSessionEvents.addEventListener('sessionStateChanged',
31 this.onSessionStateChangedHandler_);
32 };
33
34 /**
35 * @param {remoting.hrdSessionEvents.SessionStates} state
36 */
37 remoting.HRDHelperSession.prototype.onSessionStateChanged_ = function(state) {
38 var State = remoting.hrdSessionEvents.SessionStates;
39 try {
40 this.port_.postMessage({method: 'sessionStateChanged', state: state});
41 } catch (e) {
Jamie 2014/08/05 21:15:13 This ignores any errors. Is that what you want? If
kelvinp 2014/08/07 18:03:25 Done.
42 } finally {
43 if (state === State.ERROR || state === State.CLOSED) {
44 // close the current window
45 if (remoting.isAppsV2) {
46 chrome.app.window.current().close();
47 } else {
48 window.close();
49 }
50 }
51 }
52 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698