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

Side by Side Diff: remoting/webapp/crd/js/host_screen.js

Issue 955283002: Converted remoting.Error from an enum to a class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Smaller diff. Created 5 years, 10 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 (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 * Functions related to the 'host screen' for Chromoting. 7 * Functions related to the 'host screen' for Chromoting.
8 */ 8 */
9 9
10 /** @suppress {duplicate} */ 10 /** @suppress {duplicate} */
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 // the host manually. 50 // the host manually.
51 var hasHostDialog = (hostInstallDialog !== null); /** jscompile hack */ 51 var hasHostDialog = (hostInstallDialog !== null); /** jscompile hack */
52 if (!hasHostDialog) { 52 if (!hasHostDialog) {
53 hostInstallDialog = new remoting.HostInstallDialog(); 53 hostInstallDialog = new remoting.HostInstallDialog();
54 hostInstallDialog.show(tryInitializeFacade, onInstallError); 54 hostInstallDialog.show(tryInitializeFacade, onInstallError);
55 } else { 55 } else {
56 hostInstallDialog.tryAgain(); 56 hostInstallDialog.tryAgain();
57 } 57 }
58 }; 58 };
59 59
60 /** @param {remoting.Error} error */ 60 /** @param {!remoting.Error} error */
61 var onInstallError = function(error) { 61 var onInstallError = function(error) {
62 if (error == remoting.Error.CANCELLED) { 62 if (error.tag == remoting.Error.Tag.CANCELLED) {
63 remoting.setMode(remoting.AppMode.HOME); 63 remoting.setMode(remoting.AppMode.HOME);
64 } else { 64 } else {
65 showShareError_(error); 65 showShareError_(error);
66 } 66 }
67 }; 67 };
68 68
69 tryInitializeFacade(); 69 tryInitializeFacade();
70 }; 70 };
71 71
72 /** 72 /**
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 * is additional debug log info to display. 181 * is additional debug log info to display.
182 * @param {string} msg The message (which will not be localized) to be logged. 182 * @param {string} msg The message (which will not be localized) to be logged.
183 */ 183 */
184 function logDebugInfo_(msg) { 184 function logDebugInfo_(msg) {
185 console.log('plugin: ' + msg); 185 console.log('plugin: ' + msg);
186 } 186 }
187 187
188 /** 188 /**
189 * Show a host-side error message. 189 * Show a host-side error message.
190 * 190 *
191 * @param {string} errorTag The error message to be localized and displayed. 191 * @param {!remoting.Error} error The error to be localized and displayed.
192 * @return {void} Nothing. 192 * @return {void} Nothing.
193 */ 193 */
194 function showShareError_(errorTag) { 194 function showShareError_(error) {
195 var errorDiv = document.getElementById('host-plugin-error'); 195 var errorDiv = document.getElementById('host-plugin-error');
196 l10n.localizeElementFromTag(errorDiv, errorTag); 196 l10n.localizeElementFromTag(errorDiv, error.tag);
197 console.error('Sharing error: ' + errorTag); 197 console.error('Sharing error: %o', error);
198 remoting.setMode(remoting.AppMode.HOST_SHARE_FAILED); 198 remoting.setMode(remoting.AppMode.HOST_SHARE_FAILED);
199 cleanUp(); 199 cleanUp();
200 } 200 }
201 201
202 /** 202 /**
203 * Show a sharing error with error code UNEXPECTED . 203 * Show a sharing error with error code UNEXPECTED .
204 * 204 *
205 * @return {void} Nothing. 205 * @return {void} Nothing.
206 */ 206 */
207 function it2meConnectFailed_() { 207 function it2meConnectFailed_() {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 */ 329 */
330 function onNatTraversalPolicyChanged_(enabled) { 330 function onNatTraversalPolicyChanged_(enabled) {
331 var natBox = document.getElementById('nat-box'); 331 var natBox = document.getElementById('nat-box');
332 if (enabled) { 332 if (enabled) {
333 natBox.classList.add('traversal-enabled'); 333 natBox.classList.add('traversal-enabled');
334 } else { 334 } else {
335 natBox.classList.remove('traversal-enabled'); 335 natBox.classList.remove('traversal-enabled');
336 } 336 }
337 } 337 }
338 338
339 })(); 339 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698