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

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

Issue 1125343004: Add a "Simplify Page" option to the print preview dialog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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.define('print_preview.ticket_items', function() { 5 cr.define('print_preview.ticket_items', function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * Ticket item whose value is a {@code boolean} that represents whether to 9 * Ticket item whose value is a {@code boolean} that represents whether to
10 * print CSS backgrounds. 10 * simplify the page before printing.
11 * @param {!print_preview.AppState} appState App state to persist CSS 11 * @param {!print_preview.AppState} appState App state to persist print
12 * background value. 12 * friendly value.
13 * @param {!print_preview.DocumentInfo} documentInfo Information about the 13 * @param {!print_preview.DocumentInfo} documentInfo Information about the
14 * document to print. 14 * document to print.
15 * @constructor 15 * @constructor
16 * @extends {print_preview.ticket_items.TicketItem} 16 * @extends {print_preview.ticket_items.TicketItem}
17 */ 17 */
18 function CssBackground(appState, documentInfo) { 18 function PrintFriendly(appState, documentInfo, selectionOnly) {
19 print_preview.ticket_items.TicketItem.call( 19 print_preview.ticket_items.TicketItem.call(
20 this, 20 this,
21 appState, 21 appState,
22 print_preview.AppState.Field.IS_CSS_BACKGROUND_ENABLED, 22 print_preview.AppState.Field.IS_PRINT_FRIENDLY_ENABLED,
23 null /*destinationStore*/, 23 null /*destinationStore*/,
24 documentInfo); 24 documentInfo);
25
26 this.isAvailable_ = false;
27
28 this.selectionOnly_ = selectionOnly;
25 }; 29 };
26 30
27 CssBackground.prototype = { 31 PrintFriendly.prototype = {
28 __proto__: print_preview.ticket_items.TicketItem.prototype, 32 __proto__: print_preview.ticket_items.TicketItem.prototype,
29 33
30 /** @override */ 34 /** @override */
31 wouldValueBeValid: function(value) { 35 wouldValueBeValid: function(value) {
32 return true; 36 return true;
33 }, 37 },
34 38
35 /** @override */ 39 /** @override */
36 isCapabilityAvailable: function() { 40 isCapabilityAvailable: function() {
37 return this.getDocumentInfoInternal().isModifiable; 41 return this.isAvailable_ && !this.selectionOnly_.getValue();
38 }, 42 },
39 43
40 /** @override */ 44 /** @override */
41 getDefaultValueInternal: function() { 45 getDefaultValueInternal: function() {
42 return false; 46 return false;
43 }, 47 },
44 48
45 /** @override */ 49 /** @override */
46 getCapabilityNotAvailableValueInternal: function() { 50 getCapabilityNotAvailableValueInternal: function() {
47 return false; 51 return false;
52 },
53
54 setIsCapabilityAvailable: function(isAvailable) {
55 this.isAvailable_ = isAvailable;
48 } 56 }
49 }; 57 };
50 58
51 // Export 59 // Export
52 return { 60 return {
53 CssBackground: CssBackground 61 PrintFriendly: PrintFriendly
54 }; 62 };
55 }); 63 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698