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

Unified 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: more fixed. 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 side-by-side diff with in-line comments
Download patch
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);
+}
+

Powered by Google App Engine
This is Rietveld 408576698