Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: components/omnibox/browser/search_suggestion_parser.cc

Issue 2755503002: Add a new entry to omnibox_event.proto to log specific type of contextual suggestions (Closed)
Patch Set: Moved the logging of the specific type in the omnibox_event proto. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..ea07450d47f830ed31a9edb35ce26c17d65a4f0f 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"
#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
@@ -447,6 +452,13 @@ bool SearchSuggestionParser::ParseSuggestResults(
json_serializer.Serialize(*extras);
}
+ // Get zero suggest subtypes.
+ const base::ListValue* zero_suggest_subtypes = NULL;
+ if (root_list->GetList(5, &zero_suggest_subtypes) &&
+ zero_suggest_subtypes->GetSize() != results_list->GetSize()) {
+ zero_suggest_subtypes = NULL;
+ }
+
// Clear the previous results now that new results are available.
results->suggest_results.clear();
results->navigation_results.clear();
@@ -486,9 +498,15 @@ bool SearchSuggestionParser::ParseSuggestResults(
base::string16 title;
if (descriptions != NULL)
descriptions->GetString(index, &title);
+ // add zero suggest subtype
+ int specific_type_identifier = 0;
+ if (zero_suggest_subtypes) {
+ zero_suggest_subtypes->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

Powered by Google App Engine
This is Rietveld 408576698