| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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('cloudprint', function() { | 5 cr.define('cloudprint', function() { |
| 6 | 6 |
| 7 // The URL to use to access the cloud print servers. | 7 // The URL to use to access the cloud print servers. |
| 8 // Set by a call to setBaseURL. | 8 // Set by a call to setBaseURL. |
| 9 var cloudPrintBaseURL = ''; | 9 var cloudPrintBaseURL = ''; |
| 10 | 10 |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 // Remove empty entry added by setDefaultPrinter. | 394 // Remove empty entry added by setDefaultPrinter. |
| 395 if (printerList[0] && printerList[0].textContent == '') | 395 if (printerList[0] && printerList[0].textContent == '') |
| 396 printerList.remove(0); | 396 printerList.remove(0); |
| 397 } | 397 } |
| 398 if (printers != null) { | 398 if (printers != null) { |
| 399 for (var i = 0; i < printers.length; i++) { | 399 for (var i = 0; i < printers.length; i++) { |
| 400 if (!cloudPrinterAlreadyAdded(printers[i]['id'])) { | 400 if (!cloudPrinterAlreadyAdded(printers[i]['id'])) { |
| 401 if (!trackCloudPrinterAdded(printers[i]['id'])) { | 401 if (!trackCloudPrinterAdded(printers[i]['id'])) { |
| 402 break; | 402 break; |
| 403 } | 403 } |
| 404 if (printers[i]['displayName'] && printers[i]['displayName'] != '') |
| 405 var name = printers[i]['displayName']; |
| 406 else |
| 407 var name = printers[i]['name']; |
| 408 |
| 404 var option = addDestinationListOptionAtPosition( | 409 var option = addDestinationListOptionAtPosition( |
| 405 lastCloudPrintOptionPos++, | 410 lastCloudPrintOptionPos++, |
| 406 printers[i]['name'], | 411 name, |
| 407 printers[i]['id'], | 412 printers[i]['id'], |
| 408 printers[i]['name'] == defaultOrLastUsedPrinterName, | 413 name == defaultOrLastUsedPrinterName, |
| 409 false, | 414 false, |
| 410 false); | 415 false); |
| 411 cloudprint.setCloudPrint(option, | 416 cloudprint.setCloudPrint(option, |
| 412 printers[i]['name'], | 417 name, |
| 413 printers[i]['id']); | 418 printers[i]['id']); |
| 414 } | 419 } |
| 415 } | 420 } |
| 416 } else { | 421 } else { |
| 417 if (!cloudPrinterAlreadyAdded(SIGN_IN)) { | 422 if (!cloudPrinterAlreadyAdded(SIGN_IN)) { |
| 418 addDestinationListOptionAtPosition(lastCloudPrintOptionPos++, | 423 addDestinationListOptionAtPosition(lastCloudPrintOptionPos++, |
| 419 localStrings.getString('signIn'), | 424 localStrings.getString('signIn'), |
| 420 SIGN_IN, | 425 SIGN_IN, |
| 421 false, | 426 false, |
| 422 false, | 427 false, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 441 isCloudPrint: isCloudPrint, | 446 isCloudPrint: isCloudPrint, |
| 442 printToCloud: printToCloud, | 447 printToCloud: printToCloud, |
| 443 setBaseURL: setBaseURL, | 448 setBaseURL: setBaseURL, |
| 444 setCloudPrint: setCloudPrint, | 449 setCloudPrint: setCloudPrint, |
| 445 setColor: setColor, | 450 setColor: setColor, |
| 446 setDefaultPrinter: setDefaultPrinter, | 451 setDefaultPrinter: setDefaultPrinter, |
| 447 supportsColor: supportsColor, | 452 supportsColor: supportsColor, |
| 448 updatePrinterCaps: updatePrinterCaps | 453 updatePrinterCaps: updatePrinterCaps |
| 449 }; | 454 }; |
| 450 }); | 455 }); |
| OLD | NEW |