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

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: Resolve conflicts 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(rltoscano): Technically, the print destination can still change
49 // the 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.documentInfo_.hasCssMediaStyles &&
54 this.capabilitiesHolder_.get().hasOrientationCapability;
55 },
56
57 /** @override */
58 getDefaultValueInternal: function() {
59 return this.capabilitiesHolder_.get().defaultIsLandscapeEnabled;
60 },
61
62 /** @override */
63 getCapabilityNotAvailableValueInternal: function() {
64 return false;
65 }
66 };
67
68 // Export
69 return {
70 Landscape: Landscape
71 };
72 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698