Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / resources / print_preview / data / destination.js
index d35a6d6..11af3f4 100644 (file)
@@ -18,6 +18,7 @@ cr.define('print_preview', function() {
    *     Connection status of the print destination.
    * @param {{tags: Array.<string>,
    *          isOwned: ?boolean,
+   *          account: ?string,
    *          lastAccessTime: ?number,
    *          isTosAccepted: ?boolean,
    *          cloudID: ?string,
@@ -76,6 +77,12 @@ cr.define('print_preview', function() {
     this.isOwned_ = (opt_params && opt_params.isOwned) || false;
 
     /**
+     * Account this destination is registered for, if known.
+     * @private {string}
+     */
+    this.account_ = (opt_params && opt_params.account) || '';
+
+    /**
      * Cache of destination location fetched from tags.
      * @private {?string}
      */
@@ -230,6 +237,13 @@ cr.define('print_preview', function() {
       return this.isOwned_;
     },
 
+    /**
+     * @return {string} Account this destination is registered for, if known.
+     */
+    get account() {
+      return this.account_;
+    },
+
     /** @return {boolean} Whether the destination is local or cloud-based. */
     get isLocal() {
       return this.origin_ == Destination.Origin.LOCAL ||
@@ -270,6 +284,18 @@ cr.define('print_preview', function() {
       return this.description_;
     },
 
+    /**
+     * @return {string} Most relevant string to help user to identify this
+     *     destination.
+     */
+    get hint() {
+      if (this.id_ == Destination.GooglePromotedId.DOCS ||
+          this.id_ == Destination.GooglePromotedId.FEDEX) {
+        return this.account_;
+      }
+      return this.location || this.description;
+    },
+
     /** @return {!Array.<string>} Tags associated with the destination. */
     get tags() {
       return this.tags_.slice(0);