Only grant permissions to new extensions from sync if they have the expected version
[chromium-blink-merge.git] / chrome / browser / resources / print_preview / data / ticket_items / collate.js
blobabf306de42cb06e012b53e26e39c5df82e333a17
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
3 // found in the LICENSE file.
5 cr.define('print_preview.ticket_items', function() {
6 'use strict';
8 /**
9 * Collate ticket item whose value is a {@code boolean} that indicates whether
10 * collation is enabled.
11 * @param {!print_preview.AppState} appState App state used to persist collate
12 * selection.
13 * @param {!print_preview.DestinationStore} destinationStore Destination store
14 * used determine if a destination has the collate capability.
15 * @constructor
16 * @extends {print_preview.ticket_items.TicketItem}
18 function Collate(appState, destinationStore) {
19 print_preview.ticket_items.TicketItem.call(
20 this,
21 appState,
22 print_preview.AppState.Field.IS_COLLATE_ENABLED,
23 destinationStore);
26 Collate.prototype = {
27 __proto__: print_preview.ticket_items.TicketItem.prototype,
29 /** @override */
30 wouldValueBeValid: function(value) {
31 return true;
34 /** @override */
35 isCapabilityAvailable: function() {
36 return !!this.getCollateCapability_();
39 /** @override */
40 getDefaultValueInternal: function() {
41 var capability = this.getCollateCapability_();
42 return capability.hasOwnProperty('default') ? capability.default : true;
45 /** @override */
46 getCapabilityNotAvailableValueInternal: function() {
47 return true;
50 /**
51 * @return {Object} Collate capability of the selected destination.
52 * @private
54 getCollateCapability_: function() {
55 var dest = this.getSelectedDestInternal();
56 return (dest &&
57 dest.capabilities &&
58 dest.capabilities.printer &&
59 dest.capabilities.printer.collate) ||
60 null;
64 // Export
65 return {
66 Collate: Collate
68 });