| 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
|
| };
|
|
|