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

Unified Diff: remoting/webapp/me2mom/remoting.js

Issue 7016001: Simple OAuth1 implementation based on http://code.google.com/chrome/extensions/tut_oauth.html. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/webapp/me2mom/remoting.js
diff --git a/remoting/webapp/me2mom/remoting.js b/remoting/webapp/me2mom/remoting.js
index 72a3b707f0ee727ede036f3e478b268a5493cf69..0ddebca751bef3c44cd852bd6aa54ccece801753 100644
--- a/remoting/webapp/me2mom/remoting.js
+++ b/remoting/webapp/me2mom/remoting.js
@@ -6,16 +6,36 @@ var chromoting = {};
XMPP_TOKEN_NAME = 'xmpp_token';
OAUTH2_TOKEN_NAME = 'oauth2_token';
+function updateAuthStatus() {
+ var oauth1_status = document.getElementById('oauth1_status');
+ if (chromoting.oauth.hasToken()) {
+ oauth1_status.innerText = 'OK';
+ oauth1_status.style.color='green';
+ } else {
+ oauth1_status.innerText = 'Unauthorized';
+ oauth1_status.style.color='red';
+ }
+}
+
+function authorizeOAuth1() {
+ chromoting.oauth.authorize(updateAuthStatus);
+}
+
+function clearOAuth1() {
+ chromoting.oauth.clearTokens();
+ updateAuthStatus();
+}
+
function initAuthPanel_() {
- document.getElementById('oauth2_token').value =
- chromoting.getItem(OAUTH2_TOKEN_NAME);
document.getElementById('xmpp_token').value =
chromoting.getItem(XMPP_TOKEN_NAME);
+ updateAuthStatus();
}
function initBackgroundFuncs_() {
chromoting.getItem = chrome.extension.getBackgroundPage().getItem;
chromoting.setItem = chrome.extension.getBackgroundPage().setItem;
+ chromoting.oauth = chrome.extension.getBackgroundPage().oauth;
}
function saveCredentials(form) {
« remoting/webapp/me2mom/chrome_ex_oauthsimple.js ('K') | « remoting/webapp/me2mom/manifest.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698