Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Unified Diff: components/omnibox/browser/history_url_provider.cc

Issue 2940973002: Omnibox UI Experiments: Implement scheme-trimming for suggested URLs. (Closed)
Patch Set: fix Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/omnibox/browser/history_url_provider.cc
diff --git a/components/omnibox/browser/history_url_provider.cc b/components/omnibox/browser/history_url_provider.cc
index ed391c9a21932d0cf29c89abd33773372ac1cdc8..d9f6b7e887db0827d39ba5cba82a1fbc7e936936 100644
--- a/components/omnibox/browser/history_url_provider.cc
+++ b/components/omnibox/browser/history_url_provider.cc
@@ -571,10 +571,9 @@ AutocompleteMatch HistoryURLProvider::SuggestExactInput(
// Trim off "http://" if the user didn't type it.
DCHECK(!trim_http ||
!AutocompleteInput::HasHTTPScheme(input.text()));
- base::string16 display_string(url_formatter::FormatUrl(
- destination_url,
- url_formatter::kFormatUrlOmitAll & ~url_formatter::kFormatUrlOmitHTTP,
- net::UnescapeRule::SPACES, nullptr, nullptr, nullptr));
+ base::string16 display_string(
+ AutocompleteMatch::FormatUrlForSuggestionDisplay(
+ destination_url, false /* trim_scheme */, nullptr));
const size_t offset = trim_http ? TrimHttpPrefix(&display_string) : 0;
match.fill_into_edit =
AutocompleteInput::FormattedStringWithEquivalentMeaning(
@@ -1174,9 +1173,9 @@ AutocompleteMatch HistoryURLProvider::HistoryMatchToACMatch(
(inline_autocomplete_offset >= match.fill_into_edit.length()));
size_t match_start = history_match.input_location;
- match.contents = url_formatter::FormatUrl(info.url(), format_types,
- net::UnescapeRule::SPACES, nullptr,
- nullptr, &match_start);
+ match.contents = AutocompleteMatch::FormatUrlForSuggestionDisplay(
+ info.url(), params.trim_http && !history_match.match_in_scheme,
+ &match_start);
if ((match_start != base::string16::npos) && autocomplete_offset_valid &&
(inline_autocomplete_offset != match_start)) {
DCHECK(inline_autocomplete_offset > match_start);
« no previous file with comments | « components/omnibox/browser/history_quick_provider.cc ('k') | components/omnibox/browser/titled_url_match_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698