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

Unified Diff: chrome/browser/resources/google_now/utility.js

Issue 35413005: Using instrumented.identity.onSignInChanged to track signed-in state changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Restoring polling Created 7 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/resources/google_now/utility_test_util.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/google_now/utility.js
diff --git a/chrome/browser/resources/google_now/utility.js b/chrome/browser/resources/google_now/utility.js
index 418b6f3098d3e81e8fbfbdd80a4b7a8e218d6507..bfcb6ed076fdc3892b2b13433265944ef5ce702a 100644
--- a/chrome/browser/resources/google_now/utility.js
+++ b/chrome/browser/resources/google_now/utility.js
@@ -393,6 +393,7 @@ var wrapper = (function() {
wrapper.instrumentChromeApiFunction('alarms.get', 1);
wrapper.instrumentChromeApiFunction('alarms.onAlarm.addListener', 0);
wrapper.instrumentChromeApiFunction('identity.getAuthToken', 1);
+wrapper.instrumentChromeApiFunction('identity.onSignInChanged.addListener', 0);
wrapper.instrumentChromeApiFunction('identity.removeCachedAuthToken', 1);
/**
@@ -663,10 +664,7 @@ function buildAttemptManager(
};
}
-// TODO(robliao): Ideally, the authentication watcher infrastructure
-// below would be an API change to chrome.identity.
-// When this happens, remove the code below.
-
+// TODO(robliao): Use signed-in state change watch API when it's available.
/**
* Wraps chrome.identity to provide limited listening support for
* the sign in state by polling periodically for the auth token.
@@ -734,6 +732,10 @@ function buildAuthenticationManager() {
});
}
+ instrumented.identity.onSignInChanged.addListener(function() {
+ isSignedIn(function() {});
+ });
+
instrumented.alarms.onAlarm.addListener(function(alarm) {
if (alarm.name == alarmName)
isSignedIn(function() {});
« no previous file with comments | « no previous file | chrome/browser/resources/google_now/utility_test_util.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698