Chromium Code Reviews| Index: components/omnibox/browser/search_suggestion_parser.cc |
| diff --git a/components/omnibox/browser/search_suggestion_parser.cc b/components/omnibox/browser/search_suggestion_parser.cc |
| index 04e10a02ba461d6d5b8f60b09e06c229b207673a..c86e43f43d82f9becc987ffa37797eb1aff6ebb9 100644 |
| --- a/components/omnibox/browser/search_suggestion_parser.cc |
| +++ b/components/omnibox/browser/search_suggestion_parser.cc |
| @@ -20,6 +20,7 @@ |
| #include "base/values.h" |
| #include "components/omnibox/browser/autocomplete_i18n.h" |
| #include "components/omnibox/browser/autocomplete_input.h" |
| +#include "components/omnibox/browser/omnibox_field_trial.h" |
|
Mark P
2017/03/21 19:54:25
Why do you need this?
gcomanici
2017/03/22 02:39:03
Removed.
|
| #include "components/omnibox/browser/url_prefix.h" |
| #include "components/url_formatter/url_fixer.h" |
| #include "components/url_formatter/url_formatter.h" |
| @@ -229,7 +230,8 @@ SearchSuggestionParser::NavigationResult::NavigationResult( |
| bool from_keyword_provider, |
| int relevance, |
| bool relevance_from_server, |
| - const base::string16& input_text) |
| + const base::string16& input_text, |
| + int specific_type_identifier) |
| : Result(from_keyword_provider, |
| relevance, |
| relevance_from_server, |
| @@ -246,11 +248,14 @@ SearchSuggestionParser::NavigationResult::NavigationResult( |
| nullptr, |
| nullptr), |
| scheme_classifier)), |
| - description_(description) { |
| + description_(description), |
| + specific_type_identifier_(specific_type_identifier) { |
| DCHECK(url_.is_valid()); |
| CalculateAndClassifyMatchContents(true, input_text); |
| } |
| +SearchSuggestionParser::NavigationResult::NavigationResult( |
| + const NavigationResult& nav) = default; |
| SearchSuggestionParser::NavigationResult::~NavigationResult() {} |
| void |
| @@ -415,6 +420,7 @@ bool SearchSuggestionParser::ParseSuggestResults( |
| const base::ListValue* types = NULL; |
| const base::ListValue* relevances = NULL; |
| const base::ListValue* suggestion_details = NULL; |
| + const base::ListValue* specific_type_identifiers = NULL; |
| const base::DictionaryValue* extras = NULL; |
| int prefetch_index = -1; |
| if (root_list->GetDictionary(4, &extras)) { |
| @@ -441,6 +447,12 @@ bool SearchSuggestionParser::ParseSuggestResults( |
| suggestion_details->GetSize() != results_list->GetSize()) |
| suggestion_details = NULL; |
| + // Get specific type identifiers. |
| + if (extras->GetList("specifictypeid", &specific_type_identifiers) && |
|
Mark P
2017/03/21 19:54:25
Let's use the "google:" as with everything else he
gcomanici
2017/03/22 02:39:03
Done.
|
| + specific_type_identifiers->GetSize() != results_list->GetSize()) { |
| + specific_type_identifiers = NULL; |
| + } |
| + |
| // Store the metadata that came with the response in case we need to pass it |
| // along with the prefetch query to Instant. |
| JSONStringValueSerializer json_serializer(&results->metadata); |
| @@ -486,9 +498,16 @@ bool SearchSuggestionParser::ParseSuggestResults( |
| base::string16 title; |
| if (descriptions != NULL) |
| descriptions->GetString(index, &title); |
| + // add zero suggest subtype |
|
Mark P
2017/03/21 19:54:25
Correct comment (not just zero suggest; we're not
gcomanici
2017/03/22 02:39:03
I removed it, as the code is self explanatory.
|
| + int specific_type_identifier = 0; |
| + if (specific_type_identifiers) { |
| + specific_type_identifiers->GetInteger(index, |
| + &specific_type_identifier); |
| + } |
| results->navigation_results.push_back(NavigationResult( |
| scheme_classifier, url, match_type, title, deletion_url, |
| - is_keyword_result, relevance, relevances != NULL, input.text())); |
| + is_keyword_result, relevance, relevances != NULL, input.text(), |
| + specific_type_identifier)); |
| } |
| } else { |
| // TODO(dschuyler) If the "= " is no longer sent from the back-end |