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

Side by Side Diff: remoting/client/appengine/static_files/client.js

Issue 7033042: Update the appengine code to use OAuth2 and break the gdata dependency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove the hardcoded localhost Created 9 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « remoting/client/appengine/main.py ('k') | remoting/client/extension/manifest.json » ('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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // Flag to indicate whether or not to show offline hosts in the host list. 5 // Flag to indicate whether or not to show offline hosts in the host list.
6 chromoting.showOfflineHosts = true; 6 chromoting.showOfflineHosts = true;
7 7
8 // String to identify bad auth tokens. 8 // String to identify bad auth tokens.
9 var BAD_AUTH_TOKEN = 'bad_token'; 9 var BAD_AUTH_TOKEN = 'bad_token';
10 10
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 hostEntry.appendChild(hostIcon); 183 hostEntry.appendChild(hostIcon);
184 184
185 if (host.status == 'ONLINE') { 185 if (host.status == 'ONLINE') {
186 var span = document.createElement('span'); 186 var span = document.createElement('span');
187 span.setAttribute('class', 'connect'); 187 span.setAttribute('class', 'connect');
188 var connect = document.createElement('input'); 188 var connect = document.createElement('input');
189 189
190 connect.setAttribute('type', 'button'); 190 connect.setAttribute('type', 'button');
191 connect.setAttribute('value', 'Connect'); 191 connect.setAttribute('value', 'Connect');
192 connect.setAttribute('onclick', "window.open('session?hostname=" + 192 connect.setAttribute('onclick', "window.open('session?hostname=" +
193 encodeURIComponent(host.hostName) + "&hostjid=" + 193 encodeURIComponent(host.hostName) +
194 encodeURIComponent(host.jabberId) + "');"); 194 "&hostjid=" + encodeURIComponent(host.jabberId) +
195 "');");
195 span.appendChild(connect); 196 span.appendChild(connect);
196 197
197 var connectSandboxed = document.createElement('input'); 198 var connectSandboxed = document.createElement('input');
198 connectSandboxed.setAttribute('type', 'button'); 199 connectSandboxed.setAttribute('type', 'button');
199 connectSandboxed.setAttribute('value', 'Connect Sandboxed'); 200 connectSandboxed.setAttribute('value', 'Connect Sandboxed');
200 connectSandboxed.setAttribute('onclick', 201 connectSandboxed.setAttribute('onclick',
201 "window.open('session?hostname=" + encodeURIComponent(host.hostName) + 202 "window.open('session?hostname=" + encodeURIComponent(host.hostName) +
202 "&hostjid=" + encodeURIComponent(host.jabberId) + 203 "&hostjid=" + encodeURIComponent(host.jabberId) +
204 "&http_xmpp_proxy=" + encodeURIComponent(
205 document.getElementById('http_xmpp_proxy').value) +
203 "&connect_method=sandboxed');"); 206 "&connect_method=sandboxed');");
204 span.appendChild(connectSandboxed); 207 span.appendChild(connectSandboxed);
205 208
206 hostEntry.appendChild(span); 209 hostEntry.appendChild(span);
207 hostIcon.setAttribute('src', 'static_files/online.png'); 210 hostIcon.setAttribute('src', 'static_files/online.png');
208 } else { 211 } else {
209 hostIcon.setAttribute('src', 'static_files/offline.png'); 212 hostIcon.setAttribute('src', 'static_files/offline.png');
210 } 213 }
211 214
212 var hostName = document.createElement('p'); 215 var hostName = document.createElement('p');
213 hostName.setAttribute('class', 'hostindent hostname'); 216 hostName.setAttribute('class', 'hostindent hostname');
214 hostName.appendChild(document.createTextNode(host.hostName)); 217 hostName.appendChild(document.createTextNode(host.hostName));
215 hostEntry.appendChild(hostName); 218 hostEntry.appendChild(hostName);
216 219
217 var hostStatus = document.createElement('p'); 220 var hostStatus = document.createElement('p');
218 hostStatus.setAttribute('class', 'hostindent hostinfo hoststatus-' + 221 hostStatus.setAttribute('class', 'hostindent hostinfo hoststatus-' +
219 ((host.status == 'ONLINE') ? 'good' : 'bad')); 222 ((host.status == 'ONLINE') ? 'good' : 'bad'));
220 hostStatus.appendChild(document.createTextNode(host.status)); 223 hostStatus.appendChild(document.createTextNode(host.status));
221 hostEntry.appendChild(hostStatus); 224 hostEntry.appendChild(hostStatus);
222 225
223 var hostInfo = document.createElement('p'); 226 var hostInfo = document.createElement('p');
224 hostInfo.setAttribute('class', 'hostindent hostinfo'); 227 hostInfo.setAttribute('class', 'hostindent hostinfo');
225 hostInfo.appendChild(document.createTextNode(host.jabberId)); 228 hostInfo.appendChild(document.createTextNode(host.jabberId));
226 hostEntry.appendChild(hostInfo); 229 hostEntry.appendChild(hostInfo);
227 230
228 return hostEntry; 231 return hostEntry;
229 } 232 }
233
234 function updateAuthStatus_() {
235 var oauth2_status = document.getElementById('oauth2_status');
236 if (chromoting.oauth2.isAuthenticated()) {
237 oauth2_status.innerText = 'Tokens Good';
238 oauth2_status.style.color = 'green';
239 document.getElementById('oauth2_authorize_button').style.display = 'none';
240 document.getElementById('oauth2_clear_button').style.display = 'inline';
241 populateHostList();
242 } else {
243 oauth2_status.innerText = 'No Tokens';
244 oauth2_status.style.color = 'red';
245 document.getElementById('oauth2_authorize_button').style.display = 'inline';
246 document.getElementById('oauth2_clear_button').style.display = 'none';
247 }
248 }
249
250 function clearOAuth2() {
251 chromoting.oauth2.clear();
252 updateAuthStatus_();
253 }
254
255 function authorizeOAuth2() {
256 var oauth_code_url = 'https://accounts.google.com/o/oauth2/auth?'
257 + 'client_id=' + encodeURIComponent(
258 '440925447803-d9u05st5jjm3gbe865l0jeaujqfrufrn.' +
259 'apps.googleusercontent.com')
260 + '&redirect_uri=' + window.location.origin + '/auth/oauth2_return'
261 + '&scope=' + encodeURIComponent(
262 'https://www.googleapis.com/auth/chromoting ' +
263 'https://www.googleapis.com/auth/googletalk')
264 + '&state=' + encodeURIComponent(window.location.href)
265 + '&response_type=code';
266 window.location.replace(oauth_code_url);
267 }
268
OLDNEW
« no previous file with comments | « remoting/client/appengine/main.py ('k') | remoting/client/extension/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698