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

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

Issue 10108001: Refactor print preview web ui (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes broken tests Created 8 years, 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 cr.define('print_preview.ticket_items', function() {
6 'use strict';
7
8 /**
9 * Landscape ticket item whose value is a {@code boolean} that indicates
10 * whether the document should be printed in landscape orientation.
11 * @param {!print_preview.CapabilitiesHolder} capabilitiesHolder Capabilities
12 * holder used to determine the default landscape value and if landscape
13 * printing is available.
14 * @param {!print_preview.DocumentInfo} documentInfo Information about the
15 * document to print.
16 * @constructor
17 * @extends {print_preview.ticket_items.TicketItem}
18 */
19 function Landscape(capabilitiesHolder, documentInfo) {
20 print_preview.ticket_items.TicketItem.call(this);
21
22 /**
23 * Capabilities holder used to determine the default landscape value and if
24 * landscape printing is available.
25 * @type {!print_preview.CapabilitiesHolder}
26 * @private
27 */
28 this.capabilitiesHolder_ = capabilitiesHolder;
29
30 /**
31 * Information about the document to print.
32 * @type {!print_preview.DocumentInfo}
33 * @private
34 */
35 this.documentInfo_ = documentInfo;
36 };
37
38 Landscape.prototype = {
39 __proto__: print_preview.ticket_items.TicketItem.prototype,
40
41 /** @override */
42 wouldValueBeValid: function(value) {
43 return true;
44 },
45
46 /** @override */
47 isCapabilityAvailable: function() {
48 // TODO Technically, the print destination can still change the
49 // orientation of the print out (at least for cloud printers) if the
50 // document is not modifiable. But the preview wouldn't update in this
51 // case so it would be a bad user experience.
52 return this.documentInfo_.isModifiable &&
53 this.capabilitiesHolder_.get().hasOrientationCapability;
54 },
55
56 /** @override */
57 getDefaultValueInternal: function() {
58 return this.capabilitiesHolder_.get().defaultIsLandscapeEnabled;
59 },
60
61 /** @override */
62 getCapabilityNotAvailableValueInternal: function() {
63 return false;
64 }
65 };
66
67 // Export
68 return {
69 Landscape: Landscape
70 };
71 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698