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 #include "chrome/browser/ui/search/instant_controller.h" | 5 #include "chrome/browser/ui/search/instant_controller.h" |
6 | 6 |
7 #include <iterator> | 7 #include <iterator> |
8 | 8 |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 1805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1816 // TODO(dcblack): Remove extraneous history entry caused by 404s. | 1816 // TODO(dcblack): Remove extraneous history entry caused by 404s. |
1817 // Note that the base case of a 204 being returned doesn't push a history | 1817 // Note that the base case of a 204 being returned doesn't push a history |
1818 // entry. | 1818 // entry. |
1819 } | 1819 } |
1820 | 1820 |
1821 void InstantController::PopulateInstantAutocompleteResultFromMatch( | 1821 void InstantController::PopulateInstantAutocompleteResultFromMatch( |
1822 const AutocompleteMatch& match, size_t autocomplete_match_index, | 1822 const AutocompleteMatch& match, size_t autocomplete_match_index, |
1823 InstantAutocompleteResult* result) { | 1823 InstantAutocompleteResult* result) { |
1824 DCHECK(result); | 1824 DCHECK(result); |
1825 result->provider = UTF8ToUTF16(match.provider->GetName()); | 1825 result->provider = UTF8ToUTF16(match.provider->GetName()); |
1826 result->type = UTF8ToUTF16(AutocompleteMatchType::ToString(match.type)); | 1826 result->type = match.type; |
1827 result->description = match.description; | 1827 result->description = match.description; |
1828 result->destination_url = UTF8ToUTF16(match.destination_url.spec()); | 1828 result->destination_url = UTF8ToUTF16(match.destination_url.spec()); |
1829 | 1829 |
1830 // Setting the search_query field tells the Instant page to treat the | 1830 // Setting the search_query field tells the Instant page to treat the |
1831 // suggestion as a query. | 1831 // suggestion as a query. |
1832 if (AutocompleteMatch::IsSearchType(match.type)) | 1832 if (AutocompleteMatch::IsSearchType(match.type)) |
1833 result->search_query = match.contents; | 1833 result->search_query = match.contents; |
1834 | 1834 |
1835 result->transition = match.transition; | 1835 result->transition = match.transition; |
1836 result->relevance = match.relevance; | 1836 result->relevance = match.relevance; |
1837 result->autocomplete_match_index = autocomplete_match_index; | 1837 result->autocomplete_match_index = autocomplete_match_index; |
1838 | 1838 |
1839 DVLOG(1) << " " << result->relevance << " " << result->type << " " | 1839 DVLOG(1) << " " << result->relevance << " " |
| 1840 << UTF8ToUTF16(AutocompleteMatchType::ToString(result->type)) << " " |
1840 << result->provider << " " << result->destination_url << " '" | 1841 << result->provider << " " << result->destination_url << " '" |
1841 << result->description << "' '" << result->search_query << "' " | 1842 << result->description << "' '" << result->search_query << "' " |
1842 << result->transition << " " << result->autocomplete_match_index; | 1843 << result->transition << " " << result->autocomplete_match_index; |
1843 } | 1844 } |
OLD | NEW |