OLD | NEW |
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 Polymer({ | 9 Polymer({ |
10 is: 'settings-search-engine-dialog', | 10 is: 'settings-search-engine-dialog', |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // If editing an existing search engine, pre-populate the input fields. | 59 // If editing an existing search engine, pre-populate the input fields. |
60 this.searchEngine_ = this.model.name; | 60 this.searchEngine_ = this.model.name; |
61 this.keyword_ = this.model.keyword; | 61 this.keyword_ = this.model.keyword; |
62 this.queryUrl_ = this.model.url; | 62 this.queryUrl_ = this.model.url; |
63 } else { | 63 } else { |
64 this.dialogTitle_ = | 64 this.dialogTitle_ = |
65 loadTimeData.getString('searchEnginesAddSearchEngine'); | 65 loadTimeData.getString('searchEnginesAddSearchEngine'); |
66 this.actionButtonText_ = loadTimeData.getString('add'); | 66 this.actionButtonText_ = loadTimeData.getString('add'); |
67 } | 67 } |
68 | 68 |
69 this.addEventListener('iron-overlay-canceled', function() { | 69 this.addEventListener('cancel', function() { |
70 this.browserProxy_.searchEngineEditCancelled(); | 70 this.browserProxy_.searchEngineEditCancelled(); |
71 }.bind(this)); | 71 }.bind(this)); |
72 }, | 72 }, |
73 | 73 |
74 /** @override */ | 74 /** @override */ |
75 attached: function() { | 75 attached: function() { |
76 this.updateActionButtonState_(); | 76 this.updateActionButtonState_(); |
77 this.browserProxy_.searchEngineEditStarted( | 77 this.browserProxy_.searchEngineEditStarted( |
78 this.model ? this.model.modelIndex : this.DEFAULT_MODEL_INDEX); | 78 this.model ? this.model.modelIndex : this.DEFAULT_MODEL_INDEX); |
79 this.$.dialog.open(); | 79 this.$.dialog.showModal(); |
80 }, | 80 }, |
81 | 81 |
82 /** @private */ | 82 /** @private */ |
83 cancel_: function() { | 83 cancel_: function() { |
84 this.$.dialog.cancel(); | 84 this.$.dialog.cancel(); |
85 }, | 85 }, |
86 | 86 |
87 /** @private */ | 87 /** @private */ |
88 onActionButtonTap_: function() { | 88 onActionButtonTap_: function() { |
89 this.browserProxy_.searchEngineEditCompleted( | 89 this.browserProxy_.searchEngineEditCompleted( |
(...skipping 18 matching lines...) Expand all Loading... |
108 /** @private */ | 108 /** @private */ |
109 updateActionButtonState_: function() { | 109 updateActionButtonState_: function() { |
110 var allValid = [ | 110 var allValid = [ |
111 this.$.searchEngine, this.$.keyword, this.$.queryUrl | 111 this.$.searchEngine, this.$.keyword, this.$.queryUrl |
112 ].every(function(inputElement) { | 112 ].every(function(inputElement) { |
113 return !inputElement.invalid && inputElement.value.length != 0; | 113 return !inputElement.invalid && inputElement.value.length != 0; |
114 }); | 114 }); |
115 this.$.actionButton.disabled = !allValid; | 115 this.$.actionButton.disabled = !allValid; |
116 }, | 116 }, |
117 }); | 117 }); |
OLD | NEW |