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

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

Issue 1869883003: MD Settings: On Startup, extract dialog to its own file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit. Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/settings/on_startup_page/startup_url_dialog.js
diff --git a/chrome/browser/resources/settings/on_startup_page/startup_url_dialog.js b/chrome/browser/resources/settings/on_startup_page/startup_url_dialog.js
new file mode 100644
index 0000000000000000000000000000000000000000..363d37609262bd496e72f002f868fa6ef9d92e5e
--- /dev/null
+++ b/chrome/browser/resources/settings/on_startup_page/startup_url_dialog.js
@@ -0,0 +1,51 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @fileoverview 'settings-startup-url-dialog' is a component for adding
+ * or editing a startup URL entry.
+ */
+Polymer({
+ is: 'settings-startup-url-dialog',
+
+ properties: {
+ /** @private {string} */
+ url_: String,
+ },
+
+ /** @private {!settings.SearchEnginesBrowserProxy} */
+ browserProxy_: null,
+
+ /** @override */
+ ready: function() {
+ this.browserProxy_ = settings.StartupUrlsPageBrowserProxyImpl.getInstance();
+ },
+
+ /** @override */
+ attached: function() {
+ this.$.dialog.open();
+ },
+
+ /** @private */
+ onCancelTap_: function() {
+ this.$.dialog.close();
+ },
+
+ /** @private */
+ onAddTap_: function() {
+ this.browserProxy_.addStartupPage(this.url_).then(function(success) {
+ if (success)
+ this.$.dialog.close();
+ // If the URL was invalid, there is nothing to do, just leave the dialog
+ // open and let the user fix the URL or cancel.
+ }.bind(this));
+ },
+
+ /** @private */
+ validate_: function() {
+ this.browserProxy_.validateStartupPage(this.url_).then(function(isValid) {
+ this.$.add.disabled = !isValid;
+ }.bind(this));
+ },
+});

Powered by Google App Engine
This is Rietveld 408576698