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

Unified Diff: chrome/browser/resources/omnibox/omnibox.js

Issue 9289028: Make chrome://omnibox/ be able to report per-provider matches. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
Index: chrome/browser/resources/omnibox/omnibox.js
diff --git a/chrome/browser/resources/omnibox/omnibox.js b/chrome/browser/resources/omnibox/omnibox.js
index 82d67d74b845eb4b2f86765066a271d5329174c3..a66fb582faa74e6abb0a56377580f34b17825b19 100644
--- a/chrome/browser/resources/omnibox/omnibox.js
+++ b/chrome/browser/resources/omnibox/omnibox.js
@@ -29,6 +29,8 @@ cr.define('omniboxDebug', function() {
'change', refresh);
document.getElementById('show-incomplete-results').addEventListener(
'change', refresh);
+ document.getElementById('show-all-providers').addEventListener(
+ 'change', refresh);
}
/**
@@ -89,8 +91,6 @@ cr.define('omniboxDebug', function() {
new PresentationInfoRecord('Relevance', '', 'relevance', true),
new PresentationInfoRecord('Starred', '', 'starred', false),
new PresentationInfoRecord(
- '== default_match iterator', '', 'is_default_match', false),
Mark P 2012/01/25 23:21:08 I removed is_default_match because we as developer
- new PresentationInfoRecord(
'Is History What You Typed Match', '',
'is_history_what_you_typed_match', false),
new PresentationInfoRecord('Description', '', 'description', false),
@@ -190,22 +190,34 @@ cr.define('omniboxDebug', function() {
* {@code
* { 'done': false,
* 'time_since_omnibox_started_ms': 15,
- * 'num_items': 4,
- * 'item_0': {
- * 'destination_url': 'http://mail.google.com',
- * 'provider_name': 'HistoryURL',
- * 'relevance': 1410,
- * 'is_default_match': true,
- * ...
- * }
- * 'item_1: {
- * ...
- * }
- * ...
+ * 'combined_results' :
+ * { 'num_items': 4,
+ * 'item_0':
+ * { 'destination_url': 'http://mail.google.com',
+ * 'provider_name': 'HistoryURL',
+ * 'relevance': 1410,
+ * ...
+ * }
+ * 'item_1: {
+ * ...
+ * }
+ * ...
+ * }
+ * 'results_by_provider':
+ * { 'HistoryURL' :
+ * { 'num_items': 3,
+ * ...
+ * }
+ * 'Search' :
+ * { 'num_items': 1,
+ * ...
+ * }
+ * ...
+ * }
* }
* }
* </pre>
- * For information on how the result is packed, see the
+ * For more information on how the result is packed, see the
* corresponding code in chrome/browser/ui/webui/omnibox_ui.cc
*/
function addResultToOutput(result) {
@@ -213,6 +225,8 @@ cr.define('omniboxDebug', function() {
var inDetailedMode = document.getElementById('show-details').checked;
var showIncompleteResults =
document.getElementById('show-incomplete-results').checked;
+ var showPerProviderResults =
+ document.getElementById('show-all-providers').checked;
// Output the result-level features in detailed mode and in
// show incomplete results mode. We do the latter because without
@@ -228,6 +242,36 @@ cr.define('omniboxDebug', function() {
output.appendChild(p2);
}
+ if (!showPerProviderResults) {
+ // Add combined/merged result table (without label).
+ output.appendChild(addResultTableToOutput(result.combined_results));
+ } else {
+ // Add combined/merged result table with label.
+ var p = document.createElement('p');
+ p.appendChild(document.createTextNode('combined results:'));
+ p.appendChild(addResultTableToOutput(result.combined_results));
+ output.appendChild(p);
+ // Add the pre-provider result tables with labels.
+ for (var provider in result.results_by_provider) {
+ p = document.createElement('p');
+ p.appendChild(document.createTextNode(provider + ' provider results:'));
+ p.appendChild(addResultTableToOutput(
+ result.results_by_provider[provider]));
+ output.appendChild(p);
+ }
+ }
+ }
+
+ /**
+ * @param {Object} |result| is either the combined_results component
+ * of the structure described in the comment by addResultToOutput()
+ * above or is one of the per-provider results in the structure.
+ * (Both have the same format.)
+ * @return {HTMLTableCellElement} that is a user-readable HTML
+ * representation of this object.
+ */
+ function addResultTableToOutput(result) {
+ var inDetailedMode = document.getElementById('show-details').checked;
// Create a table to hold all the autocomplete items.
var table = document.createElement('table');
table.className = 'autocomplete-results-table';
@@ -268,7 +312,7 @@ cr.define('omniboxDebug', function() {
table.appendChild(row);
}
- output.appendChild(table);
+ return table;
}
/* Repaints the page based on the contents of the array

Powered by Google App Engine
This is Rietveld 408576698