| 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 * A data store that stores destinations and dispatches events when the data | 9 * A data store that stores destinations and dispatches events when the data |
| 10 * store changes. | 10 * store changes. |
| (...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1352 } else { | 1352 } else { |
| 1353 return false; | 1353 return false; |
| 1354 } | 1354 } |
| 1355 }, | 1355 }, |
| 1356 | 1356 |
| 1357 /** | 1357 /** |
| 1358 * Binds handlers to events. | 1358 * Binds handlers to events. |
| 1359 * @private | 1359 * @private |
| 1360 */ | 1360 */ |
| 1361 addEventListeners_: function() { | 1361 addEventListeners_: function() { |
| 1362 var nativeLayerEventTarget = this.nativeLayer_.getEventTarget(); |
| 1362 this.tracker_.add( | 1363 this.tracker_.add( |
| 1363 this.nativeLayer_, | 1364 nativeLayerEventTarget, |
| 1364 print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET, | 1365 print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET, |
| 1365 this.onLocalDestinationsSet_.bind(this)); | 1366 this.onLocalDestinationsSet_.bind(this)); |
| 1366 this.tracker_.add( | 1367 this.tracker_.add( |
| 1367 this.nativeLayer_, | 1368 nativeLayerEventTarget, |
| 1368 print_preview.NativeLayer.EventType.CAPABILITIES_SET, | 1369 print_preview.NativeLayer.EventType.CAPABILITIES_SET, |
| 1369 this.onLocalDestinationCapabilitiesSet_.bind(this)); | 1370 this.onLocalDestinationCapabilitiesSet_.bind(this)); |
| 1370 this.tracker_.add( | 1371 this.tracker_.add( |
| 1371 this.nativeLayer_, | 1372 nativeLayerEventTarget, |
| 1372 print_preview.NativeLayer.EventType.GET_CAPABILITIES_FAIL, | 1373 print_preview.NativeLayer.EventType.GET_CAPABILITIES_FAIL, |
| 1373 this.onGetCapabilitiesFail_.bind(this)); | 1374 this.onGetCapabilitiesFail_.bind(this)); |
| 1374 this.tracker_.add( | 1375 this.tracker_.add( |
| 1375 this.nativeLayer_, | 1376 nativeLayerEventTarget, |
| 1376 print_preview.NativeLayer.EventType.DESTINATIONS_RELOAD, | 1377 print_preview.NativeLayer.EventType.DESTINATIONS_RELOAD, |
| 1377 this.onDestinationsReload_.bind(this)); | 1378 this.onDestinationsReload_.bind(this)); |
| 1378 this.tracker_.add( | 1379 this.tracker_.add( |
| 1379 this.nativeLayer_, | 1380 nativeLayerEventTarget, |
| 1380 print_preview.NativeLayer.EventType.PRIVET_PRINTER_CHANGED, | 1381 print_preview.NativeLayer.EventType.PRIVET_PRINTER_CHANGED, |
| 1381 this.onPrivetPrinterAdded_.bind(this)); | 1382 this.onPrivetPrinterAdded_.bind(this)); |
| 1382 this.tracker_.add( | 1383 this.tracker_.add( |
| 1383 this.nativeLayer_, | 1384 nativeLayerEventTarget, |
| 1384 print_preview.NativeLayer.EventType.PRIVET_CAPABILITIES_SET, | 1385 print_preview.NativeLayer.EventType.PRIVET_CAPABILITIES_SET, |
| 1385 this.onPrivetCapabilitiesSet_.bind(this)); | 1386 this.onPrivetCapabilitiesSet_.bind(this)); |
| 1386 this.tracker_.add( | 1387 this.tracker_.add( |
| 1387 this.nativeLayer_, | 1388 nativeLayerEventTarget, |
| 1388 print_preview.NativeLayer.EventType.EXTENSION_PRINTERS_ADDED, | 1389 print_preview.NativeLayer.EventType.EXTENSION_PRINTERS_ADDED, |
| 1389 this.onExtensionPrintersAdded_.bind(this)); | 1390 this.onExtensionPrintersAdded_.bind(this)); |
| 1390 this.tracker_.add( | 1391 this.tracker_.add( |
| 1391 this.nativeLayer_, | 1392 nativeLayerEventTarget, |
| 1392 print_preview.NativeLayer.EventType.EXTENSION_CAPABILITIES_SET, | 1393 print_preview.NativeLayer.EventType.EXTENSION_CAPABILITIES_SET, |
| 1393 this.onExtensionCapabilitiesSet_.bind(this)); | 1394 this.onExtensionCapabilitiesSet_.bind(this)); |
| 1394 this.tracker_.add( | 1395 this.tracker_.add( |
| 1395 this.nativeLayer_, | 1396 nativeLayerEventTarget, |
| 1396 print_preview.NativeLayer.EventType.PROVISIONAL_DESTINATION_RESOLVED, | 1397 print_preview.NativeLayer.EventType.PROVISIONAL_DESTINATION_RESOLVED, |
| 1397 this.handleProvisionalDestinationResolved_.bind(this)); | 1398 this.handleProvisionalDestinationResolved_.bind(this)); |
| 1398 }, | 1399 }, |
| 1399 | 1400 |
| 1400 /** | 1401 /** |
| 1401 * Creates a local PDF print destination. | 1402 * Creates a local PDF print destination. |
| 1402 * @private | 1403 * @private |
| 1403 */ | 1404 */ |
| 1404 createLocalPdfPrintDestination_: function() { | 1405 createLocalPdfPrintDestination_: function() { |
| 1405 // TODO(alekseys): Create PDF printer in the native code and send its | 1406 // TODO(alekseys): Create PDF printer in the native code and send its |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1696 return this.getDestinationKey_( | 1697 return this.getDestinationKey_( |
| 1697 destination.origin, destination.id, destination.account); | 1698 destination.origin, destination.id, destination.account); |
| 1698 } | 1699 } |
| 1699 }; | 1700 }; |
| 1700 | 1701 |
| 1701 // Export | 1702 // Export |
| 1702 return { | 1703 return { |
| 1703 DestinationStore: DestinationStore | 1704 DestinationStore: DestinationStore |
| 1704 }; | 1705 }; |
| 1705 }); | 1706 }); |
| OLD | NEW |