Chromium Code Reviews| 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..528d8ad5db3e984aec854ae7acf359b5036b7a2e 100644 |
| --- a/chrome/browser/resources/omnibox/omnibox.js |
| +++ b/chrome/browser/resources/omnibox/omnibox.js |
| @@ -25,9 +25,7 @@ cr.define('omniboxDebug', function() { |
| function initialize() { |
| document.getElementById('omnibox-input-form').addEventListener( |
| 'submit', startOmniboxQuery, false); |
| - document.getElementById('show-details').addEventListener( |
| - 'change', refresh); |
| - document.getElementById('show-incomplete-results').addEventListener( |
| + document.getElementById('omnibox-input-form-options').addEventListener( |
| 'change', refresh); |
|
arv (Not doing code reviews)
2012/01/31 20:29:05
you need to pass a third argument here
Mark P
2012/01/31 20:55:34
false?
You do realize that in an earlier code rev
|
| } |
| @@ -89,8 +87,6 @@ cr.define('omniboxDebug', function() { |
| new PresentationInfoRecord('Relevance', '', 'relevance', true), |
| new PresentationInfoRecord('Starred', '', 'starred', false), |
| new PresentationInfoRecord( |
| - '== default_match iterator', '', 'is_default_match', false), |
| - new PresentationInfoRecord( |
| 'Is History What You Typed Match', '', |
| 'is_history_what_you_typed_match', false), |
| new PresentationInfoRecord('Description', '', 'description', false), |
| @@ -188,24 +184,37 @@ cr.define('omniboxDebug', function() { |
| * autocomplete matches. Here's an example of what it looks like: |
| * <pre> |
| * {@code |
| - * { 'done': false, |
| + * { |
| + * '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, |
| + * 'combined_results' : { |
| + * 'num_items': 4, |
| + * 'item_0': { |
| + * 'destination_url': 'http://mail.google.com', |
| + * 'provider_name': 'HistoryURL', |
| + * 'relevance': 1410, |
| + * ... |
| + * } |
| + * 'item_1: { |
| + * ... |
| + * } |
| * ... |
| * } |
| - * '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 +222,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 +239,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.textContent = '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 either the combined_results component of |
| + * the structure described in the comment by addResultToOutput() |
| + * above or 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 +309,7 @@ cr.define('omniboxDebug', function() { |
| table.appendChild(row); |
| } |
| - output.appendChild(table); |
| + return table; |
| } |
| /* Repaints the page based on the contents of the array |