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

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

Issue 1016623002: [Webapp Refactor] Reparent the ConnectedView into the delegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Baseline Created 5 years, 9 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 * This class implements the functionality that is specific to application 7 * This class implements the functionality that is specific to application
8 * remoting ("AppRemoting" or AR). 8 * remoting ("AppRemoting" or AR).
9 */ 9 */
10 10
11 'use strict'; 11 'use strict';
12 12
13 /** @suppress {duplicate} */ 13 /** @suppress {duplicate} */
14 var remoting = remoting || {}; 14 var remoting = remoting || {};
15 15
16 /** 16 /**
17 * @param {remoting.Application} app The main app that owns this delegate. 17 * @param {remoting.Application} app The main app that owns this delegate.
18 * @constructor 18 * @constructor
19 * @implements {remoting.Application.Delegate} 19 * @implements {remoting.Application.Delegate}
20 * @implements {remoting.ProtocolExtension}
20 */ 21 */
21 remoting.AppRemoting = function(app) { 22 remoting.AppRemoting = function(app) {
22 app.setDelegate(this); 23 app.setDelegate(this);
23 24
24 /** @private {remoting.ApplicationContextMenu} */ 25 /** @private {remoting.ApplicationContextMenu} */
25 this.contextMenu_ = null; 26 this.contextMenu_ = null;
26 27
27 /** @private {remoting.KeyboardLayoutsMenu} */ 28 /** @private {remoting.KeyboardLayoutsMenu} */
28 this.keyboardLayoutsMenu_ = null; 29 this.keyboardLayoutsMenu_ = null;
29 30
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 * @return {void} Nothing. 226 * @return {void} Nothing.
226 */ 227 */
227 remoting.AppRemoting.prototype.handleConnected = function(connectionInfo) { 228 remoting.AppRemoting.prototype.handleConnected = function(connectionInfo) {
228 remoting.identity.getUserInfo().then( 229 remoting.identity.getUserInfo().then(
229 function(userInfo) { 230 function(userInfo) {
230 remoting.clientSession.sendClientMessage( 231 remoting.clientSession.sendClientMessage(
231 'setUserDisplayInfo', 232 'setUserDisplayInfo',
232 JSON.stringify({fullName: userInfo.name})); 233 JSON.stringify({fullName: userInfo.name}));
233 }); 234 });
234 235
236 remoting.app.getSessionConnector().registerProtocolExtension(this);
237
235 var clientSession = connectionInfo.session(); 238 var clientSession = connectionInfo.session();
236 // Set up a ping at 10-second intervals to test the connection speed. 239 // Set up a ping at 10-second intervals to test the connection speed.
237 var CONNECTION_SPEED_PING_INTERVAL = 10 * 1000; 240 var CONNECTION_SPEED_PING_INTERVAL = 10 * 1000;
238 this.pingTimer_ = new base.RepeatingTimer(function () { 241 this.pingTimer_ = new base.RepeatingTimer(function () {
239 var message = { timestamp: new Date().getTime() }; 242 var message = { timestamp: new Date().getTime() };
240 clientSession.sendClientMessage('pingRequest', JSON.stringify(message)); 243 clientSession.sendClientMessage('pingRequest', JSON.stringify(message));
241 }, CONNECTION_SPEED_PING_INTERVAL); 244 }, CONNECTION_SPEED_PING_INTERVAL);
242 }; 245 };
243 246
244 /** 247 /**
(...skipping 24 matching lines...) Expand all
269 /** 272 /**
270 * Called when the current session has reached the point where the host has 273 * Called when the current session has reached the point where the host has
271 * started streaming video frames to the client. 274 * started streaming video frames to the client.
272 * 275 *
273 * @return {void} Nothing. 276 * @return {void} Nothing.
274 */ 277 */
275 remoting.AppRemoting.prototype.handleVideoStreamingStarted = function() { 278 remoting.AppRemoting.prototype.handleVideoStreamingStarted = function() {
276 remoting.LoadingWindow.close(); 279 remoting.LoadingWindow.close();
277 }; 280 };
278 281
282
283 /** @return {Array<string>} */
284 remoting.AppRemoting.prototype.getExtensionTypes = function() {
285 return ['openURL', 'onWindowRemoved', 'onWindowAdded',
286 'onAllWindowsMinimized', 'setKeyboardLayouts', 'pingResponse'];
287 };
288
279 /** 289 /**
280 * Called when an extension message needs to be handled. 290 * @param {function(string,string)} sendMessageToHost Callback to send a message
281 * 291 * to the host.
282 * @param {string} type The type of the extension message. 292 */
293 remoting.AppRemoting.prototype.startExtension = function(sendMessageToHost) {
294 };
295
296 /**
297 * @param {string} type The message type.
283 * @param {Object} message The parsed extension message data. 298 * @param {Object} message The parsed extension message data.
284 * @return {boolean} True if the extension message was recognized.
285 */ 299 */
286 remoting.AppRemoting.prototype.handleExtensionMessage = function( 300 remoting.AppRemoting.prototype.onExtensionMessage = function(type, message) {
287 type, message) {
288 switch (type) { 301 switch (type) {
289 302
290 case 'openURL': 303 case 'openURL':
291 // URL requests from the hosted app are untrusted, so disallow anything 304 // URL requests from the hosted app are untrusted, so disallow anything
292 // other than HTTP or HTTPS. 305 // other than HTTP or HTTPS.
293 var url = getStringAttr(message, 'url'); 306 var url = getStringAttr(message, 'url');
294 if (url.indexOf('http:') != 0 && url.indexOf('https:') != 0) { 307 if (url.indexOf('http:') != 0 && url.indexOf('https:') != 0) {
295 console.error('Bad URL: ' + url); 308 console.error('Bad URL: ' + url);
296 } else { 309 } else {
297 window.open(url); 310 window.open(url);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 chrome.i18n.getMessage(/*i18n-content*/'CONNECTION_FAILED'), 357 chrome.i18n.getMessage(/*i18n-content*/'CONNECTION_FAILED'),
345 chrome.i18n.getMessage(error.getTag())); 358 chrome.i18n.getMessage(error.getTag()));
346 }; 359 };
347 360
348 /** 361 /**
349 * Close the loading window before exiting. 362 * Close the loading window before exiting.
350 */ 363 */
351 remoting.AppRemoting.prototype.handleExit = function() { 364 remoting.AppRemoting.prototype.handleExit = function() {
352 remoting.LoadingWindow.close(); 365 remoting.LoadingWindow.close();
353 }; 366 };
OLDNEW
« no previous file with comments | « no previous file | remoting/webapp/base/js/application.js » ('j') | remoting/webapp/crd/js/desktop_remoting.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698