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

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

Issue 844503005: Convert now component to use GCM rather than pushMessaging. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: responseType = text to application/json Created 5 years, 10 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 | « chrome/browser/resources/google_now/manifest.json ('k') | no next file » | 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 dfcb8d8f3ad66b7c2d4534f4866932266826c1bc..c5b3d57c1f341ac241b99ea3e7d1e29f3559f8b3 100644
--- a/chrome/browser/resources/google_now/utility.js
+++ b/chrome/browser/resources/google_now/utility.js
@@ -982,15 +982,25 @@ function buildAuthenticationManager() {
}
/**
+ * Determines the active account's login (username).
+ * @return {Promise} A promise to determine the current account's login.
+ */
+ function getLogin() {
+ return new Promise(function(resolve) {
+ instrumented.webstorePrivate.getBrowserLogin(function(accountInfo) {
+ resolve(accountInfo.login);
+ });
+ });
+ }
+
+ /**
* Determines whether there is an account attached to the profile.
* @return {Promise} A promise to determine if there is an account attached
* to the profile.
*/
function isSignedIn() {
- return new Promise(function(resolve) {
- instrumented.webstorePrivate.getBrowserLogin(function(accountInfo) {
- resolve(!!accountInfo.login);
- });
+ return getLogin().then(function(login) {
+ return Promise.resolve(!!login);
});
}
@@ -1055,6 +1065,7 @@ function buildAuthenticationManager() {
return {
addListener: addListener,
getAuthToken: getAuthToken,
+ getLogin: getLogin,
isSignedIn: isSignedIn,
removeToken: removeToken
};
« no previous file with comments | « chrome/browser/resources/google_now/manifest.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698