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

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

Issue 1146833002: [AppRemoting] Implement ConnectionDroppedDialog. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: WindowShape fixes + reviewer's feedback Created 5 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 /** 8 /**
9 * Type definition for the RunApplicationResponse returned by the API. 9 * Type definition for the RunApplicationResponse returned by the API.
10 * @typedef {{ 10 * @typedef {{
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 } 173 }
174 }; 174 };
175 175
176 /** 176 /**
177 * @param {remoting.Error} error 177 * @param {remoting.Error} error
178 */ 178 */
179 remoting.AppRemotingActivity.prototype.onDisconnected = function(error) { 179 remoting.AppRemotingActivity.prototype.onDisconnected = function(error) {
180 if (error.isNone()) { 180 if (error.isNone()) {
181 chrome.app.window.current().close(); 181 chrome.app.window.current().close();
182 } else { 182 } else {
183 this.showErrorMessage_(error); 183 this.onConnectionDropped_();
184 } 184 }
185 this.cleanup_();
186 }; 185 };
187 186
188 /** 187 /**
189 * @param {!remoting.Error} error 188 * @param {!remoting.Error} error
190 */ 189 */
191 remoting.AppRemotingActivity.prototype.onConnectionFailed = function(error) { 190 remoting.AppRemotingActivity.prototype.onConnectionFailed = function(error) {
192 remoting.LoadingWindow.close(); 191 remoting.LoadingWindow.close();
193 this.showErrorMessage_(error); 192 this.showErrorMessage_(error);
194 this.cleanup_(); 193 this.cleanup_();
195 }; 194 };
196 195
196 /** @private */
197 remoting.AppRemotingActivity.prototype.onConnectionDropped_ = function() {
198 var rootElement = /** @type {HTMLDialogElement} */ (
199 document.getElementById('connection-dropped-dialog'));
200
201 var dialog = new remoting.Html5ModalDialog({
202 dialog: rootElement,
203 primaryButton: rootElement.querySelector('.restart-button'),
204 secondaryButton: rootElement.querySelector('.close-button'),
205 closeOnEscape: false
206 });
207
208 var that = this;
209 dialog.show().then(function(/** remoting.MessageDialog.Result */ result) {
210 if (result === remoting.MessageDialog.Result.PRIMARY) {
211 // Hide the windows of the remote application with setDesktopRects([])
212 // before tearing down the plugin.
213 remoting.windowShape.setDesktopRects([]);
214 that.cleanup_();
215 that.start();
216 } else {
217 chrome.app.window.current().close();
218 }
219 });
220 };
221
197 /** 222 /**
198 * @param {!remoting.Error} error The error to be localized and displayed. 223 * @param {!remoting.Error} error The error to be localized and displayed.
199 * @private 224 * @private
200 */ 225 */
201 remoting.AppRemotingActivity.prototype.showErrorMessage_ = function(error) { 226 remoting.AppRemotingActivity.prototype.showErrorMessage_ = function(error) {
202 console.error('Connection failed: ' + error.toString()); 227 console.error('Connection failed: ' + error.toString());
203 remoting.MessageWindow.showErrorMessage( 228 remoting.MessageWindow.showErrorMessage(
204 remoting.app.getApplicationName(), 229 remoting.app.getApplicationName(),
205 chrome.i18n.getMessage(error.getTag())); 230 chrome.i18n.getMessage(error.getTag()));
206 }; 231 };
207 232
208 })(); 233 })();
OLDNEW
« no previous file with comments | « remoting/webapp/app_remoting/js/app_connected_view.js ('k') | remoting/webapp/app_remoting/js/context_menu_chrome.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698