Commit ccdacfec authored by Kevin Bailey's avatar Kevin Bailey Committed by Commit Bot

[omnibox metrics] Reland recording of new metrics keyword fields

We disabled the recording of the new keyword metrics fields in
https://chromium-review.googlesource.com/c/1481732 due to the
triggering of strange crashes and exceptions. We believe that
this was caused by an uninitialized field - bool from_keyword -
which has now been remedied.

Bug: 837395 934316
Change-Id: I6a3a9fc9582bb1df5c2c4e4b0f72dca324b3c9b1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1539856Reviewed-by: default avatarJustin Donnelly <jdonnelly@chromium.org>
Reviewed-by: default avatarMark Pearson <mpearson@chromium.org>
Commit-Queue: Kevin Bailey <krb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#644449}
parent f21df890
......@@ -174,10 +174,20 @@ void OmniboxMetricsProvider::RecordOmniboxOpenedURL(const OmniboxLog& log) {
if (i->subtype_identifier > 0)
suggestion->set_result_subtype_identifier(i->subtype_identifier);
suggestion->set_has_tab_match(i->has_tab_match);
suggestion->set_is_keyword_suggestion(i->from_keyword);
}
for (auto i(log.providers_info.begin()); i != log.providers_info.end(); ++i) {
OmniboxEventProto::ProviderInfo* provider_info =
omnibox_event->add_provider_info();
provider_info->CopyFrom(*i);
}
omnibox_event->set_in_keyword_mode(log.in_keyword_mode);
if (log.in_keyword_mode) {
if (metrics::OmniboxEventProto_KeywordModeEntryMethod_IsValid(
log.keyword_mode_entry_method))
omnibox_event->set_keyword_mode_entry_method(
log.keyword_mode_entry_method);
else
omnibox_event->set_keyword_mode_entry_method(OmniboxEventProto::INVALID);
}
}
......@@ -295,7 +295,16 @@ AutocompleteMatch ShortcutsProvider::ShortcutToACMatch(
base::StartsWith(base::UTF16ToUTF8(input.text()),
base::StrCat({base::UTF16ToUTF8(match.keyword), " "}),
base::CompareCase::INSENSITIVE_ASCII);
if (is_search_type) {
match.from_keyword =
// Either the match is not from the default search provider:
match.keyword != client_->GetTemplateURLService()
->GetDefaultSearchProvider()
->keyword() ||
// Or it is, but keyword mode was invoked explicitly and the keyword
// in the input is also of the default search provider.
(input.prefer_keyword() && keyword_matches);
}
// True if input is in keyword mode and the match is a URL suggestion or the
// match has a different keyword.
bool would_cause_leaving_keyword_mode =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment