| OLD | NEW |
| 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 an entry in the host-list portion of the home screen. | 7 * Class representing an entry in the host-list portion of the home screen. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 'use strict'; | 10 'use strict'; |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 /** | 145 /** |
| 146 * Accept the hostname entered by the user. | 146 * Accept the hostname entered by the user. |
| 147 * @return {void} Nothing. | 147 * @return {void} Nothing. |
| 148 * @private | 148 * @private |
| 149 */ | 149 */ |
| 150 remoting.HostTableEntry.prototype.commitRename_ = function() { | 150 remoting.HostTableEntry.prototype.commitRename_ = function() { |
| 151 var editBox = this.hostNameCell_.querySelector('input'); | 151 var editBox = this.hostNameCell_.querySelector('input'); |
| 152 if (editBox) { | 152 if (editBox) { |
| 153 if (this.host.hostName != editBox.value) { | 153 if (this.host.hostName != editBox.value) { |
| 154 this.host.hostName = editBox.value; | 154 this.host.hostName = editBox.value; |
| 155 this.removeEditBox_(); | |
| 156 this.onRename_(); | 155 this.onRename_(); |
| 157 return; | |
| 158 } | 156 } |
| 157 this.removeEditBox_(); |
| 159 } | 158 } |
| 160 }; | 159 }; |
| 161 | 160 |
| 162 /** | 161 /** |
| 163 * Remove the edit box corresponding to the specified host, and reset its name. | 162 * Remove the edit box corresponding to the specified host, and reset its name. |
| 164 * @return {void} Nothing. | 163 * @return {void} Nothing. |
| 165 * @private | 164 * @private |
| 166 */ | 165 */ |
| 167 remoting.HostTableEntry.prototype.removeEditBox_ = function() { | 166 remoting.HostTableEntry.prototype.removeEditBox_ = function() { |
| 168 var editBox = this.hostNameCell_.querySelector('input'); | 167 var editBox = this.hostNameCell_.querySelector('input'); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 180 * @return {void} Nothing. | 179 * @return {void} Nothing. |
| 181 * @private | 180 * @private |
| 182 */ | 181 */ |
| 183 remoting.HostTableEntry.prototype.onKeydown_ = function(event) { | 182 remoting.HostTableEntry.prototype.onKeydown_ = function(event) { |
| 184 if (event.which == 27) { // Escape | 183 if (event.which == 27) { // Escape |
| 185 this.removeEditBox_(); | 184 this.removeEditBox_(); |
| 186 } else if (event.which == 13) { // Enter | 185 } else if (event.which == 13) { // Enter |
| 187 this.commitRename_(); | 186 this.commitRename_(); |
| 188 } | 187 } |
| 189 }; | 188 }; |
| OLD | NEW |