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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 var newRelevance = result.rankingData.relevance; | 93 var newRelevance = result.rankingData.relevance; |
94 if (newRelevance > oldRelevance) { | 94 if (newRelevance > oldRelevance) { |
95 urlToResultMap[url] = result; | 95 urlToResultMap[url] = result; |
96 } | 96 } |
97 } else { | 97 } else { |
98 urlToResultMap[url] = result; | 98 urlToResultMap[url] = result; |
99 } | 99 } |
100 } | 100 } |
101 var dedupedResults = []; | 101 var dedupedResults = []; |
102 for (url in urlToResultMap) { | 102 for (url in urlToResultMap) { |
103 dedupedResults.push(urlToResultMap[url]); | 103 $Array.push(dedupedResults, urlToResultMap[url]); |
104 } | 104 } |
105 return dedupedResults; | 105 return dedupedResults; |
106 } | 106 } |
107 | 107 |
108 var lastPrefixQueriedForDuplicates = ''; | 108 var lastPrefixQueriedForDuplicates = ''; |
109 var numDedupeAttempts = 0; | 109 var numDedupeAttempts = 0; |
110 | 110 |
111 function DedupeClientSuggestions(clientSuggestions) { | 111 function DedupeClientSuggestions(clientSuggestions) { |
112 var userInput = GetQuery(); | 112 var userInput = GetQuery(); |
113 if (userInput == lastPrefixQueriedForDuplicates) { | 113 if (userInput == lastPrefixQueriedForDuplicates) { |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 this.onthemechange = null; | 296 this.onthemechange = null; |
297 this.oninputstart = null; | 297 this.oninputstart = null; |
298 this.oninputcancel = null; | 298 this.oninputcancel = null; |
299 }; | 299 }; |
300 | 300 |
301 // Export legacy searchbox API. | 301 // Export legacy searchbox API. |
302 // TODO: Remove this when Instant Extended is fully launched. | 302 // TODO: Remove this when Instant Extended is fully launched. |
303 chrome.searchBox = this.searchBox; | 303 chrome.searchBox = this.searchBox; |
304 }; | 304 }; |
305 } | 305 } |
OLD | NEW |