Commit 13a6e5b3 authored by mpearson's avatar mpearson Committed by Commit bot

Omnibox - Code Cleanup - Remove Unnecessary is_history_what_you_typed_match

I audited the code in the process of removing this.  It seems safe to me.

Note that HistoryURL provider isn't the only provider to create a match
of type URL_WHAT_YOU_TYPED--ZeroSuggest does too.  I thought about
creating a helper function that tests for URL_WHAT_YOU_TYPED from the
HistoryURL provider and using that where is_history_what_you_typed_match
is currently used.  Doing so would be exactly equivalent to the current
logic.  However, I looked at all the places is_history_what_you_typed_match
is used, and I see no harm in doing the simpler test (i.e., check only for
URL_WHAT_YOU_TYPED, not URL_WHAT_YOU_TYPED from HistoryURL provider).

TBR=estade
for trivial change to omnibox.js

BUG=471360

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

Cr-Commit-Position: refs/heads/master@{#330843}
parent ff27ca20
...@@ -62,7 +62,7 @@ void HistoryProvider::DeleteMatchFromMatches(const AutocompleteMatch& match) { ...@@ -62,7 +62,7 @@ void HistoryProvider::DeleteMatchFromMatches(const AutocompleteMatch& match) {
for (ACMatches::iterator i(matches_.begin()); i != matches_.end(); ++i) { for (ACMatches::iterator i(matches_.begin()); i != matches_.end(); ++i) {
if (i->destination_url == match.destination_url && i->type == match.type) { if (i->destination_url == match.destination_url && i->type == match.type) {
found = true; found = true;
if (i->is_history_what_you_typed_match || if ((i->type == AutocompleteMatchType::URL_WHAT_YOU_TYPED) ||
(bookmark_model && (bookmark_model &&
bookmark_model->IsBookmarked(i->destination_url))) { bookmark_model->IsBookmarked(i->destination_url))) {
// We can't get rid of What-You-Typed or Bookmarked matches, // We can't get rid of What-You-Typed or Bookmarked matches,
......
...@@ -645,8 +645,6 @@ AutocompleteMatch HistoryURLProvider::SuggestExactInput( ...@@ -645,8 +645,6 @@ AutocompleteMatch HistoryURLProvider::SuggestExactInput(
match.contents.length(), ACMatchClassification::URL, match.contents.length(), ACMatchClassification::URL,
&match.contents_class); &match.contents_class);
} }
match.is_history_what_you_typed_match = true;
} }
return match; return match;
...@@ -778,9 +776,9 @@ void HistoryURLProvider::DoAutocomplete(history::HistoryBackend* backend, ...@@ -778,9 +776,9 @@ void HistoryURLProvider::DoAutocomplete(history::HistoryBackend* backend,
// Check whether what the user typed appears in history. // Check whether what the user typed appears in history.
const bool can_check_history_for_exact_match = const bool can_check_history_for_exact_match =
// Checking what_you_typed_match.is_history_what_you_typed_match tells us // Checking what_you_typed_match.allowed_to_be_default_match tells us
// whether SuggestExactInput() succeeded in constructing a valid match. // whether SuggestExactInput() succeeded in constructing a valid match.
params->what_you_typed_match.is_history_what_you_typed_match && params->what_you_typed_match.allowed_to_be_default_match &&
// Additionally, in the case where the user has typed "foo.com" and // Additionally, in the case where the user has typed "foo.com" and
// visited (but not typed) "foo/", and the input is "foo", the first pass // visited (but not typed) "foo/", and the input is "foo", the first pass
// will fall into the FRONT_HISTORY_MATCH case for "foo.com" but the // will fall into the FRONT_HISTORY_MATCH case for "foo.com" but the
......
...@@ -423,7 +423,6 @@ AutocompleteMatch ZeroSuggestProvider::MatchForCurrentURL() { ...@@ -423,7 +423,6 @@ AutocompleteMatch ZeroSuggestProvider::MatchForCurrentURL() {
AutocompleteMatch match; AutocompleteMatch match;
AutocompleteClassifierFactory::GetForProfile(profile_)->Classify( AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(
permanent_text_, false, true, current_page_classification_, &match, NULL); permanent_text_, false, true, current_page_classification_, &match, NULL);
match.is_history_what_you_typed_match = false;
match.allowed_to_be_default_match = true; match.allowed_to_be_default_match = true;
// The placeholder suggestion for the current URL has high relevance so // The placeholder suggestion for the current URL has high relevance so
......
...@@ -135,10 +135,6 @@ define('main', [ ...@@ -135,10 +135,6 @@ define('main', [
'navigates to).'), 'navigates to).'),
new PresentationInfoRecord('Starred', '', 'starred', false, new PresentationInfoRecord('Starred', '', 'starred', false,
'A green checkmark indicates that the result has been bookmarked.'), 'A green checkmark indicates that the result has been bookmarked.'),
new PresentationInfoRecord(
'HWYT', '', 'is_history_what_you_typed_match', false,
'A green checkmark indicates that the result is an History What You ' +
'Typed Match'),
new PresentationInfoRecord('Description', '', 'description', false, new PresentationInfoRecord('Description', '', 'description', false,
'The page title of the result.'), 'The page title of the result.'),
new PresentationInfoRecord('URL', '', 'destination_url', true, new PresentationInfoRecord('URL', '', 'destination_url', true,
......
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
#include "components/bookmarks/browser/bookmark_model.h" #include "components/bookmarks/browser/bookmark_model.h"
#include "components/favicon/content/content_favicon_driver.h" #include "components/favicon/content/content_favicon_driver.h"
#include "components/metrics/proto/omnibox_event.pb.h" #include "components/metrics/proto/omnibox_event.pb.h"
#include "components/omnibox/autocomplete_match_type.h"
#include "components/omnibox/autocomplete_provider.h" #include "components/omnibox/autocomplete_provider.h"
#include "components/omnibox/keyword_provider.h" #include "components/omnibox/keyword_provider.h"
#include "components/omnibox/search_provider.h" #include "components/omnibox/search_provider.h"
...@@ -697,8 +698,9 @@ void OmniboxEditModel::AcceptInput(WindowOpenDisposition disposition, ...@@ -697,8 +698,9 @@ void OmniboxEditModel::AcceptInput(WindowOpenDisposition disposition,
// (e.g. manually retyping the same search query), and it seems wrong to // (e.g. manually retyping the same search query), and it seems wrong to
// treat this as a reload. // treat this as a reload.
match.transition = ui::PAGE_TRANSITION_RELOAD; match.transition = ui::PAGE_TRANSITION_RELOAD;
} else if (for_drop || ((paste_state_ != NONE) && } else if (for_drop ||
match.is_history_what_you_typed_match)) { ((paste_state_ != NONE) &&
(match.type == AutocompleteMatchType::URL_WHAT_YOU_TYPED))) {
// When the user pasted in a URL and hit enter, score it like a link click // When the user pasted in a URL and hit enter, score it like a link click
// rather than a normal typed URL, so it doesn't get inline autocompleted // rather than a normal typed URL, so it doesn't get inline autocompleted
// as aggressively later. // as aggressively later.
......
...@@ -141,7 +141,7 @@ void OmniboxPopupModel::SetSelectedLine(size_t line, ...@@ -141,7 +141,7 @@ void OmniboxPopupModel::SetSelectedLine(size_t line,
manually_selected_match_.destination_url = match.destination_url; manually_selected_match_.destination_url = match.destination_url;
manually_selected_match_.provider_affinity = match.provider; manually_selected_match_.provider_affinity = match.provider;
manually_selected_match_.is_history_what_you_typed_match = manually_selected_match_.is_history_what_you_typed_match =
match.is_history_what_you_typed_match; match.type == AutocompleteMatchType::URL_WHAT_YOU_TYPED;
} }
if (line == selected_line_ && !force) if (line == selected_line_ && !force)
......
...@@ -21,7 +21,6 @@ struct AutocompleteMatchMojo { ...@@ -21,7 +21,6 @@ struct AutocompleteMatchMojo {
string contents; string contents;
string description; string description;
int32 transition; int32 transition;
bool is_history_what_you_typed_match;
bool allowed_to_be_default_match; bool allowed_to_be_default_match;
string type; string type;
string? associated_keyword; string? associated_keyword;
......
...@@ -75,8 +75,6 @@ struct TypeConverter<AutocompleteMatchMojoPtr, AutocompleteMatch> { ...@@ -75,8 +75,6 @@ struct TypeConverter<AutocompleteMatchMojoPtr, AutocompleteMatch> {
// represents description classification. i.e., for each character, what // represents description classification. i.e., for each character, what
// type of text it is. // type of text it is.
result->transition = input.transition; result->transition = input.transition;
result->is_history_what_you_typed_match =
input.is_history_what_you_typed_match;
result->allowed_to_be_default_match = input.allowed_to_be_default_match; result->allowed_to_be_default_match = input.allowed_to_be_default_match;
result->type = AutocompleteMatchType::ToString(input.type); result->type = AutocompleteMatchType::ToString(input.type);
if (input.associated_keyword.get() != NULL) { if (input.associated_keyword.get() != NULL) {
......
...@@ -45,7 +45,6 @@ AutocompleteMatch::AutocompleteMatch() ...@@ -45,7 +45,6 @@ AutocompleteMatch::AutocompleteMatch()
deletable(false), deletable(false),
allowed_to_be_default_match(false), allowed_to_be_default_match(false),
transition(ui::PAGE_TRANSITION_GENERATED), transition(ui::PAGE_TRANSITION_GENERATED),
is_history_what_you_typed_match(false),
type(AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED), type(AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED),
from_previous(false) { from_previous(false) {
} }
...@@ -60,7 +59,6 @@ AutocompleteMatch::AutocompleteMatch(AutocompleteProvider* provider, ...@@ -60,7 +59,6 @@ AutocompleteMatch::AutocompleteMatch(AutocompleteProvider* provider,
deletable(deletable), deletable(deletable),
allowed_to_be_default_match(false), allowed_to_be_default_match(false),
transition(ui::PAGE_TRANSITION_TYPED), transition(ui::PAGE_TRANSITION_TYPED),
is_history_what_you_typed_match(false),
type(type), type(type),
from_previous(false) { from_previous(false) {
} }
...@@ -83,7 +81,6 @@ AutocompleteMatch::AutocompleteMatch(const AutocompleteMatch& match) ...@@ -83,7 +81,6 @@ AutocompleteMatch::AutocompleteMatch(const AutocompleteMatch& match)
answer_type(match.answer_type), answer_type(match.answer_type),
answer(SuggestionAnswer::copy(match.answer.get())), answer(SuggestionAnswer::copy(match.answer.get())),
transition(match.transition), transition(match.transition),
is_history_what_you_typed_match(match.is_history_what_you_typed_match),
type(match.type), type(match.type),
associated_keyword(match.associated_keyword.get() ? associated_keyword(match.associated_keyword.get() ?
new AutocompleteMatch(*match.associated_keyword) : NULL), new AutocompleteMatch(*match.associated_keyword) : NULL),
...@@ -121,7 +118,6 @@ AutocompleteMatch& AutocompleteMatch::operator=( ...@@ -121,7 +118,6 @@ AutocompleteMatch& AutocompleteMatch::operator=(
answer_type = match.answer_type; answer_type = match.answer_type;
answer = SuggestionAnswer::copy(match.answer.get()); answer = SuggestionAnswer::copy(match.answer.get());
transition = match.transition; transition = match.transition;
is_history_what_you_typed_match = match.is_history_what_you_typed_match;
type = match.type; type = match.type;
associated_keyword.reset(match.associated_keyword.get() ? associated_keyword.reset(match.associated_keyword.get() ?
new AutocompleteMatch(*match.associated_keyword) : NULL); new AutocompleteMatch(*match.associated_keyword) : NULL);
......
...@@ -330,10 +330,6 @@ struct AutocompleteMatch { ...@@ -330,10 +330,6 @@ struct AutocompleteMatch {
// it to GENERATED. // it to GENERATED.
ui::PageTransition transition; ui::PageTransition transition;
// True when this match is the "what you typed" match from the history
// system.
bool is_history_what_you_typed_match;
// Type of this match. // Type of this match.
Type type; Type type;
......
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