| OLD | NEW |
| 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 /** @suppress {duplicate} */ | 5 /** @suppress {duplicate} */ |
| 6 var remoting = remoting || {}; | 6 var remoting = remoting || {}; |
| 7 | 7 |
| 8 (function(){ | 8 (function(){ |
| 9 | 9 |
| 10 'use strict'; | 10 'use strict'; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 LAUNCH: 'remoting.ActivationHandler.launch', | 73 LAUNCH: 'remoting.ActivationHandler.launch', |
| 74 RESTART: 'remoting.ActivationHandler.restart' | 74 RESTART: 'remoting.ActivationHandler.restart' |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 /** | 77 /** |
| 78 * @param {OnClickData} info | 78 * @param {OnClickData} info |
| 79 * @private | 79 * @private |
| 80 */ | 80 */ |
| 81 remoting.ActivationHandler.prototype.onContextMenu_ = function(info) { | 81 remoting.ActivationHandler.prototype.onContextMenu_ = function(info) { |
| 82 if (info.menuItemId == NEW_WINDOW_MENU_ID_) { | 82 if (info.menuItemId == NEW_WINDOW_MENU_ID_) { |
| 83 this.createWindow_(); | 83 this.launchDefaultSession_(); |
| 84 } | 84 } |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 /** | 87 /** |
| 88 * Restart the window with |id|. | 88 * Restart the window with |id|. |
| 89 * @param {string} id | 89 * @param {string} id |
| 90 * | 90 * |
| 91 * @private | 91 * @private |
| 92 */ | 92 */ |
| 93 remoting.ActivationHandler.prototype.onRestart_ = function(id) { | 93 remoting.ActivationHandler.prototype.onRestart_ = function(id) { |
| 94 this.appLauncher_.restart(id).then(this.onWindowCreated_.bind(this)); | 94 this.appLauncher_.restart(id).then(this.onWindowCreated_.bind(this)); |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 /** | 97 /** |
| 98 * @param {Event} launchData |
| 98 * @private | 99 * @private |
| 99 */ | 100 */ |
| 100 remoting.ActivationHandler.prototype.onLaunched_ = function() { | 101 remoting.ActivationHandler.prototype.onLaunched_ = function(launchData) { |
| 101 this.createWindow_(); | 102 if (launchData['isPublicSession']) { |
| 103 this.launchIt2MeSession_(); |
| 104 } else { |
| 105 this.launchDefaultSession_(); |
| 106 } |
| 102 }; | 107 }; |
| 103 | 108 |
| 104 /** | 109 /** |
| 105 * Create a new app window and register for the closed event. | 110 * Create a new app window and register for the closed event. |
| 106 * | 111 * |
| 107 * @private | 112 * @private |
| 108 */ | 113 */ |
| 109 remoting.ActivationHandler.prototype.createWindow_ = function() { | 114 remoting.ActivationHandler.prototype.launchDefaultSession_ = function() { |
| 110 this.appLauncher_.launch().then(this.onWindowCreated_.bind(this)); | 115 this.appLauncher_.launch().then(this.onWindowCreated_.bind(this)); |
| 111 }; | 116 }; |
| 112 | 117 |
| 113 /** | 118 /** |
| 114 * @param {string} windowId | 119 * @param {string} windowId |
| 115 * | 120 * |
| 116 * @private | 121 * @private |
| 117 */ | 122 */ |
| 118 remoting.ActivationHandler.prototype.onWindowCreated_ = function( | 123 remoting.ActivationHandler.prototype.onWindowCreated_ = function( |
| 119 windowId) { | 124 windowId) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 137 */ | 142 */ |
| 138 remoting.ActivationHandler.prototype.onWindowClosed_ = function(id) { | 143 remoting.ActivationHandler.prototype.onWindowClosed_ = function(id) { |
| 139 // Unhook the event. | 144 // Unhook the event. |
| 140 var hook = /** @type {base.Disposable} */ (this.windowClosedHooks_.get(id)); | 145 var hook = /** @type {base.Disposable} */ (this.windowClosedHooks_.get(id)); |
| 141 base.dispose(hook); | 146 base.dispose(hook); |
| 142 this.windowClosedHooks_.delete(id); | 147 this.windowClosedHooks_.delete(id); |
| 143 | 148 |
| 144 this.raiseEvent(remoting.ActivationHandler.Events.windowClosed, id); | 149 this.raiseEvent(remoting.ActivationHandler.Events.windowClosed, id); |
| 145 }; | 150 }; |
| 146 | 151 |
| 152 /** @private */ |
| 153 remoting.ActivationHandler.prototype.launchIt2MeSession_ = function() { |
| 154 chrome.app.window.create("public_session.html", { |
| 155 'width': 570, |
| 156 'height': 300, |
| 157 'resizable': false |
| 158 }); |
| 159 }; |
| 160 |
| 147 })(); | 161 })(); |
| 148 | 162 |
| 149 /** @enum {string} */ | 163 /** @enum {string} */ |
| 150 remoting.ActivationHandler.Events = { | 164 remoting.ActivationHandler.Events = { |
| 151 windowClosed: 'windowClosed' | 165 windowClosed: 'windowClosed' |
| 152 }; | 166 }; |
| OLD | NEW |