Index: remoting/client/appengine/static_files/client.js |
diff --git a/remoting/client/appengine/static_files/client.js b/remoting/client/appengine/static_files/client.js |
index b485467097ecd1946e5734ca0e71af074d944efa..584ea6e86ff0f259a3f837e3db6e9326905e03e7 100644 |
--- a/remoting/client/appengine/static_files/client.js |
+++ b/remoting/client/appengine/static_files/client.js |
@@ -190,8 +190,9 @@ function addHostInfo(host) { |
connect.setAttribute('type', 'button'); |
connect.setAttribute('value', 'Connect'); |
connect.setAttribute('onclick', "window.open('session?hostname=" + |
- encodeURIComponent(host.hostName) + "&hostjid=" + |
- encodeURIComponent(host.jabberId) + "');"); |
+ encodeURIComponent(host.hostName) + |
+ "&hostjid=" + encodeURIComponent(host.jabberId) + |
+ "');"); |
span.appendChild(connect); |
var connectSandboxed = document.createElement('input'); |
@@ -200,6 +201,8 @@ function addHostInfo(host) { |
connectSandboxed.setAttribute('onclick', |
"window.open('session?hostname=" + encodeURIComponent(host.hostName) + |
"&hostjid=" + encodeURIComponent(host.jabberId) + |
+ "&http_xmpp_proxy=" + encodeURIComponent( |
+ document.getElementById('http_xmpp_proxy').value) + |
"&connect_method=sandboxed');"); |
span.appendChild(connectSandboxed); |
@@ -227,3 +230,39 @@ function addHostInfo(host) { |
return hostEntry; |
} |
+ |
+function updateAuthStatus_() { |
+ var oauth2_status = document.getElementById('oauth2_status'); |
+ if (chromoting.oauth2.isAuthenticated()) { |
+ oauth2_status.innerText = 'Tokens Good'; |
+ oauth2_status.style.color = 'green'; |
+ document.getElementById('oauth2_authorize_button').style.display = 'none'; |
+ document.getElementById('oauth2_clear_button').style.display = 'inline'; |
+ populateHostList(); |
+ } else { |
+ oauth2_status.innerText = 'No Tokens'; |
+ oauth2_status.style.color = 'red'; |
+ document.getElementById('oauth2_authorize_button').style.display = 'inline'; |
+ document.getElementById('oauth2_clear_button').style.display = 'none'; |
+ } |
+} |
+ |
+function clearOAuth2() { |
+ chromoting.oauth2.clear(); |
+ updateAuthStatus_(); |
+} |
+ |
+function authorizeOAuth2() { |
+ var oauth_code_url = 'https://accounts.google.com/o/oauth2/auth?' |
+ + 'client_id=' + encodeURIComponent( |
+ '440925447803-d9u05st5jjm3gbe865l0jeaujqfrufrn.' + |
+ 'apps.googleusercontent.com') |
+ + '&redirect_uri=' + window.location.origin + '/auth/oauth2_return' |
+ + '&scope=' + encodeURIComponent( |
+ 'https://www.googleapis.com/auth/chromoting ' + |
+ 'https://www.googleapis.com/auth/googletalk') |
+ + '&state=' + encodeURIComponent(window.location.href) |
+ + '&response_type=code'; |
+ window.location.replace(oauth_code_url); |
+} |
+ |