| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 /** | 5 /** |
| 6 * @fileoverview 'settings-cups-add-printer-dialog' includes multiple dialogs to | 6 * @fileoverview 'settings-cups-add-printer-dialog' includes multiple dialogs to |
| 7 * set up a new CUPS printer. | 7 * set up a new CUPS printer. |
| 8 * Subdialogs include: | 8 * Subdialogs include: |
| 9 * - 'add-printer-discovery-dialog' is a dialog showing discovered printers on | 9 * - 'add-printer-discovery-dialog' is a dialog showing discovered printers on |
| 10 * the network that are available for setup. | 10 * the network that are available for setup. |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 }, | 356 }, |
| 357 | 357 |
| 358 /** @override */ | 358 /** @override */ |
| 359 ready: function() { | 359 ready: function() { |
| 360 this.addWebUIListener('on-add-cups-printer', this.onAddPrinter_.bind(this)); | 360 this.addWebUIListener('on-add-cups-printer', this.onAddPrinter_.bind(this)); |
| 361 }, | 361 }, |
| 362 | 362 |
| 363 /** Opens the Add printer discovery dialog. */ | 363 /** Opens the Add printer discovery dialog. */ |
| 364 open: function() { | 364 open: function() { |
| 365 this.resetData_(); | 365 this.resetData_(); |
| 366 this.switchDialog_('', AddPrinterDialogs.DISCOVERY, 'showDiscoveryDialog_'); | 366 this.switchDialog_( |
| 367 '', AddPrinterDialogs.MANUALLY, 'showManuallyAddDialog_'); |
| 367 }, | 368 }, |
| 368 | 369 |
| 369 /** | 370 /** |
| 370 * Reset all the printer data in the Add printer flow. | 371 * Reset all the printer data in the Add printer flow. |
| 371 * @private | 372 * @private |
| 372 */ | 373 */ |
| 373 resetData_: function() { | 374 resetData_: function() { |
| 374 if (this.selectedPrinter) | 375 if (this.selectedPrinter) |
| 375 this.selectedPrinter = this.getEmptyPrinter_(); | 376 this.selectedPrinter = this.getEmptyPrinter_(); |
| 376 if (this.newPrinter) | 377 if (this.newPrinter) |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 }, | 429 }, |
| 429 | 430 |
| 430 /** @private */ | 431 /** @private */ |
| 431 openManufacturerModelDialog_: function() { | 432 openManufacturerModelDialog_: function() { |
| 432 this.switchDialog_(this.currentDialog_, AddPrinterDialogs.MANUFACTURER, | 433 this.switchDialog_(this.currentDialog_, AddPrinterDialogs.MANUFACTURER, |
| 433 'showManufacturerDialog_'); | 434 'showManufacturerDialog_'); |
| 434 }, | 435 }, |
| 435 | 436 |
| 436 /** @private */ | 437 /** @private */ |
| 437 configuringDialogClosed_: function() { | 438 configuringDialogClosed_: function() { |
| 438 if (this.previousDialog_ == AddPrinterDialogs.DISCOVERY) { | 439 if (this.previousDialog_ == AddPrinterDialogs.MANUALLY) { |
| 439 this.switchDialog_( | |
| 440 this.currentDialog_, this.previousDialog_, 'showDiscoveryDialog_'); | |
| 441 } else if (this.previousDialog_ == AddPrinterDialogs.MANUALLY) { | |
| 442 this.switchDialog_( | 440 this.switchDialog_( |
| 443 this.currentDialog_, this.previousDialog_, 'showManuallyAddDialog_'); | 441 this.currentDialog_, this.previousDialog_, 'showManuallyAddDialog_'); |
| 444 } else if (this.previousDialog_ == AddPrinterDialogs.MANUFACTURER) { | 442 } else if (this.previousDialog_ == AddPrinterDialogs.MANUFACTURER) { |
| 445 this.switchDialog_( | 443 this.switchDialog_( |
| 446 this.currentDialog_, this.previousDialog_, 'showManufacturerDialog_'); | 444 this.currentDialog_, this.previousDialog_, 'showManufacturerDialog_'); |
| 447 } | 445 } |
| 448 }, | 446 }, |
| 449 | 447 |
| 450 /** | 448 /** |
| 451 * Switch dialog from |fromDialog| to |toDialog|. | 449 * Switch dialog from |fromDialog| to |toDialog|. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 return; | 491 return; |
| 494 | 492 |
| 495 if (this.previousDialog_ == AddPrinterDialogs.MANUFACTURER) { | 493 if (this.previousDialog_ == AddPrinterDialogs.MANUFACTURER) { |
| 496 this.setupFailed = true; | 494 this.setupFailed = true; |
| 497 } else if (this.previousDialog_ == AddPrinterDialogs.MANUALLY) { | 495 } else if (this.previousDialog_ == AddPrinterDialogs.MANUALLY) { |
| 498 this.switchDialog_(this.currentDialog_, AddPrinterDialogs.MANUFACTURER, | 496 this.switchDialog_(this.currentDialog_, AddPrinterDialogs.MANUFACTURER, |
| 499 'showManufacturerDialog_'); | 497 'showManufacturerDialog_'); |
| 500 } | 498 } |
| 501 }, | 499 }, |
| 502 }); | 500 }); |
| OLD | NEW |