Commit c281fb25 authored by mpearson's avatar mpearson Committed by Commit bot

Omnibox Watcher: Don't Flag Incidents that are Paste+Enter

The code currently excludes paste-and-go operations.  It should probably
also exclude paste+enter operations; these are effectively equivalent.

TODO before submitting: test interactively

BUG=
TBR=bauerb@chromium.org

Review URL: https://codereview.chromium.org/795343002

Cr-Commit-Position: refs/heads/master@{#308233}
parent 61814731
......@@ -223,6 +223,7 @@ void AutocompleteControllerAndroid::OnSuggestionSelected(
true,
selected_index,
false,
false, /* don't know */
SessionTabHelper::IdForTab(web_contents),
current_page_classification,
base::TimeDelta::FromMilliseconds(elapsed_time_since_first_modified),
......
......@@ -11,6 +11,7 @@ OmniboxLog::OmniboxLog(
bool is_popup_open,
size_t selected_index,
bool is_paste_and_go,
bool last_action_was_paste,
SessionID::id_type tab_id,
metrics::OmniboxEventProto::PageClassification current_page_classification,
base::TimeDelta elapsed_time_since_user_first_modified_omnibox,
......@@ -23,6 +24,7 @@ OmniboxLog::OmniboxLog(
is_popup_open(is_popup_open),
selected_index(selected_index),
is_paste_and_go(is_paste_and_go),
last_action_was_paste(last_action_was_paste),
tab_id(tab_id),
current_page_classification(current_page_classification),
elapsed_time_since_user_first_modified_omnibox(
......
......@@ -26,6 +26,7 @@ struct OmniboxLog {
bool is_popup_open,
size_t selected_index,
bool is_paste_and_go,
bool last_action_was_paste,
SessionID::id_type tab_id,
metrics::OmniboxEventProto::PageClassification
current_page_classification,
......@@ -56,6 +57,10 @@ struct OmniboxLog {
// (The codebase refers to both these types as paste-and-go.)
bool is_paste_and_go;
// True if the user's last action was a paste or if (somehow) the user is
// still in the act of pasting.
bool last_action_was_paste;
// ID of the tab the selected autocomplete suggestion was opened in.
// Set to -1 if we haven't yet determined the destination tab.
SessionID::id_type tab_id;
......
......@@ -37,8 +37,8 @@ void OmniboxWatcher::Observe(int type,
// No normal person can type URLs that fast! Navigating to a URL as a
// result of such typing is suspicious.
// TODO(mpearson): Add support for suspicious queries.
if (!log->is_paste_and_go && log->is_popup_open &&
(log->text.length() > 200) &&
if (!log->is_paste_and_go && !log->last_action_was_paste &&
log->is_popup_open && (log->text.length() > 200) &&
(log->elapsed_time_since_user_first_modified_omnibox <
base::TimeDelta::FromSeconds(1)) &&
!AutocompleteMatch::IsSearchType(selected_suggestion.type)) {
......
......@@ -755,7 +755,8 @@ void OmniboxEditModel::OpenMatch(AutocompleteMatch match,
input_.type(),
popup_model()->IsOpen(),
(!popup_model()->IsOpen() || !pasted_text.empty()) ? 0 : index,
!pasted_text.empty(),
!pasted_text.empty(), // is_paste_and_go
paste_state_ != NONE, // last_action_was_paste
-1, // don't yet know tab ID; set later if appropriate
ClassifyPage(),
elapsed_time_since_user_first_modified_omnibox,
......
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