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

Side by Side Diff: remoting/webapp/me2mom/host_list.js

Issue 8679017: Don't update jabberId when renaming a host. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 * Class representing the host-list portion of the home screen UI. 7 * Class representing the host-list portion of the home screen UI.
8 */ 8 */
9 9
10 'use strict'; 10 'use strict';
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 this.table_.innerHTML = ''; 115 this.table_.innerHTML = '';
116 this.showError_(null); 116 this.showError_(null);
117 this.hostTableEntries_ = []; 117 this.hostTableEntries_ = [];
118 118
119 /** @type {remoting.HostList} */ 119 /** @type {remoting.HostList} */
120 var that = this; 120 var that = this;
121 for (var i = 0; i < hosts.length; ++i) { 121 for (var i = 0; i < hosts.length; ++i) {
122 /** @type {remoting.Host} */ 122 /** @type {remoting.Host} */
123 var host = hosts[i]; 123 var host = hosts[i];
124 // Validate the entry to make sure it has all the fields we expect. 124 // Validate the entry to make sure it has all the fields we expect.
125 if (host.hostName && host.hostId && host.status && host.jabberId && 125 if (host.hostName && host.hostId && host.status && host.jabberId
126 host.publicKey) { 126 && host.publicKey) {
Jamie 2011/11/23 21:34:19 nit: This change now looks a little out-of-place.
Sergey Ulanov 2011/11/24 00:15:30 Done.
127 var onRename = function() { that.renameHost_(host.hostId); } 127 var onRename = function() { that.renameHost_(host.hostId); }
128 var onDelete = function() { that.deleteHost_(host.hostId); } 128 var onDelete = function() { that.deleteHost_(host.hostId); }
129 var hostTableEntry = new remoting.HostTableEntry(); 129 var hostTableEntry = new remoting.HostTableEntry();
130 hostTableEntry.init(host, onRename, onDelete); 130 hostTableEntry.init(host, onRename, onDelete);
131 this.hostTableEntries_[i] = hostTableEntry; 131 this.hostTableEntries_[i] = hostTableEntry;
132 this.table_.appendChild(hostTableEntry.tableRow); 132 this.table_.appendChild(hostTableEntry.tableRow);
133 } 133 }
134 } 134 }
135 135
136 this.showOrHide_(this.hostTableEntries_.length != 0); 136 this.showOrHide_(this.hostTableEntries_.length != 0);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 if (!hostTableEntry) { 214 if (!hostTableEntry) {
215 console.error('No host registered for id ' + hostId); 215 console.error('No host registered for id ' + hostId);
216 return; 216 return;
217 } 217 }
218 /** @param {string} token */ 218 /** @param {string} token */
219 var renameHost = function(token) { 219 var renameHost = function(token) {
220 var headers = { 220 var headers = {
221 'Authorization': 'OAuth ' + token, 221 'Authorization': 'OAuth ' + token,
222 'Content-type' : 'application/json; charset=UTF-8' 222 'Content-type' : 'application/json; charset=UTF-8'
223 }; 223 };
224 var newHostDetails = { data: hostTableEntry.host }; 224 var newHostDetails = { data: {
225 hostId: hostTableEntry.host.hostId,
226 hostName: hostTableEntry.host.hostName,
227 publicKey: hostTableEntry.host.publicKey
228 } };
225 remoting.xhr.put( 229 remoting.xhr.put(
226 'https://www.googleapis.com/chromoting/v1/@me/hosts/' + hostId, 230 'https://www.googleapis.com/chromoting/v1/@me/hosts/' + hostId,
227 function(xhr) {}, 231 function(xhr) {},
228 JSON.stringify(newHostDetails), 232 JSON.stringify(newHostDetails),
229 headers); 233 headers);
230 } 234 }
231 remoting.oauth2.callWithToken(renameHost); 235 remoting.oauth2.callWithToken(renameHost);
232 }; 236 };
233 237
234 /** 238 /**
235 * Class name for the host list when it is collapsed. 239 * Class name for the host list when it is collapsed.
236 * @private 240 * @private
237 */ 241 */
238 remoting.HostList.COLLAPSED_ = 'collapsed'; 242 remoting.HostList.COLLAPSED_ = 'collapsed';
239 243
240 /** @type {remoting.HostList} */ 244 /** @type {remoting.HostList} */
241 remoting.hostList = null; 245 remoting.hostList = null;
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698