Chromium Code Reviews| Index: components/omnibox/browser/omnibox_edit_model.cc |
| diff --git a/components/omnibox/browser/omnibox_edit_model.cc b/components/omnibox/browser/omnibox_edit_model.cc |
| index 4d6b3c5d60658bae4377dde199983725ead50f03..0fd120b573336dd0b959f28baf559434243ed95e 100644 |
| --- a/components/omnibox/browser/omnibox_edit_model.cc |
| +++ b/components/omnibox/browser/omnibox_edit_model.cc |
| @@ -88,7 +88,6 @@ const int kPercentageMatchHistogramWidthBuckets[] = { 400, 700, 1200 }; |
| void RecordPercentageMatchHistogram(const base::string16& old_text, |
| const base::string16& new_text, |
| - bool url_replacement_active, |
| ui::PageTransition transition, |
| int omnibox_width) { |
| size_t avg_length = (old_text.length() + new_text.length()) / 2; |
| @@ -104,24 +103,13 @@ void RecordPercentageMatchHistogram(const base::string16& old_text, |
| } |
| std::string histogram_name; |
| - if (url_replacement_active) { |
| - if (ui::PageTransitionTypeIncludingQualifiersIs( |
| - transition, ui::PAGE_TRANSITION_TYPED)) { |
| - histogram_name = "InstantExtended.PercentageMatchV2_QuerytoURL"; |
| - UMA_HISTOGRAM_PERCENTAGE(histogram_name, percent); |
| - } else { |
| - histogram_name = "InstantExtended.PercentageMatchV2_QuerytoQuery"; |
| - UMA_HISTOGRAM_PERCENTAGE(histogram_name, percent); |
| - } |
| + if (ui::PageTransitionTypeIncludingQualifiersIs( |
| + transition, ui::PAGE_TRANSITION_TYPED)) { |
|
Peter Kasting
2016/08/13 05:03:44
You should check with mpearson as to whether we wa
Marc Treib
2016/08/16 12:00:18
Added a TODO for now.
|
| + histogram_name = "InstantExtended.PercentageMatchV2_URLtoURL"; |
| + UMA_HISTOGRAM_PERCENTAGE(histogram_name, percent); |
| } else { |
| - if (ui::PageTransitionTypeIncludingQualifiersIs( |
| - transition, ui::PAGE_TRANSITION_TYPED)) { |
| - histogram_name = "InstantExtended.PercentageMatchV2_URLtoURL"; |
| - UMA_HISTOGRAM_PERCENTAGE(histogram_name, percent); |
| - } else { |
| - histogram_name = "InstantExtended.PercentageMatchV2_URLtoQuery"; |
| - UMA_HISTOGRAM_PERCENTAGE(histogram_name, percent); |
| - } |
| + histogram_name = "InstantExtended.PercentageMatchV2_URLtoQuery"; |
| + UMA_HISTOGRAM_PERCENTAGE(histogram_name, percent); |
| } |
| std::string suffix = "large"; |
| @@ -358,9 +346,6 @@ void OmniboxEditModel::GetDataForURLExport(GURL* url, |
| } |
| bool OmniboxEditModel::CurrentTextIsURL() const { |
| - if (controller_->GetToolbarModel()->WouldReplaceURL()) |
| - return false; |
| - |
| // If current text is not composed of replaced search terms and |
|
Peter Kasting
2016/08/13 05:03:44
Nit: Remove everything in this line but the first
Marc Treib
2016/08/16 12:00:17
Done.
|
| // !user_input_in_progress_, then permanent text is showing and should be a |
| // URL, so no further checking is needed. By avoiding checking in this case, |
| @@ -383,9 +368,8 @@ void OmniboxEditModel::AdjustTextForCopy(int sel_min, |
| bool* write_url) { |
| *write_url = false; |
| - // Do not adjust if selection did not start at the beginning of the field, or |
| - // if the URL was omitted. |
| - if ((sel_min != 0) || controller_->GetToolbarModel()->WouldReplaceURL()) |
| + // Do not adjust if selection did not start at the beginning of the field. |
| + if ((sel_min != 0)) |
|
Peter Kasting
2016/08/13 05:03:44
Nit: Extra ()
Marc Treib
2016/08/16 12:00:17
Done.
|
| return; |
| // Check whether the user is trying to copy the current page's URL by |
| @@ -777,9 +761,7 @@ void OmniboxEditModel::OpenMatch(AutocompleteMatch match, |
| } |
| RecordPercentageMatchHistogram( |
| - permanent_text_, current_text, |
| - controller_->GetToolbarModel()->WouldReplaceURL(), |
| - match.transition, view_->GetWidth()); |
| + permanent_text_, current_text, match.transition, view_->GetWidth()); |
| // Track whether the destination URL sends us to a search results page |
| // using the default search provider. |
| @@ -1381,23 +1363,7 @@ void OmniboxEditModel::GetInfoForCurrentText(AutocompleteMatch* match, |
| GURL* alternate_nav_url) const { |
| DCHECK(match); |
| - if (controller_->GetToolbarModel()->WouldPerformSearchTermReplacement( |
| - false)) { |
| - // Any time the user hits enter on the unchanged omnibox, we should reload. |
| - // When we're not extracting search terms, AcceptInput() will take care of |
| - // this (see code referring to PAGE_TRANSITION_RELOAD there), but when we're |
| - // extracting search terms, the conditionals there won't fire, so we |
| - // explicitly set up a match that will reload here. |
| - |
| - // It's important that we fetch the current visible URL to reload instead of |
| - // just getting a "search what you typed" URL from |
| - // SearchProvider::CreateSearchSuggestion(), since the user may be in a |
| - // non-default search mode such as image search. |
| - match->type = AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED; |
| - match->provider = autocomplete_controller()->search_provider(); |
| - match->destination_url = client_->GetURL(); |
| - match->transition = ui::PAGE_TRANSITION_RELOAD; |
| - } else if (query_in_progress() || PopupIsOpen()) { |
| + if (query_in_progress() || PopupIsOpen()) { |
| if (query_in_progress()) { |
| // It's technically possible for |result| to be empty if no provider |
| // returns a synchronous result but the query has not completed |
| @@ -1509,8 +1475,6 @@ OmniboxEventProto::PageClassification OmniboxEditModel::ClassifyPage() const { |
| return OmniboxEventProto::BLANK; |
| if (client_->IsHomePage(url)) |
| return OmniboxEventProto::HOME_PAGE; |
| - if (controller_->GetToolbarModel()->WouldPerformSearchTermReplacement(true)) |
| - return OmniboxEventProto::SEARCH_RESULT_PAGE_DOING_SEARCH_TERM_REPLACEMENT; |
|
Peter Kasting
2016/08/13 05:03:44
This value should be changed to OBSOLETE in the pr
Marc Treib
2016/08/16 12:00:17
Done.
|
| if (client_->IsSearchResultsPage()) |
| return OmniboxEventProto::SEARCH_RESULT_PAGE_NO_SEARCH_TERM_REPLACEMENT; |
| return OmniboxEventProto::OTHER; |