summaryrefslogtreecommitdiffstats
path: root/components/omnibox
diff options
context:
space:
mode:
authorrsleevi <rsleevi@chromium.org>2015-08-03 13:47:03 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-03 20:47:42 +0000
commit1659865c3eb47166c82378bb840801135b057a09 (patch)
tree7cd31e008e6097a080a0c6d2f879fc880c3a475b /components/omnibox
parent16f99512ca431c0d2f21cf94f3a7997bbd64d8c0 (diff)
downloadchromium_src-1659865c3eb47166c82378bb840801135b057a09.zip
chromium_src-1659865c3eb47166c82378bb840801135b057a09.tar.gz
chromium_src-1659865c3eb47166c82378bb840801135b057a09.tar.bz2
Move net::FormatUrl and friends outside of //net and into //components
net::FormatUrl and related are specifically concerned with display policies of URLs, which is not something that //net needs to be aware of, as that's a UX question. This folds in net::FormatURL along with the existing //components/url_fixer and //components/secure_display into a common component, //components/url_formatter, that handles reformatting URLs for user-friendly or data storage (url_formatter), for use in security prompts (elide_url), or for reformatting URLs from user input (url_fixer) (Disabling presubmit since this is intentionally not fixing a legacy API, just moving it for future cleanups) BUG=486979 NOPRESUBMIT=true Review URL: https://codereview.chromium.org/1171333003 Cr-Commit-Position: refs/heads/master@{#341605}
Diffstat (limited to 'components/omnibox')
-rw-r--r--components/omnibox/browser/BUILD.gn2
-rw-r--r--components/omnibox/browser/DEPS2
-rw-r--r--components/omnibox/browser/autocomplete_input.cc11
-rw-r--r--components/omnibox/browser/autocomplete_match.cc8
-rw-r--r--components/omnibox/browser/autocomplete_provider.cc4
-rw-r--r--components/omnibox/browser/autocomplete_result.cc4
-rw-r--r--components/omnibox/browser/bookmark_provider.cc9
-rw-r--r--components/omnibox/browser/builtin_provider.cc4
-rw-r--r--components/omnibox/browser/history_quick_provider.cc19
-rw-r--r--components/omnibox/browser/history_url_provider.cc34
-rw-r--r--components/omnibox/browser/search_provider.cc13
-rw-r--r--components/omnibox/browser/search_suggestion_parser.cc35
-rw-r--r--components/omnibox/browser/shortcuts_provider.cc2
-rw-r--r--components/omnibox/browser/url_index_private_data.cc9
-rw-r--r--components/omnibox/browser/zero_suggest_provider.cc7
15 files changed, 91 insertions, 72 deletions
diff --git a/components/omnibox/browser/BUILD.gn b/components/omnibox/browser/BUILD.gn
index cc2fc78..8217c11 100644
--- a/components/omnibox/browser/BUILD.gn
+++ b/components/omnibox/browser/BUILD.gn
@@ -98,7 +98,7 @@ source_set("browser") {
"//components/search_engines",
"//components/sessions",
"//components/strings",
- "//components/url_fixer",
+ "//components/url_formatter",
"//components/variations",
"//components/variations/net",
"//net",
diff --git a/components/omnibox/browser/DEPS b/components/omnibox/browser/DEPS
index e915c67..646d9c3 100644
--- a/components/omnibox/browser/DEPS
+++ b/components/omnibox/browser/DEPS
@@ -8,7 +8,7 @@ include_rules = [
"+components/search",
"+components/search_engines",
"+components/sessions",
- "+components/url_fixer",
+ "+components/url_formatter",
"+components/variations",
"+grit",
"+net",
diff --git a/components/omnibox/browser/autocomplete_input.cc b/components/omnibox/browser/autocomplete_input.cc
index c8b744a..d5e10f5b 100644
--- a/components/omnibox/browser/autocomplete_input.cc
+++ b/components/omnibox/browser/autocomplete_input.cc
@@ -10,7 +10,8 @@
#include "components/metrics/proto/omnibox_event.pb.h"
#include "components/omnibox/browser/autocomplete_scheme_classifier.h"
#include "components/omnibox/browser/omnibox_field_trial.h"
-#include "components/url_fixer/url_fixer.h"
+#include "components/url_formatter/url_fixer.h"
+#include "components/url_formatter/url_formatter.h"
#include "net/base/net_util.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "url/url_canon_ip.h"
@@ -188,7 +189,7 @@ metrics::OmniboxInputType::Type AutocompleteInput::Parse(
url::Parsed local_parts;
if (!parts)
parts = &local_parts;
- const base::string16 parsed_scheme(url_fixer::SegmentURL(text, parts));
+ const base::string16 parsed_scheme(url_formatter::SegmentURL(text, parts));
if (scheme)
*scheme = parsed_scheme;
const std::string parsed_scheme_utf8(base::UTF16ToUTF8(parsed_scheme));
@@ -200,7 +201,7 @@ metrics::OmniboxInputType::Type AutocompleteInput::Parse(
if (!canonicalized_url)
canonicalized_url = &placeholder_canonicalized_url;
*canonicalized_url =
- url_fixer::FixupURL(base::UTF16ToUTF8(text), desired_tld);
+ url_formatter::FixupURL(base::UTF16ToUTF8(text), desired_tld);
if (!canonicalized_url->is_valid())
return metrics::OmniboxInputType::QUERY;
@@ -255,7 +256,7 @@ metrics::OmniboxInputType::Type AutocompleteInput::Parse(
&http_parts.ref,
};
for (size_t i = 0; i < arraysize(components); ++i) {
- url_fixer::OffsetComponent(
+ url_formatter::OffsetComponent(
-static_cast<int>(http_scheme_prefix.length()), components[i]);
}
@@ -504,7 +505,7 @@ base::string16 AutocompleteInput::FormattedStringWithEquivalentMeaning(
const GURL& url,
const base::string16& formatted_url,
const AutocompleteSchemeClassifier& scheme_classifier) {
- if (!net::CanStripTrailingSlash(url))
+ if (!url_formatter::CanStripTrailingSlash(url))
return formatted_url;
const base::string16 url_with_path(formatted_url + base::char16('/'));
return (AutocompleteInput::Parse(formatted_url, std::string(),
diff --git a/components/omnibox/browser/autocomplete_match.cc b/components/omnibox/browser/autocomplete_match.cc
index 77bcf25..03dc219 100644
--- a/components/omnibox/browser/autocomplete_match.cc
+++ b/components/omnibox/browser/autocomplete_match.cc
@@ -17,8 +17,8 @@
#include "components/omnibox/browser/suggestion_answer.h"
#include "components/search_engines/template_url.h"
#include "components/search_engines/template_url_service.h"
+#include "components/url_formatter/url_formatter.h"
#include "grit/components_scaled_resources.h"
-#include "net/base/net_util.h"
namespace {
@@ -42,9 +42,9 @@ bool WordMatchesURLContent(
size_t prefix_length =
url.scheme().length() + strlen(url::kStandardSchemeSeparator);
DCHECK_GE(url.spec().length(), prefix_length);
- const base::string16& formatted_url = net::FormatUrl(
- url, languages, net::kFormatUrlOmitNothing, net::UnescapeRule::NORMAL,
- NULL, NULL, &prefix_length);
+ const base::string16& formatted_url = url_formatter::FormatUrl(
+ url, languages, url_formatter::kFormatUrlOmitNothing,
+ net::UnescapeRule::NORMAL, nullptr, nullptr, &prefix_length);
if (prefix_length == base::string16::npos)
return false;
const base::string16& formatted_url_without_scheme =
diff --git a/components/omnibox/browser/autocomplete_provider.cc b/components/omnibox/browser/autocomplete_provider.cc
index 7c43ab4..5072af2 100644
--- a/components/omnibox/browser/autocomplete_provider.cc
+++ b/components/omnibox/browser/autocomplete_provider.cc
@@ -8,7 +8,7 @@
#include "base/strings/utf_string_conversions.h"
#include "components/omnibox/browser/autocomplete_input.h"
#include "components/omnibox/browser/autocomplete_match.h"
-#include "components/url_fixer/url_fixer.h"
+#include "components/url_formatter/url_fixer.h"
#include "net/base/net_util.h"
#include "url/gurl.h"
@@ -102,7 +102,7 @@ AutocompleteProvider::FixupReturn AutocompleteProvider::FixupUserInput(
// Fixup and canonicalize user input.
const GURL canonical_gurl(
- url_fixer::FixupURL(base::UTF16ToUTF8(input_text), std::string()));
+ url_formatter::FixupURL(base::UTF16ToUTF8(input_text), std::string()));
std::string canonical_gurl_str(canonical_gurl.possibly_invalid_spec());
if (canonical_gurl_str.empty()) {
// This probably won't happen, but there are no guarantees.
diff --git a/components/omnibox/browser/autocomplete_result.cc b/components/omnibox/browser/autocomplete_result.cc
index da7f1ca..f1e03a7 100644
--- a/components/omnibox/browser/autocomplete_result.cc
+++ b/components/omnibox/browser/autocomplete_result.cc
@@ -18,7 +18,7 @@
#include "components/omnibox/browser/omnibox_field_trial.h"
#include "components/omnibox/browser/omnibox_switches.h"
#include "components/search/search.h"
-#include "components/url_fixer/url_fixer.h"
+#include "components/url_formatter/url_fixer.h"
using metrics::OmniboxEventProto;
@@ -250,7 +250,7 @@ void AutocompleteResult::SortAndCull(
const std::string& in_scheme = base::UTF16ToUTF8(input.scheme());
const std::string& dest_scheme =
default_match_->destination_url.scheme();
- DCHECK(url_fixer::IsEquivalentScheme(in_scheme, dest_scheme))
+ DCHECK(url_formatter::IsEquivalentScheme(in_scheme, dest_scheme))
<< debug_info;
}
}
diff --git a/components/omnibox/browser/bookmark_provider.cc b/components/omnibox/browser/bookmark_provider.cc
index ffce9b8..fc55713 100644
--- a/components/omnibox/browser/bookmark_provider.cc
+++ b/components/omnibox/browser/bookmark_provider.cc
@@ -18,7 +18,7 @@
#include "components/omnibox/browser/autocomplete_result.h"
#include "components/omnibox/browser/history_provider.h"
#include "components/omnibox/browser/url_prefix.h"
-#include "net/base/net_util.h"
+#include "components/url_formatter/url_formatter.h"
#include "url/url_constants.h"
using bookmarks::BookmarkMatch;
@@ -188,9 +188,10 @@ AutocompleteMatch BookmarkProvider::BookmarkMatchToACMatch(
// |offsets|, compute how everything is transformed, then remove it from the
// end.
offsets.push_back(inline_autocomplete_offset);
- match.contents = net::FormatUrlWithOffsets(url, languages_,
- net::kFormatUrlOmitAll & ~(trim_http ? 0 : net::kFormatUrlOmitHTTP),
- net::UnescapeRule::SPACES, NULL, NULL, &offsets);
+ match.contents = url_formatter::FormatUrlWithOffsets(
+ url, languages_, url_formatter::kFormatUrlOmitAll &
+ ~(trim_http ? 0 : url_formatter::kFormatUrlOmitHTTP),
+ net::UnescapeRule::SPACES, nullptr, nullptr, &offsets);
inline_autocomplete_offset = offsets.back();
offsets.pop_back();
BookmarkMatch::MatchPositions new_url_match_positions =
diff --git a/components/omnibox/browser/builtin_provider.cc b/components/omnibox/browser/builtin_provider.cc
index 43e728b..6e3dde6 100644
--- a/components/omnibox/browser/builtin_provider.cc
+++ b/components/omnibox/browser/builtin_provider.cc
@@ -12,7 +12,7 @@
#include "components/omnibox/browser/autocomplete_input.h"
#include "components/omnibox/browser/autocomplete_provider_client.h"
#include "components/omnibox/browser/history_provider.h"
-#include "components/url_fixer/url_fixer.h"
+#include "components/url_formatter/url_fixer.h"
const int BuiltinProvider::kRelevance = 860;
@@ -61,7 +61,7 @@ void BuiltinProvider::Start(const AutocompleteInput& input,
AddMatch(url, base::string16(), styles);
} else {
// Match input about: or |embedderAbout| URL input against builtin URLs.
- GURL url = url_fixer::FixupURL(base::UTF16ToUTF8(text), std::string());
+ GURL url = url_formatter::FixupURL(base::UTF16ToUTF8(text), std::string());
// BuiltinProvider doesn't know how to suggest valid ?query or #fragment
// extensions to builtin URLs.
if (url.SchemeIs(
diff --git a/components/omnibox/browser/history_quick_provider.cc b/components/omnibox/browser/history_quick_provider.cc
index d2f15cf..32ac0e7 100644
--- a/components/omnibox/browser/history_quick_provider.cc
+++ b/components/omnibox/browser/history_quick_provider.cc
@@ -28,8 +28,8 @@
#include "components/omnibox/browser/omnibox_field_trial.h"
#include "components/search_engines/template_url.h"
#include "components/search_engines/template_url_service.h"
+#include "components/url_formatter/url_formatter.h"
#include "net/base/escape.h"
-#include "net/base/net_util.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "url/third_party/mozilla/url_parse.h"
#include "url/url_util.h"
@@ -221,20 +221,21 @@ AutocompleteMatch HistoryQuickProvider::QuickMatchToACMatch(
DCHECK(match.destination_url.is_valid());
// Format the URL autocomplete presentation.
- const net::FormatUrlTypes format_types = net::kFormatUrlOmitAll &
- ~(!history_match.match_in_scheme ? 0 : net::kFormatUrlOmitHTTP);
+ const url_formatter::FormatUrlTypes format_types =
+ url_formatter::kFormatUrlOmitAll &
+ ~(!history_match.match_in_scheme ? 0 : url_formatter::kFormatUrlOmitHTTP);
match.fill_into_edit =
AutocompleteInput::FormattedStringWithEquivalentMeaning(
- info.url(),
- net::FormatUrl(info.url(), languages_, format_types,
- net::UnescapeRule::SPACES, NULL, NULL, NULL),
+ info.url(), url_formatter::FormatUrl(
+ info.url(), languages_, format_types,
+ net::UnescapeRule::SPACES, nullptr, nullptr, nullptr),
client()->GetSchemeClassifier());
std::vector<size_t> offsets =
OffsetsFromTermMatches(history_match.url_matches);
base::OffsetAdjuster::Adjustments adjustments;
- match.contents = net::FormatUrlWithAdjustments(
- info.url(), languages_, format_types, net::UnescapeRule::SPACES, NULL,
- NULL, &adjustments);
+ match.contents = url_formatter::FormatUrlWithAdjustments(
+ info.url(), languages_, format_types, net::UnescapeRule::SPACES, nullptr,
+ nullptr, &adjustments);
base::OffsetAdjuster::AdjustOffsets(adjustments, &offsets);
TermMatches new_matches =
ReplaceOffsetsInTermMatches(history_match.url_matches, offsets);
diff --git a/components/omnibox/browser/history_url_provider.cc b/components/omnibox/browser/history_url_provider.cc
index 2140fbd..3ad59b5 100644
--- a/components/omnibox/browser/history_url_provider.cc
+++ b/components/omnibox/browser/history_url_provider.cc
@@ -32,8 +32,8 @@
#include "components/omnibox/browser/url_prefix.h"
#include "components/search_engines/search_terms_data.h"
#include "components/search_engines/template_url_service.h"
-#include "components/url_fixer/url_fixer.h"
-#include "net/base/net_util.h"
+#include "components/url_formatter/url_fixer.h"
+#include "components/url_formatter/url_formatter.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "url/gurl.h"
#include "url/third_party/mozilla/url_parse.h"
@@ -494,7 +494,7 @@ void HistoryURLProvider::Start(const AutocompleteInput& input,
if (!fixup_return.first)
return;
url::Parsed parts;
- url_fixer::SegmentURL(fixup_return.second, &parts);
+ url_formatter::SegmentURL(fixup_return.second, &parts);
AutocompleteInput fixed_up_input(input);
fixed_up_input.UpdateText(fixup_return.second, base::string16::npos, parts);
@@ -590,10 +590,10 @@ AutocompleteMatch HistoryURLProvider::SuggestExactInput(
// Trim off "http://" if the user didn't type it.
DCHECK(!trim_http ||
!AutocompleteInput::HasHTTPScheme(input.text()));
- base::string16 display_string(
- net::FormatUrl(destination_url, std::string(),
- net::kFormatUrlOmitAll & ~net::kFormatUrlOmitHTTP,
- net::UnescapeRule::SPACES, NULL, NULL, NULL));
+ base::string16 display_string(url_formatter::FormatUrl(
+ destination_url, std::string(),
+ url_formatter::kFormatUrlOmitAll & ~url_formatter::kFormatUrlOmitHTTP,
+ net::UnescapeRule::SPACES, nullptr, nullptr, nullptr));
const size_t offset = trim_http ? TrimHttpPrefix(&display_string) : 0;
match.fill_into_edit =
AutocompleteInput::FormattedStringWithEquivalentMeaning(
@@ -1160,14 +1160,17 @@ AutocompleteMatch HistoryURLProvider::HistoryMatchToACMatch(
history_match.input_location + params.input.text().length();
std::string languages = (match_type == WHAT_YOU_TYPED) ?
std::string() : params.languages;
- const net::FormatUrlTypes format_types = net::kFormatUrlOmitAll &
- ~((params.trim_http && !history_match.match_in_scheme) ?
- 0 : net::kFormatUrlOmitHTTP);
+ const url_formatter::FormatUrlTypes format_types =
+ url_formatter::kFormatUrlOmitAll &
+ ~((params.trim_http && !history_match.match_in_scheme)
+ ? 0
+ : url_formatter::kFormatUrlOmitHTTP);
match.fill_into_edit =
AutocompleteInput::FormattedStringWithEquivalentMeaning(
- info.url(), net::FormatUrl(info.url(), languages, format_types,
- net::UnescapeRule::SPACES, NULL, NULL,
- &inline_autocomplete_offset),
+ info.url(),
+ url_formatter::FormatUrl(info.url(), languages, format_types,
+ net::UnescapeRule::SPACES, nullptr, nullptr,
+ &inline_autocomplete_offset),
client()->GetSchemeClassifier());
if (!params.prevent_inline_autocomplete &&
(inline_autocomplete_offset != base::string16::npos)) {
@@ -1182,8 +1185,9 @@ AutocompleteMatch HistoryURLProvider::HistoryMatchToACMatch(
(inline_autocomplete_offset >= match.fill_into_edit.length()));
size_t match_start = history_match.input_location;
- match.contents = net::FormatUrl(info.url(), languages,
- format_types, net::UnescapeRule::SPACES, NULL, NULL, &match_start);
+ match.contents = url_formatter::FormatUrl(info.url(), languages, format_types,
+ net::UnescapeRule::SPACES, nullptr,
+ nullptr, &match_start);
if ((match_start != base::string16::npos) &&
(inline_autocomplete_offset != base::string16::npos) &&
(inline_autocomplete_offset != match_start)) {
diff --git a/components/omnibox/browser/search_provider.cc b/components/omnibox/browser/search_provider.cc
index 9067f859..7f4aab1 100644
--- a/components/omnibox/browser/search_provider.cc
+++ b/components/omnibox/browser/search_provider.cc
@@ -31,11 +31,11 @@
#include "components/search/search.h"
#include "components/search_engines/template_url_prepopulate_data.h"
#include "components/search_engines/template_url_service.h"
+#include "components/url_formatter/url_formatter.h"
#include "components/variations/net/variations_http_header_provider.h"
#include "grit/components_strings.h"
#include "net/base/escape.h"
#include "net/base/load_flags.h"
-#include "net/base/net_util.h"
#include "net/http/http_request_headers.h"
#include "net/url_request/url_fetcher.h"
#include "net/url_request/url_request_status.h"
@@ -1379,8 +1379,9 @@ AutocompleteMatch SearchProvider::NavigationToMatch(
navigation.formatted_url().find(input) : prefix->prefix.length();
bool trim_http = !AutocompleteInput::HasHTTPScheme(input) &&
(!prefix || (match_start != 0));
- const net::FormatUrlTypes format_types =
- net::kFormatUrlOmitAll & ~(trim_http ? 0 : net::kFormatUrlOmitHTTP);
+ const url_formatter::FormatUrlTypes format_types =
+ url_formatter::kFormatUrlOmitAll &
+ ~(trim_http ? 0 : url_formatter::kFormatUrlOmitHTTP);
const std::string languages(client()->GetAcceptLanguages());
size_t inline_autocomplete_offset = (prefix == NULL) ?
@@ -1388,9 +1389,9 @@ AutocompleteMatch SearchProvider::NavigationToMatch(
match.fill_into_edit +=
AutocompleteInput::FormattedStringWithEquivalentMeaning(
navigation.url(),
- net::FormatUrl(navigation.url(), languages, format_types,
- net::UnescapeRule::SPACES, NULL, NULL,
- &inline_autocomplete_offset),
+ url_formatter::FormatUrl(navigation.url(), languages, format_types,
+ net::UnescapeRule::SPACES, nullptr, nullptr,
+ &inline_autocomplete_offset),
client()->GetSchemeClassifier());
// Preserve the forced query '?' prefix in |match.fill_into_edit|.
// Otherwise, user edits to a suggestion would show non-Search results.
diff --git a/components/omnibox/browser/search_suggestion_parser.cc b/components/omnibox/browser/search_suggestion_parser.cc
index 30543fc..24ab637 100644
--- a/components/omnibox/browser/search_suggestion_parser.cc
+++ b/components/omnibox/browser/search_suggestion_parser.cc
@@ -18,8 +18,8 @@
#include "components/omnibox/browser/autocomplete_i18n.h"
#include "components/omnibox/browser/autocomplete_input.h"
#include "components/omnibox/browser/url_prefix.h"
-#include "components/url_fixer/url_fixer.h"
-#include "net/base/net_util.h"
+#include "components/url_formatter/url_fixer.h"
+#include "components/url_formatter/url_formatter.h"
#include "net/http/http_response_headers.h"
#include "net/url_request/url_fetcher.h"
#include "url/url_constants.h"
@@ -226,13 +226,22 @@ SearchSuggestionParser::NavigationResult::NavigationResult(
bool relevance_from_server,
const base::string16& input_text,
const std::string& languages)
- : Result(from_keyword_provider, relevance, relevance_from_server, type,
+ : Result(from_keyword_provider,
+ relevance,
+ relevance_from_server,
+ type,
deletion_url),
url_(url),
formatted_url_(AutocompleteInput::FormattedStringWithEquivalentMeaning(
- url, net::FormatUrl(url, languages,
- net::kFormatUrlOmitAll & ~net::kFormatUrlOmitHTTP,
- net::UnescapeRule::SPACES, NULL, NULL, NULL),
+ url,
+ url_formatter::FormatUrl(url,
+ languages,
+ url_formatter::kFormatUrlOmitAll &
+ ~url_formatter::kFormatUrlOmitHTTP,
+ net::UnescapeRule::SPACES,
+ nullptr,
+ nullptr,
+ nullptr),
scheme_classifier)),
description_(description) {
DCHECK(url_.is_valid());
@@ -262,11 +271,13 @@ SearchSuggestionParser::NavigationResult::CalculateAndClassifyMatchContents(
formatted_url_.find(input_text) : prefix->prefix.length();
bool trim_http = !AutocompleteInput::HasHTTPScheme(input_text) &&
(!prefix || (match_start != 0));
- const net::FormatUrlTypes format_types =
- net::kFormatUrlOmitAll & ~(trim_http ? 0 : net::kFormatUrlOmitHTTP);
+ const url_formatter::FormatUrlTypes format_types =
+ url_formatter::kFormatUrlOmitAll &
+ ~(trim_http ? 0 : url_formatter::kFormatUrlOmitHTTP);
- base::string16 match_contents = net::FormatUrl(url_, languages, format_types,
- net::UnescapeRule::SPACES, NULL, NULL, &match_start);
+ base::string16 match_contents = url_formatter::FormatUrl(
+ url_, languages, format_types, net::UnescapeRule::SPACES, nullptr,
+ nullptr, &match_start);
// If the first match in the untrimmed string was inside a scheme that we
// trimmed, look for a subsequent match.
if (match_start == base::string16::npos)
@@ -470,8 +481,8 @@ bool SearchSuggestionParser::ParseSuggestResults(
if ((match_type == AutocompleteMatchType::NAVSUGGEST) ||
(match_type == AutocompleteMatchType::NAVSUGGEST_PERSONALIZED)) {
// Do not blindly trust the URL coming from the server to be valid.
- GURL url(
- url_fixer::FixupURL(base::UTF16ToUTF8(suggestion), std::string()));
+ GURL url(url_formatter::FixupURL(base::UTF16ToUTF8(suggestion),
+ std::string()));
if (url.is_valid() && allow_navsuggest) {
base::string16 title;
if (descriptions != NULL)
diff --git a/components/omnibox/browser/shortcuts_provider.cc b/components/omnibox/browser/shortcuts_provider.cc
index 8d43be6..2b5eead 100644
--- a/components/omnibox/browser/shortcuts_provider.cc
+++ b/components/omnibox/browser/shortcuts_provider.cc
@@ -28,7 +28,7 @@
#include "components/omnibox/browser/history_provider.h"
#include "components/omnibox/browser/omnibox_field_trial.h"
#include "components/omnibox/browser/url_prefix.h"
-#include "components/url_fixer/url_fixer.h"
+#include "components/url_formatter/url_fixer.h"
#include "url/third_party/mozilla/url_parse.h"
namespace {
diff --git a/components/omnibox/browser/url_index_private_data.cc b/components/omnibox/browser/url_index_private_data.cc
index a965c86..a468d2b 100644
--- a/components/omnibox/browser/url_index_private_data.cc
+++ b/components/omnibox/browser/url_index_private_data.cc
@@ -26,7 +26,7 @@
#include "components/history/core/browser/history_db_task.h"
#include "components/history/core/browser/history_service.h"
#include "components/omnibox/browser/in_memory_url_index.h"
-#include "net/base/net_util.h"
+#include "components/url_formatter/url_formatter.h"
#if defined(USE_SYSTEM_PROTOBUF)
#include <google/protobuf/repeated_field.h>
@@ -707,10 +707,9 @@ bool URLIndexPrivateData::IndexRow(
history::URLID row_id = row.id();
// Strip out username and password before saving and indexing.
- base::string16 url(net::FormatUrl(gurl, languages,
- net::kFormatUrlOmitUsernamePassword,
- net::UnescapeRule::NONE,
- NULL, NULL, NULL));
+ base::string16 url(url_formatter::FormatUrl(
+ gurl, languages, url_formatter::kFormatUrlOmitUsernamePassword,
+ net::UnescapeRule::NONE, nullptr, nullptr, nullptr));
HistoryID history_id = static_cast<HistoryID>(row_id);
DCHECK_LT(history_id, std::numeric_limits<HistoryID>::max());
diff --git a/components/omnibox/browser/zero_suggest_provider.cc b/components/omnibox/browser/zero_suggest_provider.cc
index ad75cc0..17a1bc9 100644
--- a/components/omnibox/browser/zero_suggest_provider.cc
+++ b/components/omnibox/browser/zero_suggest_provider.cc
@@ -27,10 +27,10 @@
#include "components/omnibox/browser/search_provider.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/search_engines/template_url_service.h"
+#include "components/url_formatter/url_formatter.h"
#include "components/variations/net/variations_http_header_provider.h"
#include "net/base/escape.h"
#include "net/base/load_flags.h"
-#include "net/base/net_util.h"
#include "net/http/http_request_headers.h"
#include "net/url_request/url_fetcher.h"
#include "net/url_request/url_request_status.h"
@@ -288,8 +288,9 @@ AutocompleteMatch ZeroSuggestProvider::NavigationToMatch(
// Zero suggest results should always omit protocols and never appear bold.
const std::string languages(client()->GetAcceptLanguages());
- match.contents = net::FormatUrl(navigation.url(), languages,
- net::kFormatUrlOmitAll, net::UnescapeRule::SPACES, NULL, NULL, NULL);
+ match.contents = url_formatter::FormatUrl(
+ navigation.url(), languages, url_formatter::kFormatUrlOmitAll,
+ net::UnescapeRule::SPACES, nullptr, nullptr, nullptr);
match.fill_into_edit +=
AutocompleteInput::FormattedStringWithEquivalentMeaning(
navigation.url(), match.contents, client()->GetSchemeClassifier());