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

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: 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 (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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 * is additional debug log info to display. 183 * is additional debug log info to display.
184 * @param {string} msg The message (which will not be localized) to be logged. 184 * @param {string} msg The message (which will not be localized) to be logged.
185 */ 185 */
186 function logDebugInfo_(msg) { 186 function logDebugInfo_(msg) {
187 console.log('plugin: ' + msg); 187 console.log('plugin: ' + msg);
188 } 188 }
189 189
190 /** 190 /**
191 * Show a host-side error message. 191 * Show a host-side error message.
192 * 192 *
193 * @param {string} errorTag The error message to be localized and displayed. 193 * @param {!remoting.Error} error The error to be localized and displayed.
194 * @return {void} Nothing. 194 * @return {void} Nothing.
195 */ 195 */
196 function showShareError_(errorTag) { 196 function showShareError_(error) {
197 var errorDiv = document.getElementById('host-plugin-error'); 197 var errorDiv = document.getElementById('host-plugin-error');
198 l10n.localizeElementFromTag(errorDiv, errorTag); 198 l10n.localizeElementFromTag(errorDiv, error.tag);
199 console.error('Sharing error: ' + errorTag); 199 console.error('Sharing error:', error.tag);
200 remoting.setMode(remoting.AppMode.HOST_SHARE_FAILED); 200 remoting.setMode(remoting.AppMode.HOST_SHARE_FAILED);
201 cleanUp(); 201 cleanUp();
202 } 202 }
203 203
204 /** 204 /**
205 * Show a sharing error with error code UNEXPECTED . 205 * Show a sharing error with error code UNEXPECTED .
206 * 206 *
207 * @return {void} Nothing. 207 * @return {void} Nothing.
208 */ 208 */
209 function it2meConnectFailed_() { 209 function it2meConnectFailed_() {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 function onNatTraversalPolicyChanged_(enabled) { 332 function onNatTraversalPolicyChanged_(enabled) {
333 var natBox = document.getElementById('nat-box'); 333 var natBox = document.getElementById('nat-box');
334 if (enabled) { 334 if (enabled) {
335 natBox.classList.add('traversal-enabled'); 335 natBox.classList.add('traversal-enabled');
336 } else { 336 } else {
337 natBox.classList.remove('traversal-enabled'); 337 natBox.classList.remove('traversal-enabled');
338 } 338 }
339 } 339 }
340 340
341 })(); 341 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698