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

Unified Diff: chrome/browser/resources/settings/on_startup_page/startup_urls_page.js

Issue 2480203002: ui: Cleanup class/struct forward declarations (Closed)
Patch Set: Sync CL to position 430550 Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/settings/on_startup_page/startup_urls_page.js
diff --git a/chrome/browser/resources/settings/on_startup_page/startup_urls_page.js b/chrome/browser/resources/settings/on_startup_page/startup_urls_page.js
index a7dbf30bbb2bad21be017726354a43b6fc7d7f44..1d24c367bed4100e327c259fce16b2d0b47c4b09 100644
--- a/chrome/browser/resources/settings/on_startup_page/startup_urls_page.js
+++ b/chrome/browser/resources/settings/on_startup_page/startup_urls_page.js
@@ -33,6 +33,10 @@ Polymer({
attached: function() {
this.browserProxy_ = settings.StartupUrlsPageBrowserProxyImpl.getInstance();
this.addWebUIListener('update-startup-pages', function(startupPages) {
+ // If an "edit" URL dialog was open, close it, because the underlying page
+ // might have just been removed (and model indices have changed anyway).
+ if (this.startupUrlDialogModel_)
+ this.destroyUrlDialog_();
this.startupPages_ = startupPages;
this.updateScrollableContents();
}.bind(this));
@@ -40,31 +44,20 @@ Polymer({
this.addEventListener(settings.EDIT_STARTUP_URL_EVENT, function(event) {
this.startupUrlDialogModel_ = event.detail;
- this.openDialog_();
+ this.showStartupUrlDialog_ = true;
event.stopPropagation();
}.bind(this));
},
/** @private */
onAddPageTap_: function() {
- this.openDialog_();
+ this.showStartupUrlDialog_ = true;
},
- /**
- * Opens the dialog and registers a listener for removing the dialog from the
- * DOM once is closed. The listener is destroyed when the dialog is removed
- * (because of 'restamp').
- * @private
- */
- openDialog_: function() {
- this.showStartupUrlDialog_ = true;
- this.async(function() {
- var dialog = this.$$('settings-startup-url-dialog');
- dialog.addEventListener('close', function() {
- this.showStartupUrlDialog_ = false;
- this.startupUrlDialogModel_ = null;
- }.bind(this));
- }.bind(this));
+ /** @private */
+ destroyUrlDialog_: function() {
+ this.showStartupUrlDialog_ = false;
+ this.startupUrlDialogModel_ = null;
},
/** @private */

Powered by Google App Engine
This is Rietveld 408576698