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

Side by Side Diff: chrome/browser/resources/settings/search_engines_page/search_engine_dialog.js

Issue 1758973002: MD Settings: Creating a <settings-dialog> element. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove extra blank line Created 4 years, 9 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-search-engine-dialog' is a component for adding 6 * @fileoverview 'settings-search-engine-dialog' is a component for adding
7 * or editing a search engine entry. 7 * or editing a search engine entry.
8 * 8 *
9 * @group Chrome Settings Elements 9 * @group Chrome Settings Elements
10 * @element settings-search-engine-dialog 10 * @element settings-search-engine-dialog
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 // If editing an existing search engine, pre-populate the input fields. 62 // If editing an existing search engine, pre-populate the input fields.
63 this.searchEngine_ = this.model.displayName; 63 this.searchEngine_ = this.model.displayName;
64 this.keyword_ = this.model.keyword; 64 this.keyword_ = this.model.keyword;
65 this.queryUrl_ = this.model.url; 65 this.queryUrl_ = this.model.url;
66 } else { 66 } else {
67 this.dialogTitle_ = 67 this.dialogTitle_ =
68 loadTimeData.getString('searchEnginesAddSearchEngine'); 68 loadTimeData.getString('searchEnginesAddSearchEngine');
69 this.actionButtonText_ = loadTimeData.getString('add'); 69 this.actionButtonText_ = loadTimeData.getString('add');
70 } 70 }
71
72 this.addEventListener('iron-overlay-canceled', function() {
73 this.browserProxy_.searchEngineEditCancelled();
74 }.bind(this));
71 }, 75 },
72 76
73 /** @override */ 77 /** @override */
74 attached: function() { 78 attached: function() {
75 this.updateActionButtonState_(); 79 this.updateActionButtonState_();
76 this.browserProxy_.searchEngineEditStarted( 80 this.browserProxy_.searchEngineEditStarted(
77 this.model ? this.model.modelIndex : this.DEFAULT_MODEL_INDEX); 81 this.model ? this.model.modelIndex : this.DEFAULT_MODEL_INDEX);
78 this.$.dialog.open(); 82 this.$.dialog.open();
79 }, 83 },
80 84
81 /** @private */ 85 /** @private */
82 cancel_: function() { 86 cancel_: function() {
83 this.browserProxy_.searchEngineEditCancelled(); 87 this.$.dialog.cancel();
84 this.$.dialog.close();
85 }, 88 },
86 89
87 /** @private */ 90 /** @private */
88 onActionButtonTap_: function() { 91 onActionButtonTap_: function() {
89 this.browserProxy_.searchEngineEditCompleted( 92 this.browserProxy_.searchEngineEditCompleted(
90 this.searchEngine_, this.keyword_, this.queryUrl_); 93 this.searchEngine_, this.keyword_, this.queryUrl_);
91 this.$.dialog.close(); 94 this.$.dialog.close();
92 }, 95 },
93 96
94 /** 97 /**
(...skipping 13 matching lines...) Expand all
108 /** @private */ 111 /** @private */
109 updateActionButtonState_: function() { 112 updateActionButtonState_: function() {
110 var allValid = [ 113 var allValid = [
111 this.$.searchEngine, this.$.keyword, this.$.queryUrl 114 this.$.searchEngine, this.$.keyword, this.$.queryUrl
112 ].every(function(inputElement) { 115 ].every(function(inputElement) {
113 return !inputElement.invalid && inputElement.value.length != 0; 116 return !inputElement.invalid && inputElement.value.length != 0;
114 }); 117 });
115 this.$.actionButton.disabled = !allValid; 118 this.$.actionButton.disabled = !allValid;
116 }, 119 },
117 }); 120 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698