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

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

Issue 1004513002: Eliminated named constants for instances of remoting.Error. (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
« no previous file with comments | « remoting/webapp/crd/js/client_session.js ('k') | remoting/webapp/crd/js/crd_main.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 * Functions related to the 'client screen' for Chromoting. 7 * Functions related to the 'client screen' for Chromoting.
8 */ 8 */
9 9
10 'use strict'; 10 'use strict';
11 11
12 /** @suppress {duplicate} */ 12 /** @suppress {duplicate} */
13 var remoting = remoting || {}; 13 var remoting = remoting || {};
14 14
15 /** 15 /**
16 * Initiate an IT2Me connection. 16 * Initiate an IT2Me connection.
17 */ 17 */
18 remoting.connectIT2Me = function() { 18 remoting.connectIT2Me = function() {
19 var connector = remoting.app.getSessionConnector(); 19 var connector = remoting.app.getSessionConnector();
20 var accessCode = document.getElementById('access-code-entry').value; 20 var accessCode = document.getElementById('access-code-entry').value;
21 remoting.setMode(remoting.AppMode.CLIENT_CONNECTING); 21 remoting.setMode(remoting.AppMode.CLIENT_CONNECTING);
22 remoting.It2MeConnectFlow.start(connector, accessCode). 22 remoting.It2MeConnectFlow.start(connector, accessCode).
23 catch(function(/** remoting.Error */ reason){ 23 catch(function(/** !remoting.Error */ reason){
24 var errorDiv = document.getElementById('connect-error-message'); 24 var errorDiv = document.getElementById('connect-error-message');
25 l10n.localizeElementFromTag(errorDiv, reason.tag); 25 l10n.localizeElementFromTag(errorDiv, reason.getTag());
26 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME); 26 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME);
27 }); 27 });
28 }; 28 };
29 29
30 /** 30 /**
31 * Entry-point for Me2Me connections, handling showing of the host-upgrade nag 31 * Entry-point for Me2Me connections, handling showing of the host-upgrade nag
32 * dialog if necessary. 32 * dialog if necessary.
33 * 33 *
34 * @param {string} hostId The unique id of the host. 34 * @param {string} hostId The unique id of the host.
35 * @return {void} Nothing. 35 * @return {void} Nothing.
36 */ 36 */
37 remoting.connectMe2Me = function(hostId) { 37 remoting.connectMe2Me = function(hostId) {
38 var host = remoting.hostList.getHostForId(hostId); 38 var host = remoting.hostList.getHostForId(hostId);
39 if (!host) { 39 if (!host) {
40 remoting.app.onError(remoting.Error.HOST_IS_OFFLINE); 40 remoting.app.onError(new remoting.Error(
41 remoting.Error.Tag.HOST_IS_OFFLINE));
41 return; 42 return;
42 } 43 }
43 var webappVersion = chrome.runtime.getManifest().version; 44 var webappVersion = chrome.runtime.getManifest().version;
44 var needsUpdateDialog = new remoting.HostNeedsUpdateDialog( 45 var needsUpdateDialog = new remoting.HostNeedsUpdateDialog(
45 document.getElementById('host-needs-update-dialog'), host); 46 document.getElementById('host-needs-update-dialog'), host);
46 47
47 needsUpdateDialog.showIfNecessary(webappVersion).then(function() { 48 needsUpdateDialog.showIfNecessary(webappVersion).then(function() {
48 remoting.connectMe2MeHostVersionAcknowledged_(host); 49 remoting.connectMe2MeHostVersionAcknowledged_(host);
49 }).catch(function(/** remoting.Error */ error) { 50 }).catch(function(/** remoting.Error */ error) {
50 if (error.tag === remoting.Error.Tag.CANCELLED) { 51 if (error.hasTag(remoting.Error.Tag.CANCELLED)) {
51 remoting.setMode(remoting.AppMode.HOME); 52 remoting.setMode(remoting.AppMode.HOME);
52 } 53 }
53 }); 54 });
54 }; 55 };
55 56
56 /** 57 /**
57 * Shows PIN entry screen localized to include the host name, and registers 58 * Shows PIN entry screen localized to include the host name, and registers
58 * a host-specific one-shot event handler for the form submission. 59 * a host-specific one-shot event handler for the form submission.
59 * 60 *
60 * @param {remoting.Host} host The Me2Me host to which to connect. 61 * @param {remoting.Host} host The Me2Me host to which to connect.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 if (pairingInfo) { 104 if (pairingInfo) {
104 clientId = /** @type {string} */ (pairingInfo['clientId']); 105 clientId = /** @type {string} */ (pairingInfo['clientId']);
105 sharedSecret = /** @type {string} */ (pairingInfo['sharedSecret']); 106 sharedSecret = /** @type {string} */ (pairingInfo['sharedSecret']);
106 } 107 }
107 connector.connectMe2Me(host, requestPin, fetchThirdPartyToken, 108 connector.connectMe2Me(host, requestPin, fetchThirdPartyToken,
108 clientId, sharedSecret); 109 clientId, sharedSecret);
109 } 110 }
110 111
111 remoting.HostSettings.load(host.hostId, connectMe2MeHostSettingsRetrieved); 112 remoting.HostSettings.load(host.hostId, connectMe2MeHostSettingsRetrieved);
112 }; 113 };
OLDNEW
« no previous file with comments | « remoting/webapp/crd/js/client_session.js ('k') | remoting/webapp/crd/js/crd_main.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698