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

Side by Side Diff: chrome/browser/resources/settings/on_startup_page/startup_url_dialog.js

Issue 2180823004: Migrate <cr-dialog> from PaperDialogBehavior to native <dialog>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
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-startup-url-dialog' is a component for adding 6 * @fileoverview 'settings-startup-url-dialog' is a component for adding
7 * or editing a startup URL entry. 7 * or editing a startup URL entry.
8 */ 8 */
9 Polymer({ 9 Polymer({
10 is: 'settings-startup-url-dialog', 10 is: 'settings-startup-url-dialog',
(...skipping 27 matching lines...) Expand all
38 this.dialogTitle_ = loadTimeData.getString('onStartupEditPage'); 38 this.dialogTitle_ = loadTimeData.getString('onStartupEditPage');
39 this.actionButtonText_ = loadTimeData.getString('onStartupEdit'); 39 this.actionButtonText_ = loadTimeData.getString('onStartupEdit');
40 this.$.actionButton.disabled = false; 40 this.$.actionButton.disabled = false;
41 // Pre-populate the input field. 41 // Pre-populate the input field.
42 this.url_ = this.model.url; 42 this.url_ = this.model.url;
43 } else { 43 } else {
44 this.dialogTitle_ = loadTimeData.getString('onStartupAddNewPage'); 44 this.dialogTitle_ = loadTimeData.getString('onStartupAddNewPage');
45 this.actionButtonText_ = loadTimeData.getString('add'); 45 this.actionButtonText_ = loadTimeData.getString('add');
46 this.$.actionButton.disabled = true; 46 this.$.actionButton.disabled = true;
47 } 47 }
48 this.$.dialog.open(); 48 this.$.dialog.showModal();
49 }, 49 },
50 50
51 /** @private */ 51 /** @private */
52 onCancelTap_: function() { 52 onCancelTap_: function() {
53 this.$.dialog.close(); 53 this.$.dialog.close();
54 }, 54 },
55 55
56 /** @private */ 56 /** @private */
57 onActionButtonTap_: function() { 57 onActionButtonTap_: function() {
58 var whenDone = this.model ? 58 var whenDone = this.model ?
59 this.browserProxy_.editStartupPage(this.model.modelIndex, this.url_) : 59 this.browserProxy_.editStartupPage(this.model.modelIndex, this.url_) :
60 this.browserProxy_.addStartupPage(this.url_); 60 this.browserProxy_.addStartupPage(this.url_);
61 61
62 whenDone.then(function(success) { 62 whenDone.then(function(success) {
63 if (success) 63 if (success)
64 this.$.dialog.close(); 64 this.$.dialog.close();
65 // If the URL was invalid, there is nothing to do, just leave the dialog 65 // If the URL was invalid, there is nothing to do, just leave the dialog
66 // open and let the user fix the URL or cancel. 66 // open and let the user fix the URL or cancel.
67 }.bind(this)); 67 }.bind(this));
68 }, 68 },
69 69
70 /** @private */ 70 /** @private */
71 validate_: function() { 71 validate_: function() {
72 this.browserProxy_.validateStartupPage(this.url_).then(function(isValid) { 72 this.browserProxy_.validateStartupPage(this.url_).then(function(isValid) {
73 this.$.actionButton.disabled = !isValid; 73 this.$.actionButton.disabled = !isValid;
74 }.bind(this)); 74 }.bind(this));
75 }, 75 },
76 }); 76 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698