| OLD | NEW |
| 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.define('print_preview', function() { | 5 cr.define('print_preview', function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * An interface to the native Chromium printing system layer. | 9 * An interface to the native Chromium printing system layer. |
| 10 * @constructor | 10 * @constructor |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 'previewModifiable': printTicketStore.isDocumentModifiable, | 225 'previewModifiable': printTicketStore.isDocumentModifiable, |
| 226 'printToPDF': destination.id == | 226 'printToPDF': destination.id == |
| 227 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF, | 227 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF, |
| 228 'printWithCloudPrint': !destination.isLocal, | 228 'printWithCloudPrint': !destination.isLocal, |
| 229 'deviceName': destination.id, | 229 'deviceName': destination.id, |
| 230 'isFirstRequest': false, | 230 'isFirstRequest': false, |
| 231 'requestID': -1, | 231 'requestID': -1, |
| 232 'fitToPageEnabled': printTicketStore.isFitToPageEnabled() | 232 'fitToPageEnabled': printTicketStore.isFitToPageEnabled() |
| 233 }; | 233 }; |
| 234 | 234 |
| 235 if (!destination.isLocal && !destination.isPrintWithCloudPrint) { | 235 if (!destination.isLocal) { |
| 236 // We can't set cloudPrintID if the destination is "Print with Cloud | 236 // We can't set cloudPrintID if the destination is "Print with Cloud |
| 237 // Print" because the native system will try to print to Google Cloud | 237 // Print" because the native system will try to print to Google Cloud |
| 238 // Print with this ID instead of opening a Google Cloud Print dialog. | 238 // Print with this ID instead of opening a Google Cloud Print dialog. |
| 239 ticket['cloudPrintID'] = destination.id; | 239 ticket['cloudPrintID'] = destination.id; |
| 240 } | 240 } |
| 241 | 241 |
| 242 if (printTicketStore.hasMarginsCapability() && | 242 if (printTicketStore.hasMarginsCapability() && |
| 243 printTicketStore.getMarginsType() == | 243 printTicketStore.getMarginsType() == |
| 244 print_preview.ticket_items.MarginsType.Value.CUSTOM) { | 244 print_preview.ticket_items.MarginsType.Value.CUSTOM) { |
| 245 var customMargins = printTicketStore.getCustomMargins(); | 245 var customMargins = printTicketStore.getCustomMargins(); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 | 293 |
| 294 /** | 294 /** |
| 295 * Opens the Google Cloud Print sign-in dialog. The DESTINATIONS_RELOAD | 295 * Opens the Google Cloud Print sign-in dialog. The DESTINATIONS_RELOAD |
| 296 * event will be dispatched in response. | 296 * event will be dispatched in response. |
| 297 */ | 297 */ |
| 298 startCloudPrintSignIn: function() { | 298 startCloudPrintSignIn: function() { |
| 299 chrome.send('signIn'); | 299 chrome.send('signIn'); |
| 300 }, | 300 }, |
| 301 | 301 |
| 302 /** Navigates the user to the system printer settings interface. */ | 302 /** Navigates the user to the system printer settings interface. */ |
| 303 startManageLocalPrinters: function() { | 303 startManageLocalDestinations: function() { |
| 304 chrome.send('manageLocalPrinters'); | 304 chrome.send('manageLocalPrinters'); |
| 305 }, | 305 }, |
| 306 | 306 |
| 307 /** Navigates the user to the Google Cloud Print management page. */ | 307 /** Navigates the user to the Google Cloud Print management page. */ |
| 308 startManageCloudPrinters: function() { | 308 startManageCloudDestinations: function() { |
| 309 chrome.send('manageCloudPrinters'); | 309 chrome.send('manageCloudPrinters'); |
| 310 }, | 310 }, |
| 311 | 311 |
| 312 /** | 312 /** |
| 313 * @param {object} initialSettings Object containing all initial settings. | 313 * @param {object} initialSettings Object containing all initial settings. |
| 314 */ | 314 */ |
| 315 onSetInitialSettings_: function(initialSettings) { | 315 onSetInitialSettings_: function(initialSettings) { |
| 316 // TODO(rltoscano): Use initialSettings['cloudPrintData'] to prepopulate | 316 // TODO(rltoscano): Use initialSettings['cloudPrintData'] to prepopulate |
| 317 // destination and initial print ticket. | 317 // destination and initial print ticket. |
| 318 var numberFormatSymbols = | 318 var numberFormatSymbols = |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 return this.initialDestinationId_; | 718 return this.initialDestinationId_; |
| 719 } | 719 } |
| 720 }; | 720 }; |
| 721 | 721 |
| 722 // Export | 722 // Export |
| 723 return { | 723 return { |
| 724 NativeInitialSettings: NativeInitialSettings, | 724 NativeInitialSettings: NativeInitialSettings, |
| 725 NativeLayer: NativeLayer | 725 NativeLayer: NativeLayer |
| 726 }; | 726 }; |
| 727 }); | 727 }); |
| OLD | NEW |