Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Side by Side Diff: chrome/browser/resources/settings/printing_page/cups_add_printer_dialog.js

Issue 2891413002: [CUPS] Remove the left button in 'manufacturer-and-model' dialog. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/resources/settings/printing_page/cups_add_printer_dialog.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 /** @type {?Array<string>} */ 207 /** @type {?Array<string>} */
208 manufacturerList: { 208 manufacturerList: {
209 type: Array, 209 type: Array,
210 }, 210 },
211 211
212 /** @type {?Array<string>} */ 212 /** @type {?Array<string>} */
213 modelList: { 213 modelList: {
214 type: Array, 214 type: Array,
215 }, 215 },
216 216
217 /** @type {string} */
218 previousDialog: String,
219
220 setupFailed: { 217 setupFailed: {
221 type: Boolean, 218 type: Boolean,
222 value: false, 219 value: false,
223 }, 220 },
224 }, 221 },
225 222
226 observers: [ 223 observers: [
227 'selectedManufacturerChanged_(newPrinter.printerManufacturer)', 224 'selectedManufacturerChanged_(newPrinter.printerManufacturer)',
228 ], 225 ],
229 226
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 /** 273 /**
277 * @param {!ModelsInfo} modelsInfo 274 * @param {!ModelsInfo} modelsInfo
278 * @private 275 * @private
279 */ 276 */
280 modelListChanged_: function(modelsInfo) { 277 modelListChanged_: function(modelsInfo) {
281 if (modelsInfo.success) 278 if (modelsInfo.success)
282 this.modelList = modelsInfo.models; 279 this.modelList = modelsInfo.models;
283 }, 280 },
284 281
285 /** @private */ 282 /** @private */
286 switchToPreviousDialog_: function() {
287 this.$$('add-printer-dialog').close();
288 if (this.previousDialog == AddPrinterDialogs.DISCOVERY) {
289 this.fire('open-discovery-printers-dialog');
290 } else if (this.previousDialog == AddPrinterDialogs.MANUALLY) {
291 this.fire('open-manually-add-printer-dialog');
292 }
293 },
294
295 /** @private */
296 onCancelTap_: function() { 283 onCancelTap_: function() {
297 this.$$('add-printer-dialog').close(); 284 this.$$('add-printer-dialog').close();
298 }, 285 },
299 286
300 /** @private */ 287 /** @private */
301 switchToConfiguringDialog_: function() { 288 switchToConfiguringDialog_: function() {
302 this.$$('add-printer-dialog').close(); 289 this.$$('add-printer-dialog').close();
303 this.fire('open-configuring-printer-dialog'); 290 this.fire('open-configuring-printer-dialog');
304 }, 291 },
305 292
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 }, 348 },
362 349
363 /** @type {boolean} whether the new printer setup is failed. */ 350 /** @type {boolean} whether the new printer setup is failed. */
364 setupFailed: { 351 setupFailed: {
365 type: Boolean, 352 type: Boolean,
366 value: false, 353 value: false,
367 }, 354 },
368 355
369 configuringDialogTitle: String, 356 configuringDialogTitle: String,
370 357
371 /** @type {string} */ 358 /** @private {string} */
372 previousDialog: String, 359 previousDialog_: String,
373 360
374 /** @private {string} */ 361 /** @private {string} */
375 currentDialog_: String, 362 currentDialog_: String,
376 363
377 /** @private {boolean} */ 364 /** @private {boolean} */
378 showDiscoveryDialog_: Boolean, 365 showDiscoveryDialog_: Boolean,
379 366
380 /** @private {boolean} */ 367 /** @private {boolean} */
381 showManuallyAddDialog_: Boolean, 368 showManuallyAddDialog_: Boolean,
382 369
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 openDiscoveryPrintersDialog_: function() { 413 openDiscoveryPrintersDialog_: function() {
427 this.switchDialog_(this.currentDialog_, AddPrinterDialogs.DISCOVERY, 414 this.switchDialog_(this.currentDialog_, AddPrinterDialogs.DISCOVERY,
428 'showDiscoveryDialog_'); 415 'showDiscoveryDialog_');
429 }, 416 },
430 417
431 /** @private */ 418 /** @private */
432 openConfiguringPrinterDialog_: function() { 419 openConfiguringPrinterDialog_: function() {
433 this.switchDialog_( 420 this.switchDialog_(
434 this.currentDialog_, AddPrinterDialogs.CONFIGURING, 421 this.currentDialog_, AddPrinterDialogs.CONFIGURING,
435 'showConfiguringDialog_'); 422 'showConfiguringDialog_');
436 if (this.previousDialog == AddPrinterDialogs.DISCOVERY) { 423 if (this.previousDialog_ == AddPrinterDialogs.DISCOVERY) {
437 this.configuringDialogTitle = 424 this.configuringDialogTitle =
438 loadTimeData.getString('addPrintersNearbyTitle'); 425 loadTimeData.getString('addPrintersNearbyTitle');
439 settings.CupsPrintersBrowserProxyImpl.getInstance().addCupsPrinter( 426 settings.CupsPrintersBrowserProxyImpl.getInstance().addCupsPrinter(
440 this.newPrinter); 427 this.newPrinter);
441 } else if (this.previousDialog == AddPrinterDialogs.MANUFACTURER) { 428 } else if (this.previousDialog_ == AddPrinterDialogs.MANUFACTURER) {
442 this.configuringDialogTitle = 429 this.configuringDialogTitle =
443 loadTimeData.getString('addPrintersManuallyTitle'); 430 loadTimeData.getString('addPrintersManuallyTitle');
444 settings.CupsPrintersBrowserProxyImpl.getInstance().addCupsPrinter( 431 settings.CupsPrintersBrowserProxyImpl.getInstance().addCupsPrinter(
445 this.newPrinter); 432 this.newPrinter);
446 } 433 }
447 }, 434 },
448 435
449 /** @private */ 436 /** @private */
450 openManufacturerModelDialog_: function() { 437 openManufacturerModelDialog_: function() {
451 this.switchDialog_(this.currentDialog_, AddPrinterDialogs.MANUFACTURER, 438 this.switchDialog_(this.currentDialog_, AddPrinterDialogs.MANUFACTURER,
452 'showManufacturerDialog_'); 439 'showManufacturerDialog_');
453 }, 440 },
454 441
455 /** @private */ 442 /** @private */
456 configuringDialogClosed_: function() { 443 configuringDialogClosed_: function() {
457 // If the configuring dialog is closed, we want to return whence we came. 444 // If the configuring dialog is closed, we want to return whence we came.
458 // 445 //
459 // TODO(justincarlson) - This shouldn't need to be a conditional; 446 // TODO(justincarlson) - This shouldn't need to be a conditional;
460 // clean up the way we switch dialogs so we don't have to supply 447 // clean up the way we switch dialogs so we don't have to supply
461 // redundant information and can just return to the previous 448 // redundant information and can just return to the previous
462 // dialog. 449 // dialog.
463 if (this.previousDialog == AddPrinterDialogs.DISCOVERY) { 450 if (this.previousDialog_ == AddPrinterDialogs.DISCOVERY) {
464 this.switchDialog_( 451 this.switchDialog_(
465 this.currentDialog_, this.previousDialog, 'showDiscoveryDialog_'); 452 this.currentDialog_, this.previousDialog_, 'showDiscoveryDialog_');
466 } else if (this.previousDialog == AddPrinterDialogs.MANUALLY) { 453 } else if (this.previousDialog_ == AddPrinterDialogs.MANUALLY) {
467 this.switchDialog_( 454 this.switchDialog_(
468 this.currentDialog_, this.previousDialog, 'showManuallyAddDialog_'); 455 this.currentDialog_, this.previousDialog_, 'showManuallyAddDialog_');
469 } else if (this.previousDialog == AddPrinterDialogs.MANUFACTURER) { 456 } else if (this.previousDialog_ == AddPrinterDialogs.MANUFACTURER) {
470 this.switchDialog_( 457 this.switchDialog_(
471 this.currentDialog_, this.previousDialog, 'showManufacturerDialog_'); 458 this.currentDialog_, this.previousDialog_, 'showManufacturerDialog_');
472 } 459 }
473 }, 460 },
474 461
475 /** 462 /**
476 * Switch dialog from |fromDialog| to |toDialog|. 463 * Switch dialog from |fromDialog| to |toDialog|.
477 * @param {string} fromDialog 464 * @param {string} fromDialog
478 * @param {string} toDialog 465 * @param {string} toDialog
479 * @param {string} domIfBooleanName The name of the boolean variable 466 * @param {string} domIfBooleanName The name of the boolean variable
480 * corresponding to the |toDialog|. 467 * corresponding to the |toDialog|.
481 * @private 468 * @private
482 */ 469 */
483 switchDialog_: function(fromDialog, toDialog, domIfBooleanName) { 470 switchDialog_: function(fromDialog, toDialog, domIfBooleanName) {
484 this.previousDialog = fromDialog; 471 this.previousDialog_ = fromDialog;
485 this.currentDialog_ = toDialog; 472 this.currentDialog_ = toDialog;
486 473
487 this.set(domIfBooleanName, true); 474 this.set(domIfBooleanName, true);
488 this.async(function() { 475 this.async(function() {
489 var dialog = this.$$(toDialog); 476 var dialog = this.$$(toDialog);
490 dialog.addEventListener('close', function() { 477 dialog.addEventListener('close', function() {
491 this.set(domIfBooleanName, false); 478 this.set(domIfBooleanName, false);
492 }.bind(this)); 479 }.bind(this));
493 }); 480 });
494 }, 481 },
495 482
496 /** 483 /**
497 * @param {boolean} success 484 * @param {boolean} success
498 * @param {string} printerName 485 * @param {string} printerName
499 * @private 486 * @private
500 */ 487 */
501 onAddPrinter_: function(success, printerName) { 488 onAddPrinter_: function(success, printerName) {
502 this.$$('add-printer-configuring-dialog').close(); 489 this.$$('add-printer-configuring-dialog').close();
503 if (success) 490 if (success)
504 return; 491 return;
505 492
506 if (this.previousDialog == AddPrinterDialogs.MANUFACTURER) { 493 if (this.previousDialog_ == AddPrinterDialogs.MANUFACTURER) {
507 this.setupFailed = true; 494 this.setupFailed = true;
508 } 495 }
509 }, 496 },
510 }); 497 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/printing_page/cups_add_printer_dialog.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698