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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 discoveredPrinters: { | 43 discoveredPrinters: { |
44 type: Array, | 44 type: Array, |
45 }, | 45 }, |
46 | 46 |
47 /** @type {!CupsPrinterInfo} */ | 47 /** @type {!CupsPrinterInfo} */ |
48 selectedPrinter: { | 48 selectedPrinter: { |
49 type: Object, | 49 type: Object, |
50 notify: true, | 50 notify: true, |
51 }, | 51 }, |
52 | 52 |
53 /** @type {!CupsPrinterInfo} */ | |
54 newPrinter: { | |
55 type: Object, | |
56 notify: true, | |
xdai1
2017/04/24 21:42:12
I think put the new property newPrinter in manufac
Carlson
2017/05/01 20:59:49
Sorry, I don't really understand what you mean by
xdai1
2017/05/02 17:25:08
Sorry I didn't explain it in a clear way.
I under
| |
57 }, | |
58 | |
53 discovering_: { | 59 discovering_: { |
54 type: Boolean, | 60 type: Boolean, |
55 value: true, | 61 value: true, |
56 }, | 62 }, |
57 }, | 63 }, |
58 | 64 |
59 /** @override */ | 65 /** @override */ |
60 ready: function() { | 66 ready: function() { |
61 settings.CupsPrintersBrowserProxyImpl.getInstance(). | 67 settings.CupsPrintersBrowserProxyImpl.getInstance(). |
62 startDiscoveringPrinters(); | 68 startDiscoveringPrinters(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
103 this.fire('open-manually-add-printer-dialog'); | 109 this.fire('open-manually-add-printer-dialog'); |
104 }, | 110 }, |
105 | 111 |
106 /** @private */ | 112 /** @private */ |
107 onCancelTap_: function() { | 113 onCancelTap_: function() { |
108 this.stopDiscoveringPrinters_(); | 114 this.stopDiscoveringPrinters_(); |
109 this.$$('add-printer-dialog').close(); | 115 this.$$('add-printer-dialog').close(); |
110 }, | 116 }, |
111 | 117 |
112 /** @private */ | 118 /** @private */ |
113 switchToConfiguringDialog_: function() { | 119 switchToManufacturerDialog_: function() { |
114 this.stopDiscoveringPrinters_(); | 120 this.stopDiscoveringPrinters_(); |
121 | |
122 // Copy relevant fields over from selected printer, | |
123 // clear the rest. | |
124 this.newPrinter = { | |
125 printerAddress: this.selectedPrinter.printerAddress, | |
126 printerDescription: this.selectedPrinter.printerDescription, | |
127 printerId: this.selectedPrinter.printerId, | |
128 printerName: this.selectedPrinter.printerName, | |
129 printerProtocol: this.selectedPrinter.printerProtocol, | |
130 printerQueue: this.selectedPrinter.printerQueue, | |
131 printerStatus: this.selectedPrinter.printerStatus, | |
132 printerManufacturer: '', | |
133 printerModel: '', | |
134 printerPPDPath: '', | |
135 }; | |
115 this.$$('add-printer-dialog').close(); | 136 this.$$('add-printer-dialog').close(); |
116 this.fire('open-configuring-printer-dialog'); | 137 this.fire('open-manufacturer-model-dialog'); |
117 }, | 138 }, |
118 }); | 139 }); |
119 | 140 |
120 Polymer({ | 141 Polymer({ |
121 is: 'add-printer-manually-dialog', | 142 is: 'add-printer-manually-dialog', |
122 | 143 |
123 properties: { | 144 properties: { |
124 /** @type {!CupsPrinterInfo} */ | 145 /** @type {!CupsPrinterInfo} */ |
125 newPrinter: { | 146 newPrinter: { |
126 type: Object, | 147 type: Object, |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
325 newPrinter: { | 346 newPrinter: { |
326 type: Object, | 347 type: Object, |
327 }, | 348 }, |
328 | 349 |
329 /** @type {boolean} whether the new printer setup is failed. */ | 350 /** @type {boolean} whether the new printer setup is failed. */ |
330 setupFailed: { | 351 setupFailed: { |
331 type: Boolean, | 352 type: Boolean, |
332 value: false, | 353 value: false, |
333 }, | 354 }, |
334 | 355 |
356 /** @type {boolean} whether we're doing manufacturer/model in | |
357 a manual flow (as opposed to a discovery flow). */ | |
xdai1
2017/04/24 21:42:12
The format should be
/**
* @type {boolean} commen
Carlson
2017/05/01 20:59:49
done.
| |
358 inManualFlow: { | |
xdai1
2017/04/24 21:42:12
this should be a private property.
Carlson
2017/05/01 20:59:49
Done.
| |
359 type: Boolean, | |
360 value: false, | |
361 }, | |
362 | |
335 configuringDialogTitle: String, | 363 configuringDialogTitle: String, |
336 | 364 |
337 /** @private {string} */ | 365 /** @private {string} */ |
338 previousDialog_: String, | 366 previousDialog_: String, |
339 | 367 |
340 /** @private {string} */ | 368 /** @private {string} */ |
341 currentDialog_: String, | 369 currentDialog_: String, |
342 | 370 |
343 /** @private {boolean} */ | 371 /** @private {boolean} */ |
344 showDiscoveryDialog_: Boolean, | 372 showDiscoveryDialog_: Boolean, |
(...skipping 17 matching lines...) Expand all Loading... | |
362 }, | 390 }, |
363 | 391 |
364 /** @override */ | 392 /** @override */ |
365 ready: function() { | 393 ready: function() { |
366 this.addWebUIListener('on-add-cups-printer', this.onAddPrinter_.bind(this)); | 394 this.addWebUIListener('on-add-cups-printer', this.onAddPrinter_.bind(this)); |
367 }, | 395 }, |
368 | 396 |
369 /** Opens the Add printer discovery dialog. */ | 397 /** Opens the Add printer discovery dialog. */ |
370 open: function() { | 398 open: function() { |
371 this.resetData_(); | 399 this.resetData_(); |
372 this.switchDialog_( | 400 this.switchDialog_('', AddPrinterDialogs.DISCOVERY, 'showDiscoveryDialog_'); |
373 '', AddPrinterDialogs.MANUALLY, 'showManuallyAddDialog_'); | |
374 }, | 401 }, |
375 | 402 |
376 /** | 403 /** |
377 * Reset all the printer data in the Add printer flow. | 404 * Reset all the printer data in the Add printer flow. |
378 * @private | 405 * @private |
379 */ | 406 */ |
380 resetData_: function() { | 407 resetData_: function() { |
381 if (this.selectedPrinter) | 408 if (this.selectedPrinter) |
382 this.selectedPrinter = this.getEmptyPrinter_(); | 409 this.selectedPrinter = this.getEmptyPrinter_(); |
383 if (this.newPrinter) | 410 if (this.newPrinter) |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
431 loadTimeData.getString('addPrintersManuallyTitle'); | 458 loadTimeData.getString('addPrintersManuallyTitle'); |
432 settings.CupsPrintersBrowserProxyImpl.getInstance().addCupsPrinter( | 459 settings.CupsPrintersBrowserProxyImpl.getInstance().addCupsPrinter( |
433 this.newPrinter); | 460 this.newPrinter); |
434 } | 461 } |
435 }, | 462 }, |
436 | 463 |
437 /** @private */ | 464 /** @private */ |
438 openManufacturerModelDialog_: function() { | 465 openManufacturerModelDialog_: function() { |
439 this.switchDialog_(this.currentDialog_, AddPrinterDialogs.MANUFACTURER, | 466 this.switchDialog_(this.currentDialog_, AddPrinterDialogs.MANUFACTURER, |
440 'showManufacturerDialog_'); | 467 'showManufacturerDialog_'); |
468 this.inManualFlow = (this.previousDialog_ == AddPrinterDialogs.MANUALLY); | |
441 }, | 469 }, |
442 | 470 |
443 /** @private */ | 471 /** @private */ |
444 configuringDialogClosed_: function() { | 472 configuringDialogClosed_: function() { |
445 if (this.previousDialog_ == AddPrinterDialogs.MANUALLY) { | 473 if (this.previousDialog_ == AddPrinterDialogs.MANUALLY) { |
446 this.switchDialog_( | 474 this.switchDialog_( |
447 this.currentDialog_, this.previousDialog_, 'showManuallyAddDialog_'); | 475 this.currentDialog_, this.previousDialog_, 'showManuallyAddDialog_'); |
448 } else if (this.previousDialog_ == AddPrinterDialogs.MANUFACTURER) { | 476 } else if (this.previousDialog_ == AddPrinterDialogs.MANUFACTURER) { |
449 this.switchDialog_( | 477 this.switchDialog_( |
450 this.currentDialog_, this.previousDialog_, 'showManufacturerDialog_'); | 478 this.currentDialog_, this.previousDialog_, 'showManufacturerDialog_'); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
494 onAddPrinter_: function(success, printerName) { | 522 onAddPrinter_: function(success, printerName) { |
495 this.$$('add-printer-configuring-dialog').close(); | 523 this.$$('add-printer-configuring-dialog').close(); |
496 if (success) | 524 if (success) |
497 return; | 525 return; |
498 | 526 |
499 if (this.previousDialog_ == AddPrinterDialogs.MANUFACTURER) { | 527 if (this.previousDialog_ == AddPrinterDialogs.MANUFACTURER) { |
500 this.setupFailed = true; | 528 this.setupFailed = true; |
501 } | 529 } |
502 }, | 530 }, |
503 }); | 531 }); |
OLD | NEW |