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

Side by Side Diff: chrome/browser/resources/print_preview/native_layer.js

Issue 588713002: Compile print_preview, part 3: reduce down to 185 errors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@I_print_preview_2
Patch Set: fix assert Created 6 years, 2 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) 2012 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.exportPath('print_preview');
6
7 /**
8 * @typedef {{selectSaveAsPdfDestination: boolean,
9 * layoutSettings.portrait: boolean,
10 * pageRange: string,
11 * headersAndFooters: boolean,
12 * backgroundColorsAndImages: boolean,
13 * margins: number}}
14 * @see chrome/browser/printing/print_preview_pdf_generated_browsertest.cc
15 */
16 print_preview.PreviewSettings;
17
5 cr.define('print_preview', function() { 18 cr.define('print_preview', function() {
6 'use strict'; 19 'use strict';
7 20
8 /** 21 /**
9 * An interface to the native Chromium printing system layer. 22 * An interface to the native Chromium printing system layer.
10 * @constructor 23 * @constructor
11 * @extends {cr.EventTarget} 24 * @extends {cr.EventTarget}
12 */ 25 */
13 function NativeLayer() { 26 function NativeLayer() {
14 cr.EventTarget.call(this); 27 cr.EventTarget.call(this);
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 186
174 /** 187 /**
175 * @param {!print_preview.Destination} destination Destination to print to. 188 * @param {!print_preview.Destination} destination Destination to print to.
176 * @param {!print_preview.ticket_items.Color} color Color ticket item. 189 * @param {!print_preview.ticket_items.Color} color Color ticket item.
177 * @return {number} Native layer color model. 190 * @return {number} Native layer color model.
178 * @private 191 * @private
179 */ 192 */
180 getNativeColorModel_: function(destination, color) { 193 getNativeColorModel_: function(destination, color) {
181 // For non-local printers native color model is ignored anyway. 194 // For non-local printers native color model is ignored anyway.
182 var option = destination.isLocal ? color.getSelectedOption() : null; 195 var option = destination.isLocal ? color.getSelectedOption() : null;
183 var nativeColorModel = parseInt(option ? option.vendor_id : null); 196 var nativeColorModel = parseInt(option ? option.vendor_id : null, 10);
184 if (isNaN(nativeColorModel)) { 197 if (isNaN(nativeColorModel)) {
185 return color.getValue() ? 198 return color.getValue() ?
186 NativeLayer.ColorMode_.COLOR : NativeLayer.ColorMode_.GRAY; 199 NativeLayer.ColorMode_.COLOR : NativeLayer.ColorMode_.GRAY;
187 } 200 }
188 return nativeColorModel; 201 return nativeColorModel;
189 }, 202 },
190 203
191 /** 204 /**
192 * Requests that a preview be generated. The following events may be 205 * Requests that a preview be generated. The following events may be
193 * dispatched in response: 206 * dispatched in response:
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 * @private 724 * @private
712 */ 725 */
713 onEnableManipulateSettingsForTest_: function() { 726 onEnableManipulateSettingsForTest_: function() {
714 global.onManipulateSettingsForTest = 727 global.onManipulateSettingsForTest =
715 this.onManipulateSettingsForTest_.bind(this); 728 this.onManipulateSettingsForTest_.bind(this);
716 }, 729 },
717 730
718 /** 731 /**
719 * Dispatches an event to print_preview.js to change 732 * Dispatches an event to print_preview.js to change
720 * a particular setting for print preview. 733 * a particular setting for print preview.
721 * @param {!Object} settings Object containing the value to be 734 * @param {!print_preview.PreviewSettings} settings Object containing the
722 * changed and that value should be set to. 735 * value to be changed and that value should be set to.
723 * @private 736 * @private
724 */ 737 */
725 onManipulateSettingsForTest_: function(settings) { 738 onManipulateSettingsForTest_: function(settings) {
726 var manipulateSettingsEvent = 739 var manipulateSettingsEvent =
727 new Event(NativeLayer.EventType.MANIPULATE_SETTINGS_FOR_TEST); 740 new Event(NativeLayer.EventType.MANIPULATE_SETTINGS_FOR_TEST);
728 manipulateSettingsEvent.settings = settings; 741 manipulateSettingsEvent.settings = settings;
729 this.dispatchEvent(manipulateSettingsEvent); 742 this.dispatchEvent(manipulateSettingsEvent);
730 }, 743 },
731 744
732 /** 745 /**
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 return this.serializedAppStateStr_; 955 return this.serializedAppStateStr_;
943 } 956 }
944 }; 957 };
945 958
946 // Export 959 // Export
947 return { 960 return {
948 NativeInitialSettings: NativeInitialSettings, 961 NativeInitialSettings: NativeInitialSettings,
949 NativeLayer: NativeLayer 962 NativeLayer: NativeLayer
950 }; 963 };
951 }); 964 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698