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

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

Issue 2176743004: MD Settings: Implementing a "no results" page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comment. Created 4 years, 5 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/settings_main/settings_main.js
diff --git a/chrome/browser/resources/settings/settings_main/settings_main.js b/chrome/browser/resources/settings/settings_main/settings_main.js
index f80a8512c0c54b21bc89b73ddfbf8271534494f2..b98d7212ddab36636d42bba894001bb42b614d10 100644
--- a/chrome/browser/resources/settings/settings_main/settings_main.js
+++ b/chrome/browser/resources/settings/settings_main/settings_main.js
@@ -49,6 +49,12 @@ Polymer({
},
},
+ /** @private */
+ showNoResultsFound_: {
+ type: Boolean,
+ value: false,
+ },
+
toolbarSpinnerActive: {
type: Boolean,
value: false,
@@ -64,13 +70,6 @@ Polymer({
},
/** @override */
- ready: function() {
- settings.getSearchManager().setCallback(function(isRunning) {
- this.toolbarSpinnerActive = isRunning;
- }.bind(this));
- },
-
- /** @override */
attached: function() {
document.addEventListener('toggle-advanced-page', function(e) {
this.advancedToggleExpanded_ = e.detail;
@@ -154,18 +153,30 @@ Polymer({
*/
searchContents: function(query) {
this.ensureInDefaultSearchPage_();
+ this.toolbarSpinnerActive = true;
// Trigger rendering of the basic and advanced pages and search once ready.
- // Even if those are already rendered, yield to the message loop before
- // initiating searching.
this.showPages_ = {about: false, basic: true, advanced: true};
+
setTimeout(function() {
settings.getSearchManager().search(
query, assert(this.$$('settings-basic-page')));
}.bind(this), 0);
setTimeout(function() {
settings.getSearchManager().search(
- query, assert(this.$$('settings-advanced-page')));
+ query, assert(this.$$('settings-advanced-page'))).then(
+ function(request) {
+ if (!request.finished) {
+ // Nothing to do here. A previous search request was canceled
+ // because a new search request was issued before the first one
+ // completed.
+ return;
+ }
+
+ this.toolbarSpinnerActive = false;
+ this.showNoResultsFound_ =
+ !request.isSame('') && !request.didFindMatches();
+ }.bind(this));
}.bind(this), 0);
},
});

Powered by Google App Engine
This is Rietveld 408576698