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

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

Issue 10262013: [Chromoting] Fix two typos in the webapp. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use camelCase. Created 8 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 that wraps low-level details of interacting with the client plugin. 7 * Class that wraps low-level details of interacting with the client plugin.
8 * 8 *
9 * This abstracts a <embed> element and controls the plugin which does 9 * This abstracts a <embed> element and controls the plugin which does
10 * the actual remoting work. It also handles differences between 10 * the actual remoting work. It also handles differences between
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 * The oldest API version that we support. 78 * The oldest API version that we support.
79 * This will differ from the |API_VERSION_| if we maintain backward 79 * This will differ from the |API_VERSION_| if we maintain backward
80 * compatibility with older API versions. 80 * compatibility with older API versions.
81 * 81 *
82 * @const 82 * @const
83 * @private 83 * @private
84 */ 84 */
85 remoting.ClientPluginAsync.prototype.API_MIN_VERSION_ = 5; 85 remoting.ClientPluginAsync.prototype.API_MIN_VERSION_ = 5;
86 86
87 /** 87 /**
88 * @param {string} message_str Message from the plugin. 88 * @param {string} messageStr Message from the plugin.
89 */ 89 */
90 remoting.ClientPluginAsync.prototype.handleMessage_ = function(messageStr) { 90 remoting.ClientPluginAsync.prototype.handleMessage_ = function(messageStr) {
91 var message = /** @type {{method:string, data:Object.<string,string>}} */ 91 var message = /** @type {{method:string, data:Object.<string,string>}} */
92 jsonParseSafe(messageStr); 92 jsonParseSafe(messageStr);
93 93
94 if (!message || !('method' in message) || !('data' in message)) { 94 if (!message || !('method' in message) || !('data' in message)) {
95 console.error('Received invalid message from the plugin: ' + message_str); 95 console.error('Received invalid message from the plugin: ' + messageStr);
96 return; 96 return;
97 } 97 }
98 98
99 if (message.method == 'hello') { 99 if (message.method == 'hello') {
100 // Reset the size in case we had to enlarge it to support click-to-play. 100 // Reset the size in case we had to enlarge it to support click-to-play.
101 this.plugin.width = 0; 101 this.plugin.width = 0;
102 this.plugin.height = 0; 102 this.plugin.height = 0;
103 if (typeof message.data['apiVersion'] != 'number' || 103 if (typeof message.data['apiVersion'] != 'number' ||
104 typeof message.data['apiMinVersion'] != 'number') { 104 typeof message.data['apiMinVersion'] != 'number') {
105 console.error('Received invalid hello message: ' + message_str); 105 console.error('Received invalid hello message: ' + messageStr);
106 return; 106 return;
107 } 107 }
108 this.pluginApiVersion_ = /** @type {number} */ message.data['apiVersion']; 108 this.pluginApiVersion_ = /** @type {number} */ message.data['apiVersion'];
109 if (this.pluginApiVersion_ >= 7) { 109 if (this.pluginApiVersion_ >= 7) {
110 if (typeof message.data['apiFeatures'] != 'string') { 110 if (typeof message.data['apiFeatures'] != 'string') {
111 console.error('Received invalid hello message: ' + message_str); 111 console.error('Received invalid hello message: ' + messageStr);
112 return; 112 return;
113 } 113 }
114 this.pluginApiFeatures_ = 114 this.pluginApiFeatures_ =
115 /** @type {Array.<string>} */ message.data['apiFeatures'].split(' '); 115 /** @type {Array.<string>} */ message.data['apiFeatures'].split(' ');
116 } else if (this.pluginApiVersion_ >= 6) { 116 } else if (this.pluginApiVersion_ >= 6) {
117 this.pluginApiFeatures_ = ['highQualityScaling', 'injectKeyEvent']; 117 this.pluginApiFeatures_ = ['highQualityScaling', 'injectKeyEvent'];
118 } else { 118 } else {
119 this.pluginApiFeatures_ = ['highQualityScaling']; 119 this.pluginApiFeatures_ = ['highQualityScaling'];
120 } 120 }
121 this.pluginApiMinVersion_ = 121 this.pluginApiMinVersion_ =
122 /** @type {number} */ message.data['apiMinVersion']; 122 /** @type {number} */ message.data['apiMinVersion'];
123 this.helloReceived_ = true; 123 this.helloReceived_ = true;
124 if (this.onInitializedCallback_ != null) { 124 if (this.onInitializedCallback_ != null) {
125 this.onInitializedCallback_(true); 125 this.onInitializedCallback_(true);
126 this.onInitializedCallback_ = null; 126 this.onInitializedCallback_ = null;
127 } 127 }
128 } else if (message.method == 'sendOutgoingIq') { 128 } else if (message.method == 'sendOutgoingIq') {
129 if (typeof message.data['iq'] != 'string') { 129 if (typeof message.data['iq'] != 'string') {
130 console.error('Received invalid sendOutgoingIq message: ' + message_str); 130 console.error('Received invalid sendOutgoingIq message: ' + messageStr);
131 return; 131 return;
132 } 132 }
133 this.onOutgoingIqHandler(message.data['iq']); 133 this.onOutgoingIqHandler(message.data['iq']);
134 } else if (message.method == 'logDebugMessage') { 134 } else if (message.method == 'logDebugMessage') {
135 if (typeof message.data['message'] != 'string') { 135 if (typeof message.data['message'] != 'string') {
136 console.error('Received invalid logDebugMessage message: ' + message_str); 136 console.error('Received invalid logDebugMessage message: ' + messageStr);
137 return; 137 return;
138 } 138 }
139 this.onDebugMessageHandler(message.data['message']); 139 this.onDebugMessageHandler(message.data['message']);
140 } else if (message.method == 'onConnectionStatus') { 140 } else if (message.method == 'onConnectionStatus') {
141 if (typeof message.data['state'] != 'string' || 141 if (typeof message.data['state'] != 'string' ||
142 !(message.data['state'] in remoting.ClientSession.State) || 142 !(message.data['state'] in remoting.ClientSession.State) ||
143 typeof message.data['error'] != 'string') { 143 typeof message.data['error'] != 'string') {
144 console.error('Received invalid onConnectionState message: ' + 144 console.error('Received invalid onConnectionState message: ' +
145 message_str); 145 messageStr);
146 return; 146 return;
147 } 147 }
148 148
149 /** @type {remoting.ClientSession.State} */ 149 /** @type {remoting.ClientSession.State} */
150 var state = remoting.ClientSession.State[message.data['state']]; 150 var state = remoting.ClientSession.State[message.data['state']];
151 var error; 151 var error;
152 if (message.data['error'] in remoting.ClientSession.ConnectionError) { 152 if (message.data['error'] in remoting.ClientSession.ConnectionError) {
153 error = /** @type {remoting.ClientSession.ConnectionError} */ 153 error = /** @type {remoting.ClientSession.ConnectionError} */
154 remoting.ClientSession.ConnectionError[message.data['error']]; 154 remoting.ClientSession.ConnectionError[message.data['error']];
155 } else { 155 } else {
156 error = remoting.ClientSession.ConnectionError.UNKNOWN; 156 error = remoting.ClientSession.ConnectionError.UNKNOWN;
157 } 157 }
158 158
159 this.onConnectionStatusUpdateHandler(state, error); 159 this.onConnectionStatusUpdateHandler(state, error);
160 } else if (message.method == 'onDesktopSize') { 160 } else if (message.method == 'onDesktopSize') {
161 if (typeof message.data['width'] != 'number' || 161 if (typeof message.data['width'] != 'number' ||
162 typeof message.data['height'] != 'number') { 162 typeof message.data['height'] != 'number') {
163 console.error('Received invalid onDesktopSize message: ' + message_str); 163 console.error('Received invalid onDesktopSize message: ' + messageStr);
164 return; 164 return;
165 } 165 }
166 this.desktopWidth = /** @type {number} */ message.data['width']; 166 this.desktopWidth = /** @type {number} */ message.data['width'];
167 this.desktopHeight = /** @type {number} */ message.data['height']; 167 this.desktopHeight = /** @type {number} */ message.data['height'];
168 this.onDesktopSizeUpdateHandler(); 168 this.onDesktopSizeUpdateHandler();
169 } else if (message.method == 'onPerfStats') { 169 } else if (message.method == 'onPerfStats') {
170 if (typeof message.data['videoBandwidth'] != 'number' || 170 if (typeof message.data['videoBandwidth'] != 'number' ||
171 typeof message.data['videoFrameRate'] != 'number' || 171 typeof message.data['videoFrameRate'] != 'number' ||
172 typeof message.data['captureLatency'] != 'number' || 172 typeof message.data['captureLatency'] != 'number' ||
173 typeof message.data['encodeLatency'] != 'number' || 173 typeof message.data['encodeLatency'] != 'number' ||
174 typeof message.data['decodeLatency'] != 'number' || 174 typeof message.data['decodeLatency'] != 'number' ||
175 typeof message.data['renderLatency'] != 'number' || 175 typeof message.data['renderLatency'] != 'number' ||
176 typeof message.data['roundtripLatency'] != 'number') { 176 typeof message.data['roundtripLatency'] != 'number') {
177 console.error('Received incorrect onPerfStats message: ' + message_str); 177 console.error('Received incorrect onPerfStats message: ' + messageStr);
178 return; 178 return;
179 } 179 }
180 this.perfStats_ = 180 this.perfStats_ =
181 /** @type {remoting.ClientSession.PerfStats} */ message.data; 181 /** @type {remoting.ClientSession.PerfStats} */ message.data;
182 } else if (message.method = 'injectClipboardItem') { 182 } else if (message.method = 'injectClipboardItem') {
183 if (typeof message.data['mimeType'] != 'string' || 183 if (typeof message.data['mimeType'] != 'string' ||
184 typeof message.data['item'] != 'string') { 184 typeof message.data['item'] != 'string') {
185 console.error('Received incorrect injectClipboardItem message.'); 185 console.error('Received incorrect injectClipboardItem message.');
186 return; 186 return;
187 } 187 }
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 this.plugin.width = width; 377 this.plugin.width = width;
378 this.plugin.height = height; 378 this.plugin.height = height;
379 // Center the plugin just underneath the "Connnecting..." dialog. 379 // Center the plugin just underneath the "Connnecting..." dialog.
380 var parentNode = this.plugin.parentNode; 380 var parentNode = this.plugin.parentNode;
381 var dialog = document.getElementById('client-dialog'); 381 var dialog = document.getElementById('client-dialog');
382 var dialogRect = dialog.getBoundingClientRect(); 382 var dialogRect = dialog.getBoundingClientRect();
383 parentNode.style.top = (dialogRect.bottom + 16) + 'px'; 383 parentNode.style.top = (dialogRect.bottom + 16) + 'px';
384 parentNode.style.left = (window.innerWidth - width) / 2 + 'px'; 384 parentNode.style.left = (window.innerWidth - width) / 2 + 'px';
385 } 385 }
386 }; 386 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698