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

Unified Diff: chrome/browser/resources/settings/search_engines_page/search_engines_list.js

Issue 2331423008: MD Settings: Search Engines: Move dropdown menu to search_engines_list (Closed)
Patch Set: . Created 4 years, 3 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/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();
+ },
+
});

Powered by Google App Engine
This is Rietveld 408576698