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

Side by Side Diff: chrome/browser/resources/print_preview/data/destination.js

Issue 575333002: Compile print_preview, part 2: reduce down to 260 errors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@I_print_preview
Patch Set: revert movement of enums: now handle in compiler pass Created 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.exportPath('print_preview');
6
7 /**
8 * The CDD (Cloud Device Description) describes the capabilities of a print
9 * destination.
10 *
11 * @typedef {{
12 * version: string,
13 * printer: {
14 * vendor_capability: !Array.<{Object}>,
15 * collate: ({default: (boolean|undefined)}|undefined),
16 * color: ({
17 * option: !Array.<{
18 * type: (string|undefined),
19 * vendor_id: (string|undefined),
20 * custom_display_name: (string|undefined),
21 * is_default: (boolean|undefined)
22 * }>
23 * }|undefined),
24 * copies: ({default: (number|undefined),
25 * max: (number|undefined)}|undefined),
26 * duplex: ({option: !Array.<{type: (string|undefined),
27 * is_default: (boolean|undefined)}>}|undefined),
28 * page_orientation: ({
29 * option: !Array.<{type: (string|undefined),
30 * is_default: (boolean|undefined)}>
31 * }|undefined)
32 * }
33 * }}
34 */
35 print_preview.Cdd;
36
5 cr.define('print_preview', function() { 37 cr.define('print_preview', function() {
6 'use strict'; 38 'use strict';
7 39
8 /** 40 /**
9 * Print destination data object that holds data for both local and cloud 41 * Print destination data object that holds data for both local and cloud
10 * destinations. 42 * destinations.
11 * @param {string} id ID of the destination. 43 * @param {string} id ID of the destination.
12 * @param {!print_preview.Destination.Type} type Type of the destination. 44 * @param {!print_preview.Destination.Type} type Type of the destination.
13 * @param {!print_preview.Destination.Origin} origin Origin of the 45 * @param {!print_preview.Destination.Origin} origin Origin of the
14 * destination. 46 * destination.
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 */ 139 */
108 this.lastAccessTime_ = (opt_params && opt_params.lastAccessTime) || 140 this.lastAccessTime_ = (opt_params && opt_params.lastAccessTime) ||
109 Date.now(); 141 Date.now();
110 142
111 /** 143 /**
112 * Whether the user has accepted the terms-of-service for the print 144 * Whether the user has accepted the terms-of-service for the print
113 * destination. Only applies to the FedEx Office cloud-based printer. 145 * destination. Only applies to the FedEx Office cloud-based printer.
114 * {@code null} if terms-of-service does not apply to the print destination. 146 * {@code null} if terms-of-service does not apply to the print destination.
115 * @private {?boolean} 147 * @private {?boolean}
116 */ 148 */
117 this.isTosAccepted_ = opt_params && opt_params.isTosAccepted; 149 this.isTosAccepted_ = !!(opt_params && opt_params.isTosAccepted);
118 150
119 /** 151 /**
120 * Cloud ID for Privet printers. 152 * Cloud ID for Privet printers.
121 * @private {string} 153 * @private {string}
122 */ 154 */
123 this.cloudID_ = (opt_params && opt_params.cloudID) || ''; 155 this.cloudID_ = (opt_params && opt_params.cloudID) || '';
124 }; 156 };
125 157
126 /** 158 /**
127 * Prefix of the location destination tag. 159 * Prefix of the location destination tag.
(...skipping 14 matching lines...) Expand all
142 FEDEX: '__google__fedex', 174 FEDEX: '__google__fedex',
143 SAVE_AS_PDF: 'Save as PDF' 175 SAVE_AS_PDF: 'Save as PDF'
144 }; 176 };
145 177
146 /** 178 /**
147 * Enumeration of the types of destinations. 179 * Enumeration of the types of destinations.
148 * @enum {string} 180 * @enum {string}
149 */ 181 */
150 Destination.Type = { 182 Destination.Type = {
151 GOOGLE: 'google', 183 GOOGLE: 'google',
184 GOOGLE_PROMOTED: 'google_promoted',
152 LOCAL: 'local', 185 LOCAL: 'local',
153 MOBILE: 'mobile' 186 MOBILE: 'mobile'
154 }; 187 };
155 188
156 /** 189 /**
157 * Enumeration of the origin types for cloud destinations. 190 * Enumeration of the origin types for cloud destinations.
158 * @enum {string} 191 * @enum {string}
159 */ 192 */
160 Destination.Origin = { 193 Destination.Origin = {
161 LOCAL: 'local', 194 LOCAL: 'local',
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 return [this.location, this.description]; 449 return [this.location, this.description];
417 }, 450 },
418 451
419 /** 452 /**
420 * Matches a query against the destination. 453 * Matches a query against the destination.
421 * @param {!RegExp} query Query to match against the destination. 454 * @param {!RegExp} query Query to match against the destination.
422 * @return {boolean} {@code true} if the query matches this destination, 455 * @return {boolean} {@code true} if the query matches this destination,
423 * {@code false} otherwise. 456 * {@code false} otherwise.
424 */ 457 */
425 matches: function(query) { 458 matches: function(query) {
426 return this.displayName_.match(query) || 459 return !!this.displayName_.match(query) ||
427 this.extraPropertiesToMatch.some(function(property) { 460 this.extraPropertiesToMatch.some(function(property) {
428 return property.match(query); 461 return property.match(query);
429 }); 462 });
430 } 463 }
431 }; 464 };
432 465
433 /**
434 * The CDD (Cloud Device Description) describes the capabilities of a print
435 * destination.
436 *
437 * @typedef {{
438 * version: string,
439 * printer: {
440 * vendor_capability: !Array.<{Object}>,
441 * collate: {default: boolean=}=,
442 * color: {
443 * option: !Array.<{
444 * type: string=,
445 * vendor_id: string=,
446 * custom_display_name: string=,
447 * is_default: boolean=
448 * }>
449 * }=,
450 * copies: {default: number=, max: number=}=,
451 * duplex: {option: !Array.<{type: string=, is_default: boolean=}>}=,
452 * page_orientation: {
453 * option: !Array.<{type: string=, is_default: boolean=}>
454 * }=
455 * }
456 * }}
457 */
458 var Cdd = Object;
459
460 // Export 466 // Export
461 return { 467 return {
462 Destination: Destination, 468 Destination: Destination,
463 Cdd: Cdd
464 }; 469 };
465 }); 470 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/print_preview/component.js ('k') | chrome/browser/resources/print_preview/data/destination_store.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698