| Index: chrome/browser/resources/settings/search_engines_page/search_engines_list.js
|
| diff --git a/chrome/browser/resources/settings/search_engines_page/search_engines_list.js b/chrome/browser/resources/settings/search_engines_page/search_engines_list.js
|
| index 391444486e1141af676e25bc86117cd0f7872237..da50ae2174f5527a3048bfcab8ea3bd1b4009c8b 100644
|
| --- a/chrome/browser/resources/settings/search_engines_page/search_engines_list.js
|
| +++ b/chrome/browser/resources/settings/search_engines_page/search_engines_list.js
|
| @@ -13,9 +13,31 @@ Polymer({
|
| /** @type {!Array<!SearchEngine>} */
|
| engines: {
|
| type: Array,
|
| - value: function() { return []; },
|
| + value: function() {
|
| + return [];
|
| + },
|
| observer: 'enginesChanged_',
|
| - }
|
| + },
|
| +
|
| + /**
|
| + * The search engine associated with the dropdown menu.
|
| + * @type {?SearchEngine}
|
| + */
|
| + dropdownEngine_: {
|
| + type: Object,
|
| + value: null,
|
| + },
|
| +
|
| + /** @private {boolean} */
|
| + showEditSearchEngineDialog_: Boolean,
|
| + },
|
| +
|
| + /** @private {settings.SearchEnginesBrowserProxy} */
|
| + browserProxy_: null,
|
| +
|
| + /** @override */
|
| + created: function() {
|
| + this.browserProxy_ = settings.SearchEnginesBrowserProxyImpl.getInstance();
|
| },
|
|
|
| /** @private */
|
| @@ -24,4 +46,57 @@ Polymer({
|
| // observe changes to |engines| and notify the iron-list.
|
| this.$$('iron-list').fire('iron-resize');
|
| },
|
| +
|
| + /**
|
| + * @param {!{detail: !SearchEngine, target: !Element}} e
|
| + * @private
|
| + */
|
| + onOpenMenu_: function(e) {
|
| + this.dropdownEngine_ = e.detail;
|
| + this.$$('iron-dropdown').positionTarget = e.target.$$('paper-icon-button');
|
| + this.$$('iron-dropdown').open();
|
| + },
|
| +
|
| + /** @private */
|
| + onMakeDefaultTap_: function() {
|
| + this.browserProxy_.setDefaultSearchEngine(this.dropdownEngine_.modelIndex);
|
| + },
|
| +
|
| +
|
| + /** @private */
|
| + onEditTap_: function() {
|
| + this.showEditSearchEngineDialog_ = true;
|
| + this.async(function() {
|
| + var dialog = this.$$('settings-search-engine-dialog');
|
| + // Register listener to detect when the dialog is closed. Flip the boolean
|
| + // once closed to force a restamp next time it is shown such that the
|
| + // previous dialog's contents are cleared.
|
| + dialog.addEventListener('close', function() {
|
| + this.showEditSearchEngineDialog_ = false;
|
| + }.bind(this));
|
| + }.bind(this));
|
| + },
|
| +
|
| +
|
| + /** @private */
|
| + onDeleteTap_: function() {
|
| + this.browserProxy_.removeSearchEngine(this.dropdownEngine_.modelIndex);
|
| + this.dropdownEngine_ = null;
|
| + },
|
| +
|
| + /** @private */
|
| + onManageTap_: function() {
|
| + this.browserProxy_.manageExtension(this.dropdownEngine_.extension.id);
|
| + },
|
| +
|
| + /** @private */
|
| + onDisableTap_: function() {
|
| + this.browserProxy_.disableExtension(this.dropdownEngine_.extension.id);
|
| + },
|
| +
|
| + /** @private */
|
| + closePopupMenu_: function() {
|
| + this.$$('iron-dropdown').close();
|
| + },
|
| +
|
| });
|
|
|