OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview | 6 * @fileoverview |
7 * Class handling creation and teardown of a remoting client session. | 7 * Class handling creation and teardown of a remoting client session. |
8 * | 8 * |
9 * The ClientSession class controls lifetime of the client plugin | 9 * The ClientSession class controls lifetime of the client plugin |
10 * object and provides the plugin with the functionality it needs to | 10 * object and provides the plugin with the functionality it needs to |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 this.defineEvents(Object.keys(remoting.ClientSession.Events)); | 91 this.defineEvents(Object.keys(remoting.ClientSession.Events)); |
92 }; | 92 }; |
93 | 93 |
94 /** @enum {string} */ | 94 /** @enum {string} */ |
95 remoting.ClientSession.Events = { | 95 remoting.ClientSession.Events = { |
96 stateChanged: 'stateChanged', | 96 stateChanged: 'stateChanged', |
97 videoChannelStateChanged: 'videoChannelStateChanged', | 97 videoChannelStateChanged: 'videoChannelStateChanged', |
98 }; | 98 }; |
99 | 99 |
100 // Note that the positive values in both of these enums are copied directly | 100 // Note that the positive values in both of these enums are copied directly |
101 // from chromoting_scriptable_object.h and must be kept in sync. The negative | 101 // from connection_to_host.h and must be kept in sync. Code in |
102 // values represent state transitions that occur within the web-app that have | 102 // chromoting_instance.cc converts the C++ enums into strings that must match |
103 // no corresponding plugin state transition. | 103 // the names given here. |
104 // The negative values represent state transitions that occur within the | |
105 // web-app that have no corresponding plugin state transition. | |
104 /** @enum {number} */ | 106 /** @enum {number} */ |
105 remoting.ClientSession.State = { | 107 remoting.ClientSession.State = { |
106 CONNECTION_CANCELED: -3, // Connection closed (gracefully) before connecting. | 108 CONNECTION_CANCELED: -3, // Connection closed (gracefully) before connecting. |
107 CONNECTION_DROPPED: -2, // Succeeded, but subsequently closed with an error. | 109 CONNECTION_DROPPED: -2, // Succeeded, but subsequently closed with an error. |
108 CREATED: -1, | 110 CREATED: -1, |
109 UNKNOWN: 0, | 111 UNKNOWN: 0, |
110 CONNECTING: 1, | 112 INITIALIZING: 1, |
garykac
2015/03/24 20:09:13
Match order in connection_to_host
| |
111 INITIALIZING: 2, | 113 CONNECTING: 2, |
112 CONNECTED: 3, | 114 AUTHENTICATED: 3, |
garykac
2015/03/24 20:09:13
Add missing AUTHENTICATED
| |
113 CLOSED: 4, | 115 CONNECTED: 4, |
114 FAILED: 5 | 116 CLOSED: 5, |
117 FAILED: 6 | |
115 }; | 118 }; |
116 | 119 |
117 /** | 120 /** |
118 * @param {string} state The state name. | 121 * @param {string} state The state name. |
119 * @return {remoting.ClientSession.State} The session state enum value. | 122 * @return {remoting.ClientSession.State} The session state enum value. |
120 */ | 123 */ |
121 remoting.ClientSession.State.fromString = function(state) { | 124 remoting.ClientSession.State.fromString = function(state) { |
122 if (!remoting.ClientSession.State.hasOwnProperty(state)) { | 125 if (!remoting.ClientSession.State.hasOwnProperty(state)) { |
123 throw "Invalid ClientSession.State: " + state; | 126 throw "Invalid ClientSession.State: " + state; |
124 } | 127 } |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
596 'https://docs.google.com/feeds/', | 599 'https://docs.google.com/feeds/', |
597 'https://www.googleapis.com/auth/drive' | 600 'https://www.googleapis.com/auth/drive' |
598 ]; | 601 ]; |
599 remoting.identity.getNewToken(googleDriveScopes). | 602 remoting.identity.getNewToken(googleDriveScopes). |
600 then(sendToken). | 603 then(sendToken). |
601 catch(remoting.Error.handler(sendError)); | 604 catch(remoting.Error.handler(sendError)); |
602 window.setTimeout(this.sendGoogleDriveAccessToken_.bind(this), | 605 window.setTimeout(this.sendGoogleDriveAccessToken_.bind(this), |
603 remoting.ACCESS_TOKEN_RESEND_INTERVAL_MS); | 606 remoting.ACCESS_TOKEN_RESEND_INTERVAL_MS); |
604 }; | 607 }; |
605 | 608 |
OLD | NEW |