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

Unified Diff: chrome/browser/resources/sync_internals/sync_search.js

Issue 138273009: Quick searches for sync-internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@submitsearchsync
Patch Set: Consolidated both patchsets Created 6 years, 11 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
« no previous file with comments | « chrome/browser/resources/sync_internals/sync_search.css ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/sync_internals/sync_search.js
diff --git a/chrome/browser/resources/sync_internals/sync_search.js b/chrome/browser/resources/sync_internals/sync_search.js
index 63ec513ce79c01193f1dc3084f9ac12899910497..fc9d504ab8d57a5ef2ba6083da157e796b1dbe4d 100644
--- a/chrome/browser/resources/sync_internals/sync_search.js
+++ b/chrome/browser/resources/sync_internals/sync_search.js
@@ -7,6 +7,35 @@
cr.define('chrome.sync', function() {
var currSearchId = 0;
+ var setQueryString = function(queryControl, query) {
+ queryControl.value = query;
+ };
+
+ var createDoQueryFunction = function(queryControl, submitControl, query) {
+ return function() {
+ setQueryString(queryControl, query);
+ submitControl.click();
+ };
+ };
+
+ /**
+ * Decorates the quick search controls
+ *
+ * @param {Array of DOM elements} quickLinkArray The <a> object which
+ * will be given a link to a quick filter option.
+ * @param {!HTMLInputElement} queryControl The <input> object of
+ * type=search where the user types in his query.
+ */
+ var decorateQuickQueryControls = function(quickLinkArray, submitControl,
+ queryControl) {
+ for (var index = 0; index < allLinks.length; ++index) {
+ var quickQuery = allLinks[index].getAttribute('data-query');
+ var quickQueryFunction = createDoQueryFunction(queryControl,
+ submitControl, quickQuery);
+ allLinks[index].addEventListener('click', quickQueryFunction);
+ }
+ };
+
/**
* Runs a search with the given query.
*
@@ -38,7 +67,7 @@ cr.define('chrome.sync', function() {
*
* @param {!HTMLInputElement} queryControl The <input> object of
* type=search where the user types in his query.
- * @param {!HTMLButtonElement} submitControl The <button> object of
+ * @param {!HTMLButtonElement} submitControl The <button> object
* where the user can click to do his query.
* @param {!HTMLElement} statusControl The <span> object display the
* search status.
@@ -102,6 +131,7 @@ cr.define('chrome.sync', function() {
}
return {
- decorateSearchControls: decorateSearchControls
+ decorateSearchControls: decorateSearchControls,
+ decorateQuickQueryControls: decorateQuickQueryControls
};
});
« no previous file with comments | « chrome/browser/resources/sync_internals/sync_search.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698