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

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

Issue 8758001: Launch Me2Me connections in a new tab. Remove OK button from post-connect screens for Me2Me. (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
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 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 this.hostNameCell_ = document.createElement('td'); 75 this.hostNameCell_ = document.createElement('td');
76 addClass(this.hostNameCell_, 'mode-select-label'); 76 addClass(this.hostNameCell_, 'mode-select-label');
77 this.hostNameCell_.appendChild( 77 this.hostNameCell_.appendChild(
78 document.createTextNode(host.hostName)); 78 document.createTextNode(host.hostName));
79 this.hostNameCell_.ondblclick = function() { that.beginRename_(); }; 79 this.hostNameCell_.ondblclick = function() { that.beginRename_(); };
80 this.tableRow.appendChild(this.hostNameCell_); 80 this.tableRow.appendChild(this.hostNameCell_);
81 81
82 // Create the host status cell. 82 // Create the host status cell.
83 var hostStatus = document.createElement('td'); 83 var hostStatus = document.createElement('td');
84 if (host.status == 'ONLINE') { 84 if (host.status == 'ONLINE') {
85 var hostUrl = chrome.extension.getURL('choice.html') +
86 '?mode=me2me' +
87 '&hostJid=' + encodeURIComponent(host.jabberId) +
88 '&hostPublicKey=' + encodeURIComponent(host.publicKey) +
89 '&hostName=' + encodeURIComponent(host.hostName);
85 var connectButton = document.createElement('button'); 90 var connectButton = document.createElement('button');
86 connectButton.setAttribute('class', 'mode-select-button'); 91 connectButton.setAttribute('class', 'mode-select-button');
87 connectButton.setAttribute('type', 'button'); 92 connectButton.setAttribute('type', 'button');
88 connectButton.setAttribute('onclick', 93 connectButton.setAttribute('onclick',
89 'remoting.connectHost("' + host.hostId + '")'); 94 'window.open("' + hostUrl + '", "_blank");');
90 connectButton.innerHTML = 95 connectButton.innerHTML =
91 chrome.i18n.getMessage(/*i18n-content*/'CONNECT_BUTTON'); 96 chrome.i18n.getMessage(/*i18n-content*/'CONNECT_BUTTON');
92 hostStatus.appendChild(connectButton); 97 hostStatus.appendChild(connectButton);
93 } else { 98 } else {
94 addClass(this.tableRow, 'host-offline'); 99 addClass(this.tableRow, 'host-offline');
95 hostStatus.innerHTML = chrome.i18n.getMessage(/*i18n-content*/'OFFLINE'); 100 hostStatus.innerHTML = chrome.i18n.getMessage(/*i18n-content*/'OFFLINE');
96 } 101 }
97 hostStatus.className = 'host-list-row-end'; 102 hostStatus.className = 'host-list-row-end';
98 this.tableRow.appendChild(hostStatus); 103 this.tableRow.appendChild(hostStatus);
99 104
(...skipping 30 matching lines...) Expand all
130 editBox.type = 'text'; 135 editBox.type = 'text';
131 editBox.value = this.host.hostName; 136 editBox.value = this.host.hostName;
132 this.hostNameCell_.innerHTML = ''; 137 this.hostNameCell_.innerHTML = '';
133 this.hostNameCell_.appendChild(editBox); 138 this.hostNameCell_.appendChild(editBox);
134 editBox.select(); 139 editBox.select();
135 140
136 /** @type {remoting.HostTableEntry} */ 141 /** @type {remoting.HostTableEntry} */
137 var that = this; 142 var that = this;
138 editBox.onblur = function() { that.commitRename_(); }; 143 editBox.onblur = function() { that.commitRename_(); };
139 144
140 /** @param {Event} event */ 145 /** @param {Event} event The keydown event. */
141 var onKeydown = function(event) { that.onKeydown_(event); } 146 var onKeydown = function(event) { that.onKeydown_(event); }
142 editBox.onkeydown = onKeydown; 147 editBox.onkeydown = onKeydown;
143 }; 148 };
144 149
145 /** 150 /**
146 * Accept the hostname entered by the user. 151 * Accept the hostname entered by the user.
147 * @return {void} Nothing. 152 * @return {void} Nothing.
148 * @private 153 * @private
149 */ 154 */
150 remoting.HostTableEntry.prototype.commitRename_ = function() { 155 remoting.HostTableEntry.prototype.commitRename_ = function() {
(...skipping 28 matching lines...) Expand all
179 * @return {void} Nothing. 184 * @return {void} Nothing.
180 * @private 185 * @private
181 */ 186 */
182 remoting.HostTableEntry.prototype.onKeydown_ = function(event) { 187 remoting.HostTableEntry.prototype.onKeydown_ = function(event) {
183 if (event.which == 27) { // Escape 188 if (event.which == 27) { // Escape
184 this.removeEditBox_(); 189 this.removeEditBox_();
185 } else if (event.which == 13) { // Enter 190 } else if (event.which == 13) { // Enter
186 this.commitRename_(); 191 this.commitRename_();
187 } 192 }
188 }; 193 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698