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

Unified Diff: chrome/browser/resources/print_preview/data/user_info.js

Issue 233623003: Remember and restore the account last used destination is registered for. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adjust PrintPreview unit test. Created 6 years, 8 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: chrome/browser/resources/print_preview/data/user_info.js
diff --git a/chrome/browser/resources/print_preview/data/user_info.js b/chrome/browser/resources/print_preview/data/user_info.js
index 354542c80c1d844dbe5b7d70118f9e9426945f56..88967cefdedfa774c53952c7ccc725416e85f716 100644
--- a/chrome/browser/resources/print_preview/data/user_info.js
+++ b/chrome/browser/resources/print_preview/data/user_info.js
@@ -23,10 +23,10 @@ cr.define('print_preview', function() {
/**
* Email addresses of the logged in users or empty array if no user is
- * logged in.
- * @private {!Array.<string>}
+ * logged in. {@code null} if not known yet.
+ * @private {?Array.<string>}
*/
- this.users_ = [];
+ this.users_ = null;
};
/**
@@ -41,6 +41,16 @@ cr.define('print_preview', function() {
UserInfo.prototype = {
__proto__: cr.EventTarget.prototype,
+ /** @return {boolean} Whether user accounts are already retrieved. */
+ get initialized() {
+ return this.users_ != null;
+ },
+
+ /** @return {boolean} Whether user is logged in or not. */
+ get loggedIn() {
+ return !!this.activeUser;
+ },
+
/**
* @return {?string} Email address of the logged in user or {@code null} if
* no user is logged.
@@ -57,10 +67,9 @@ cr.define('print_preview', function() {
}
},
-
/**
- * @return {!Array.<string>} Email addresses of the logged in users or
- * empty array if no user is logged in.
+ * @return {?Array.<string>} Email addresses of the logged in users or
+ * empty array if no user is logged in. {@code null} if not known yet.
*/
get users() {
return this.users_;
@@ -68,7 +77,7 @@ cr.define('print_preview', function() {
/**
* Sets logged in user accounts info.
- * @param {string} user Currently logged in user (email).
+ * @param {string} activeUser Active user account (email).
* @param {!Array.<string>} users List of currently logged in accounts.
*/
setUsers: function(activeUser, users) {

Powered by Google App Engine
This is Rietveld 408576698