| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 var chrome; | 5 var chrome; |
| 6 if (!chrome) | 6 if (!chrome) |
| 7 chrome = {}; | 7 chrome = {}; |
| 8 | 8 |
| 9 if (!chrome.embeddedSearch) { | 9 if (!chrome.embeddedSearch) { |
| 10 chrome.embeddedSearch = new function() { | 10 chrome.embeddedSearch = new function() { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 var newRelevance = result.rankingData.relevance; | 92 var newRelevance = result.rankingData.relevance; |
| 93 if (newRelevance > oldRelevance) { | 93 if (newRelevance > oldRelevance) { |
| 94 urlToResultMap[url] = result; | 94 urlToResultMap[url] = result; |
| 95 } | 95 } |
| 96 } else { | 96 } else { |
| 97 urlToResultMap[url] = result; | 97 urlToResultMap[url] = result; |
| 98 } | 98 } |
| 99 } | 99 } |
| 100 var dedupedResults = []; | 100 var dedupedResults = []; |
| 101 for (url in urlToResultMap) { | 101 for (url in urlToResultMap) { |
| 102 dedupedResults.push(urlToResultMap[url]); | 102 $Array.push(dedupedResults, urlToResultMap[url]); |
| 103 } | 103 } |
| 104 return dedupedResults; | 104 return dedupedResults; |
| 105 } | 105 } |
| 106 | 106 |
| 107 var lastPrefixQueriedForDuplicates = ''; | 107 var lastPrefixQueriedForDuplicates = ''; |
| 108 var numDedupeAttempts = 0; | 108 var numDedupeAttempts = 0; |
| 109 | 109 |
| 110 function DedupeClientSuggestions(clientSuggestions) { | 110 function DedupeClientSuggestions(clientSuggestions) { |
| 111 var userInput = GetQuery(); | 111 var userInput = GetQuery(); |
| 112 if (userInput == lastPrefixQueriedForDuplicates) { | 112 if (userInput == lastPrefixQueriedForDuplicates) { |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 this.onthemechange = null; | 292 this.onthemechange = null; |
| 293 this.oninputstart = null; | 293 this.oninputstart = null; |
| 294 this.oninputcancel = null; | 294 this.oninputcancel = null; |
| 295 }; | 295 }; |
| 296 | 296 |
| 297 // Export legacy searchbox API. | 297 // Export legacy searchbox API. |
| 298 // TODO: Remove this when Instant Extended is fully launched. | 298 // TODO: Remove this when Instant Extended is fully launched. |
| 299 chrome.searchBox = this.searchBox; | 299 chrome.searchBox = this.searchBox; |
| 300 }; | 300 }; |
| 301 } | 301 } |
| OLD | NEW |