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

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

Issue 1073003005: Fix not-authorized error message. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 8 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/app_remoting/js/app_remoting.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 that.session_ = session; 138 that.session_ = session;
139 session.logHostOfflineErrors(true); 139 session.logHostOfflineErrors(true);
140 session.connect(host, credentialsProvider); 140 session.connect(host, credentialsProvider);
141 }); 141 });
142 } else if (response && response.status == 'pending') { 142 } else if (response && response.status == 'pending') {
143 this.onConnectionFailed(new remoting.Error( 143 this.onConnectionFailed(new remoting.Error(
144 remoting.Error.Tag.SERVICE_UNAVAILABLE)); 144 remoting.Error.Tag.SERVICE_UNAVAILABLE));
145 } 145 }
146 } else { 146 } else {
147 console.error('Invalid "runApplication" response from server.'); 147 console.error('Invalid "runApplication" response from server.');
148 this.onConnectionFailed(remoting.Error.fromHttpStatus(xhrResponse.status)); 148 // The orchestrator returns 403 if the user is not whitelisted to run the
149 // app, which gets translated to a generic error message, so pick something
150 // a bit more user-friendly.
151 var error = xhrResponse.status == 403 ?
152 new remoting.Error(remoting.Error.Tag.APP_NOT_AUTHORIZED) :
153 remoting.Error.fromHttpStatus(xhrResponse.status);
154 this.onConnectionFailed(error);
149 } 155 }
150 }; 156 };
151 157
152 /** 158 /**
153 * @param {remoting.ConnectionInfo} connectionInfo 159 * @param {remoting.ConnectionInfo} connectionInfo
154 */ 160 */
155 remoting.AppRemotingActivity.prototype.onConnected = function(connectionInfo) { 161 remoting.AppRemotingActivity.prototype.onConnected = function(connectionInfo) {
156 this.connectedView_ = new remoting.AppConnectedView( 162 this.connectedView_ = new remoting.AppConnectedView(
157 document.getElementById('client-container'), connectionInfo); 163 document.getElementById('client-container'), connectionInfo);
158 164
(...skipping 28 matching lines...) Expand all
187 this.cleanup_(); 193 this.cleanup_();
188 }; 194 };
189 195
190 /** 196 /**
191 * @param {!remoting.Error} error The error to be localized and displayed. 197 * @param {!remoting.Error} error The error to be localized and displayed.
192 * @private 198 * @private
193 */ 199 */
194 remoting.AppRemotingActivity.prototype.showErrorMessage_ = function(error) { 200 remoting.AppRemotingActivity.prototype.showErrorMessage_ = function(error) {
195 console.error('Connection failed: ' + error.toString()); 201 console.error('Connection failed: ' + error.toString());
196 remoting.MessageWindow.showErrorMessage( 202 remoting.MessageWindow.showErrorMessage(
197 chrome.i18n.getMessage(/*i18n-content*/'CONNECTION_FAILED'), 203 remoting.app.getApplicationName(),
198 chrome.i18n.getMessage(error.getTag())); 204 chrome.i18n.getMessage(error.getTag()));
199 }; 205 };
200 206
201 })(); 207 })();
OLDNEW
« no previous file with comments | « remoting/webapp/app_remoting/js/app_remoting.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698