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

Side by Side Diff: chrome/browser/resources/print_preview/data/ticket_items/distill_page.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: More refactors and remove tab_helpers dependency Created 5 years, 5 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.
Avi (use Gerrit) 2015/07/23 18:25:52 For new files, remove the (c). One day we'll get a
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 selection only. 10 * distill the page before printing.
11 * @param {!print_preview.DocumentInfo} documentInfo Information about the 11 * @param {!print_preview.DocumentInfo} documentInfo Information about the
12 * document to print. 12 * document to print.
13 * @param {!print_preview.SelectionOnly} selectionOnly Ticket definig whether
14 * only selected content should be printed.
13 * @constructor 15 * @constructor
14 * @extends {print_preview.ticket_items.TicketItem} 16 * @extends {print_preview.ticket_items.TicketItem}
15 */ 17 */
16 function SelectionOnly(documentInfo) { 18 function DistillPage(documentInfo, selectionOnly) {
17 print_preview.ticket_items.TicketItem.call( 19 print_preview.ticket_items.TicketItem.call(
18 this, 20 this,
19 null /*appState*/, 21 null /*appState*/,
20 null /*field*/, 22 null /*field*/,
21 null /*destinationStore*/, 23 null /*destinationStore*/,
22 documentInfo); 24 documentInfo);
25
26 this.isAvailable_ = false;
27
28 this.selectionOnly_ = selectionOnly;
23 }; 29 };
24 30
25 SelectionOnly.prototype = { 31 DistillPage.prototype = {
26 __proto__: print_preview.ticket_items.TicketItem.prototype, 32 __proto__: print_preview.ticket_items.TicketItem.prototype,
27 33
28 /** @override */ 34 /** @override */
29 wouldValueBeValid: function(value) { 35 wouldValueBeValid: function(value) {
30 return true; 36 return true;
31 }, 37 },
32 38
33 /** @override */ 39 /** @override */
34 isCapabilityAvailable: function() { 40 isCapabilityAvailable: function() {
35 return this.getDocumentInfoInternal().isModifiable && 41 return this.isAvailable_;
36 this.getDocumentInfoInternal().hasSelection;
37 }, 42 },
38 43
39 /** @override */ 44 /** @override */
40 getDefaultValueInternal: function() { 45 getDefaultValueInternal: function() {
41 return false; 46 return false;
42 }, 47 },
43 48
44 /** @override */ 49 /** @override */
45 getCapabilityNotAvailableValueInternal: function() { 50 getCapabilityNotAvailableValueInternal: function() {
46 return false; 51 return false;
52 },
53
54 setIsCapabilityAvailable: function(isAvailable) {
55 if (this.isAvailable_ == isAvailable)
56 return;
57
58 this.isAvailable_ = isAvailable;
59 this.dispatchChangeEventInternal();
47 } 60 }
48 }; 61 };
49 62
50 // Export 63 // Export
51 return { 64 return {
52 SelectionOnly: SelectionOnly 65 DistillPage: DistillPage
53 }; 66 };
54 }); 67 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698