| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 /** | |
| 6 * @fileoverview 'settings-add-search-engine-dialog' is a component for adding a | |
| 7 * new search engine. | |
| 8 * | |
| 9 * @group Chrome Settings Elements | |
| 10 * @element settings-add-search-engine-dialog | |
| 11 */ | |
| 12 Polymer({ | |
| 13 is: 'settings-add-search-engine-dialog', | |
| 14 | |
| 15 open: function() { | |
| 16 this.$.dialog.open(); | |
| 17 }, | |
| 18 | |
| 19 /** @private */ | |
| 20 onCancelTap_: function() { | |
| 21 this.$.dialog.close(); | |
| 22 }, | |
| 23 | |
| 24 /** @private */ | |
| 25 onAddTap_: function() { | |
| 26 if (this.$.searchEngine.isInvalid || | |
| 27 this.$.keyword.isInvalid || | |
| 28 this.$.queryUrl.isInvalid) { | |
| 29 // TODO(dpapad): Handle validation properly. | |
| 30 this.$.dialog.close(); | |
| 31 return; | |
| 32 } | |
| 33 | |
| 34 chrome.searchEnginesPrivate.addOtherSearchEngine( | |
| 35 this.$.searchEngine.value, this.$.keyword.value, | |
| 36 this.$.queryUrl.value); | |
| 37 this.$.dialog.close(); | |
| 38 }, | |
| 39 }); | |
| OLD | NEW |