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

Unified Diff: chrome/browser/resources/settings/search_page/search_page.js

Issue 1836583003: MD Settings: Use paper-dropdown-menu for search engines. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change paper-item to div 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/settings/search_page/search_page.js
diff --git a/chrome/browser/resources/settings/search_page/search_page.js b/chrome/browser/resources/settings/search_page/search_page.js
index a275f4df86439b34d4c4282f3072d1b201bfb545..51ee6bdb07fcecdd7fc5eaacc805b7ef9025fef3 100644
--- a/chrome/browser/resources/settings/search_page/search_page.js
+++ b/chrome/browser/resources/settings/search_page/search_page.js
@@ -51,7 +51,27 @@ Polymer({
},
/** @private */
- onDefaultEngineChanged_: function() {
- this.browserProxy_.setDefaultSearchEngine(this.$.searchEnginesMenu.value);
+ onIronSelect_: function() {
+ var searchEngine = this.searchEngines_[this.$$('paper-listbox').selected];
+ if (searchEngine.default) {
+ // If the selected search engine is already marked as the default one,
+ // this change originated in some other tab, and nothing should be done
+ // here.
+ return;
+ }
+
+ // Otherwise, this change originated by an explicit user action in this tab.
+ // Submit the default search engine change.
+ this.browserProxy_.setDefaultSearchEngine(searchEngine.modelIndex);
+ },
+
+ /**
+ * @return {number}
+ * @private
+ */
+ getSelectedSearchEngineIndex_: function() {
+ return this.searchEngines_.findIndex(function(searchEngine) {
+ return searchEngine.default;
+ });
},
});

Powered by Google App Engine
This is Rietveld 408576698