Commit 0dc8fbf3 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,rogerta@chromium.org
bauerb for change to chrome/browser/android/omnibox/autocomplete_controller_android.cc
rogerta for change to chrome/browser/rlz/rlz_unittest.cc

Committed: https://crrev.com/c281fb257d2acdd247b0692380d084863e2dd462
Cr-Commit-Position: refs/heads/master@{#308233}

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

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