From 90437dd218ba09f01612ebfc47eda167d67fb368 Mon Sep 17 00:00:00 2001 From: jochen Date: Tue, 4 Aug 2015 00:05:17 -0700 Subject: Revert of Move net::FormatUrl and friends outside of //net and into //components (patchset #16 id:290001 of https://codereview.chromium.org/1171333003/ ) Reason for revert: breaks gn_check on Android: https://build.chromium.org/p/chromium.linux/builders/Android%20GN/builds/28796/steps/gn_check/logs/stdio Original issue's description: > 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 > > Committed: https://crrev.com/1659865c3eb47166c82378bb840801135b057a09 > Cr-Commit-Position: refs/heads/master@{#341605} TBR=droger@chromium.org,jam@chromium.org,mkwst@chromium.org,pkasting@chromium.org,sky@chromium.org,stuartmorgan@chromium.org,felt@chromium.org,rsleevi@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=486979 Review URL: https://codereview.chromium.org/1260033005 Cr-Commit-Position: refs/heads/master@{#341691} --- chrome/browser/BUILD.gn | 2 +- chrome/browser/DEPS | 1 - .../fullscreen/fullscreen_infobar_delegate.cc | 5 ++-- .../omnibox/autocomplete_controller_android.cc | 7 ++--- chrome/browser/android/tab_android.cc | 4 +-- chrome/browser/android/url_utilities.cc | 4 +-- .../autocomplete/history_url_provider_unittest.cc | 9 +++--- chrome/browser/browser_about_handler.cc | 8 ++--- chrome/browser/browser_about_handler.h | 2 +- chrome/browser/chrome_content_browser_client.cc | 2 +- chrome/browser/chrome_quota_permission_context.cc | 34 +++++++++++----------- chrome/browser/custom_home_pages_table_model.cc | 4 +-- chrome/browser/dom_distiller/tab_utils_android.cc | 13 +++++---- chrome/browser/download/download_query.cc | 4 +-- .../extensions/api/sessions/sessions_api.cc | 6 ++-- .../extensions/api/settings_private/prefs_util.cc | 4 +-- chrome/browser/extensions/extension_tab_util.cc | 4 +-- .../geolocation/geolocation_infobar_delegate.cc | 14 ++++----- .../interstitials/security_interstitial_page.cc | 5 ++-- .../media/media_stream_capture_indicator.cc | 5 ++-- .../media/midi_permission_infobar_delegate.cc | 11 ++++--- .../protected_media_identifier_infobar_delegate.cc | 5 ++-- .../notification_permission_infobar_delegate.cc | 12 ++++---- .../platform_notification_service_impl.cc | 7 ++--- chrome/browser/pepper_broker_infobar_delegate.cc | 9 +++--- .../permissions/permission_bubble_request_impl.cc | 12 ++++---- .../policy/managed_bookmarks_policy_handler.cc | 4 +-- .../policy/url_blacklist_manager_unittest.cc | 6 ++-- chrome/browser/prefs/session_startup_pref.cc | 4 +-- chrome/browser/profiles/profile_impl.cc | 8 ++--- chrome/browser/profiles/profile_io_data.cc | 4 +-- chrome/browser/ssl/captive_portal_blocking_page.cc | 4 +-- .../supervised_user_bookmarks_handler.cc | 4 +-- .../supervised_user/supervised_user_url_filter.cc | 4 +-- chrome/browser/ui/BUILD.gn | 2 +- chrome/browser/ui/DEPS | 2 +- chrome/browser/ui/bookmarks/bookmark_utils.cc | 10 +++---- chrome/browser/ui/bookmarks/bookmark_utils.h | 2 +- .../cocoa/bookmarks/bookmark_editor_controller.mm | 4 +-- chrome/browser/ui/cocoa/status_bubble_mac.mm | 10 +++---- .../browser/ui/cocoa/tabs/tab_strip_controller.mm | 4 +-- .../browser/ui/cocoa/toolbar/toolbar_controller.mm | 6 ++-- .../content_setting_bubble_model.cc | 6 ++-- .../content_setting_bubble_model_unittest.cc | 18 ++++++------ chrome/browser/ui/omnibox/omnibox_edit_model.cc | 5 ++-- .../ui/passwords/manage_passwords_view_utils.cc | 4 +-- .../edit_search_engine_controller.cc | 4 +-- .../browser/ui/startup/startup_browser_creator.cc | 4 +-- chrome/browser/ui/toolbar/toolbar_model_impl.cc | 7 ++--- .../ui/views/bookmarks/bookmark_bar_view.cc | 4 +-- .../ui/views/bookmarks/bookmark_editor_view.cc | 5 ++-- chrome/browser/ui/views/status_bubble_views.cc | 11 ++++--- .../website_settings/permissions_bubble_view.cc | 13 +++++---- chrome/browser/ui/webui/history_ui.cc | 5 ++-- .../ui/webui/net_internals/net_internals_ui.cc | 2 +- .../ui/webui/options/core_options_handler.cc | 4 +-- .../ui/webui/options/startup_pages_handler.cc | 6 ++-- 57 files changed, 176 insertions(+), 193 deletions(-) (limited to 'chrome/browser') diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index e8a6f1f..9613ddd 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn @@ -148,7 +148,7 @@ source_set("browser") { "//components/ui/zoom:ui_zoom", "//components/undo", "//components/update_client", - "//components/url_formatter", + "//components/url_fixer", "//components/user_prefs", "//components/variations", "//components/variations/net", diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS index a9ec08f..4d9071f 100644 --- a/chrome/browser/DEPS +++ b/chrome/browser/DEPS @@ -94,7 +94,6 @@ include_rules = [ "+components/ui", "+components/undo", "+components/update_client", - "+components/url_formatter", "+components/url_matcher", "+components/user_manager", "+components/user_prefs", diff --git a/chrome/browser/android/fullscreen/fullscreen_infobar_delegate.cc b/chrome/browser/android/fullscreen/fullscreen_infobar_delegate.cc index 04d0ab3..73178ff 100644 --- a/chrome/browser/android/fullscreen/fullscreen_infobar_delegate.cc +++ b/chrome/browser/android/fullscreen/fullscreen_infobar_delegate.cc @@ -13,10 +13,10 @@ #include "chrome/common/pref_names.h" #include "chrome/grit/generated_resources.h" #include "components/infobars/core/infobar.h" -#include "components/url_formatter/url_formatter.h" #include "grit/components_strings.h" #include "grit/theme_resources.h" #include "jni/FullscreenInfoBarDelegate_jni.h" +#include "net/base/net_util.h" #include "ui/base/l10n/l10n_util.h" #include "url/gurl.h" @@ -69,8 +69,7 @@ base::string16 FullscreenInfoBarDelegate::GetMessageText() const { std::string language = profile->GetPrefs()->GetString(prefs::kAcceptLanguages); return l10n_util::GetStringFUTF16( - IDS_FULLSCREEN_INFOBAR_TEXT, - url_formatter::FormatUrl(GURL(origin_), language)); + IDS_FULLSCREEN_INFOBAR_TEXT, net::FormatUrl(GURL(origin_), language)); } base::string16 FullscreenInfoBarDelegate::GetButtonLabel( diff --git a/chrome/browser/android/omnibox/autocomplete_controller_android.cc b/chrome/browser/android/omnibox/autocomplete_controller_android.cc index 2e84fc9..098eaca 100644 --- a/chrome/browser/android/omnibox/autocomplete_controller_android.cc +++ b/chrome/browser/android/omnibox/autocomplete_controller_android.cc @@ -42,7 +42,6 @@ #include "components/search/search.h" #include "components/search_engines/template_url_service.h" #include "components/toolbar/toolbar_model.h" -#include "components/url_formatter/url_formatter.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" @@ -50,6 +49,7 @@ #include "content/public/common/url_constants.h" #include "jni/AutocompleteController_jni.h" #include "net/base/escape.h" +#include "net/base/net_util.h" #include "net/base/registry_controlled_domains/registry_controlled_domain.h" using base::android::AttachCurrentThread; @@ -475,9 +475,8 @@ base::string16 AutocompleteControllerAndroid::FormatURLUsingAcceptLanguages( std::string languages( profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)); - return url_formatter::FormatUrl( - url, languages, url_formatter::kFormatUrlOmitAll, - net::UnescapeRule::SPACES, nullptr, nullptr, nullptr); + return net::FormatUrl(url, languages, net::kFormatUrlOmitAll, + net::UnescapeRule::SPACES, NULL, NULL, NULL); } ScopedJavaLocalRef diff --git a/chrome/browser/android/tab_android.cc b/chrome/browser/android/tab_android.cc index 2e1aaa5..84184b7 100644 --- a/chrome/browser/android/tab_android.cc +++ b/chrome/browser/android/tab_android.cc @@ -56,7 +56,7 @@ #include "components/infobars/core/infobar_container.h" #include "components/navigation_interception/intercept_navigation_delegate.h" #include "components/navigation_interception/navigation_params.h" -#include "components/url_formatter/url_fixer.h" +#include "components/url_fixer/url_fixer.h" #include "content/public/browser/android/compositor.h" #include "content/public/browser/android/content_view_core.h" #include "content/public/browser/browser_thread.h" @@ -570,7 +570,7 @@ TabAndroid::TabLoadStatus TabAndroid::LoadUrl(JNIEnv* env, } GURL fixed_url( - url_formatter::FixupURL(gurl.possibly_invalid_spec(), std::string())); + url_fixer::FixupURL(gurl.possibly_invalid_spec(), std::string())); if (!fixed_url.is_valid()) return PAGE_LOAD_FAILED; diff --git a/chrome/browser/android/url_utilities.cc b/chrome/browser/android/url_utilities.cc index e9224f4..495a0cd 100644 --- a/chrome/browser/android/url_utilities.cc +++ b/chrome/browser/android/url_utilities.cc @@ -5,7 +5,7 @@ #include "base/android/jni_android.h" #include "base/android/jni_string.h" #include "components/google/core/browser/google_util.h" -#include "components/url_formatter/url_fixer.h" +#include "components/url_fixer/url_fixer.h" #include "jni/UrlUtilities_jni.h" #include "net/base/registry_controlled_domains/registry_controlled_domain.h" #include "url/gurl.h" @@ -80,7 +80,7 @@ static jstring FixupUrl(JNIEnv* env, jstring url, jstring optional_desired_tld) { DCHECK(url); - GURL fixed_url = url_formatter::FixupURL( + GURL fixed_url = url_fixer::FixupURL( base::android::ConvertJavaStringToUTF8(env, url), optional_desired_tld ? base::android::ConvertJavaStringToUTF8(env, optional_desired_tld) diff --git a/chrome/browser/autocomplete/history_url_provider_unittest.cc b/chrome/browser/autocomplete/history_url_provider_unittest.cc index 21dad67..67542dc 100644 --- a/chrome/browser/autocomplete/history_url_provider_unittest.cc +++ b/chrome/browser/autocomplete/history_url_provider_unittest.cc @@ -33,7 +33,7 @@ #include "components/search_engines/search_terms_data.h" #include "components/search_engines/template_url.h" #include "components/search_engines/template_url_service.h" -#include "components/url_formatter/url_fixer.h" +#include "components/url_fixer/url_fixer.h" #include "content/public/test/test_browser_thread_bundle.h" #include "testing/gtest/include/gtest/gtest.h" @@ -728,7 +728,7 @@ TEST_F(HistoryURLProviderTest, IntranetURLsWithPaths) { RunTest(ASCIIToUTF16(test_cases[i].input), std::string(), false, NULL, 0); } else { const UrlAndLegalDefault output[] = { - {url_formatter::FixupURL(test_cases[i].input, std::string()).spec(), + {url_fixer::FixupURL(test_cases[i].input, std::string()).spec(), true}}; ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16(test_cases[i].input), std::string(), false, output, arraysize(output))); @@ -1042,9 +1042,8 @@ TEST_F(HistoryURLProviderTest, HUPScoringExperiment) { if (test_cases[i].matches[max_matches].url == NULL) break; output[max_matches].url = - url_formatter::FixupURL(test_cases[i].matches[max_matches].url, - std::string()) - .spec(); + url_fixer::FixupURL(test_cases[i].matches[max_matches].url, + std::string()).spec(); output[max_matches].allowed_to_be_default_match = true; } autocomplete_->scoring_params_ = test_cases[i].scoring_params; diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc index 616d290..4142dec4 100644 --- a/chrome/browser/browser_about_handler.cc +++ b/chrome/browser/browser_about_handler.cc @@ -16,7 +16,7 @@ #include "chrome/browser/ui/browser_dialogs.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/url_constants.h" -#include "components/url_formatter/url_fixer.h" +#include "components/url_fixer/url_fixer.h" bool FixupBrowserAboutURL(GURL* url, content::BrowserContext* browser_context) { @@ -24,7 +24,7 @@ bool FixupBrowserAboutURL(GURL* url, // phase that determines the virtual URL, by including it in an initial // URLHandler. This prevents minor changes from producing a virtual URL, // which could lead to a URL spoof. - *url = url_formatter::FixupURL(url->possibly_invalid_spec(), std::string()); + *url = url_fixer::FixupURL(url->possibly_invalid_spec(), std::string()); return true; } @@ -34,11 +34,11 @@ bool WillHandleBrowserAboutURL(GURL* url, // then hopefully we can remove this forced fixup. FixupBrowserAboutURL(url, browser_context); - // Check that about: URLs are fixed up to chrome: by url_formatter::FixupURL. + // Check that about: URLs are fixed up to chrome: by url_fixer::FixupURL. DCHECK((*url == GURL(url::kAboutBlankURL)) || !url->SchemeIs(url::kAboutScheme)); - // Only handle chrome://foo/, url_formatter::FixupURL translates about:foo. + // Only handle chrome://foo/, url_fixer::FixupURL translates about:foo. if (!url->SchemeIs(content::kChromeUIScheme)) return false; diff --git a/chrome/browser/browser_about_handler.h b/chrome/browser/browser_about_handler.h index 2bbe5a8..7cc3785 100644 --- a/chrome/browser/browser_about_handler.h +++ b/chrome/browser/browser_about_handler.h @@ -17,7 +17,7 @@ bool FixupBrowserAboutURL(GURL* url, content::BrowserContext* browser_context); // Returns true if the given URL will be handled by the browser about handler. // Nowadays, these go through the webui, so the return is always false. -// Either way, |url| will be processed by url_formatter::FixupURL, which +// Either way, |url| will be processed by url_fixer::FixupURL, which // replaces the about: scheme with chrome:// for all about:foo URLs except // "about:blank". // Some |url| host values will be replaced with their respective redirects. diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 1f4b427..7fc1b41 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -108,7 +108,7 @@ #include "components/rappor/rappor_utils.h" #include "components/signin/core/common/profile_management_switches.h" #include "components/translate/core/common/translate_switches.h" -#include "components/url_formatter/url_fixer.h" +#include "components/url_fixer/url_fixer.h" #include "components/variations/variations_associated_data.h" #include "components/version_info/version_info.h" #include "content/public/browser/browser_child_process_host.h" diff --git a/chrome/browser/chrome_quota_permission_context.cc b/chrome/browser/chrome_quota_permission_context.cc index 332afb6..cc4db36 100644 --- a/chrome/browser/chrome_quota_permission_context.cc +++ b/chrome/browser/chrome_quota_permission_context.cc @@ -19,11 +19,11 @@ #include "chrome/grit/locale_settings.h" #include "components/infobars/core/confirm_infobar_delegate.h" #include "components/infobars/core/infobar.h" -#include "components/url_formatter/url_formatter.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/navigation_details.h" #include "content/public/browser/web_contents.h" #include "grit/theme_resources.h" +#include "net/base/net_util.h" #include "storage/common/quota/quota_types.h" #include "ui/base/l10n/l10n_util.h" #include "url/gurl.h" @@ -93,14 +93,14 @@ int QuotaPermissionRequest::GetIconID() const { base::string16 QuotaPermissionRequest::GetMessageText() const { return l10n_util::GetStringFUTF16( - (requested_quota_ > kRequestLargeQuotaThreshold - ? IDS_REQUEST_LARGE_QUOTA_INFOBAR_QUESTION - : IDS_REQUEST_QUOTA_INFOBAR_QUESTION), - url_formatter::FormatUrl( - origin_url_, display_languages_, - url_formatter::kFormatUrlOmitUsernamePassword | - url_formatter::kFormatUrlOmitTrailingSlashOnBareHostname, - net::UnescapeRule::SPACES, nullptr, nullptr, nullptr)); + (requested_quota_ > kRequestLargeQuotaThreshold ? + IDS_REQUEST_LARGE_QUOTA_INFOBAR_QUESTION : + IDS_REQUEST_QUOTA_INFOBAR_QUESTION), + net::FormatUrl(origin_url_, display_languages_, + net::kFormatUrlOmitUsernamePassword | + net::kFormatUrlOmitTrailingSlashOnBareHostname, + net::UnescapeRule::SPACES, NULL, NULL, NULL) + ); } base::string16 QuotaPermissionRequest::GetMessageTextFragment() const { @@ -219,14 +219,14 @@ base::string16 RequestQuotaInfoBarDelegate::GetMessageText() const { // If the site requested larger quota than this threshold, show a different // message to the user. return l10n_util::GetStringFUTF16( - (requested_quota_ > kRequestLargeQuotaThreshold - ? IDS_REQUEST_LARGE_QUOTA_INFOBAR_QUESTION - : IDS_REQUEST_QUOTA_INFOBAR_QUESTION), - url_formatter::FormatUrl( - origin_url_, display_languages_, - url_formatter::kFormatUrlOmitUsernamePassword | - url_formatter::kFormatUrlOmitTrailingSlashOnBareHostname, - net::UnescapeRule::SPACES, nullptr, nullptr, nullptr)); + (requested_quota_ > kRequestLargeQuotaThreshold ? + IDS_REQUEST_LARGE_QUOTA_INFOBAR_QUESTION : + IDS_REQUEST_QUOTA_INFOBAR_QUESTION), + net::FormatUrl(origin_url_, display_languages_, + net::kFormatUrlOmitUsernamePassword | + net::kFormatUrlOmitTrailingSlashOnBareHostname, + net::UnescapeRule::SPACES, NULL, NULL, NULL) + ); } bool RequestQuotaInfoBarDelegate::Accept() { diff --git a/chrome/browser/custom_home_pages_table_model.cc b/chrome/browser/custom_home_pages_table_model.cc index 8b25d0a..8b5aab4 100644 --- a/chrome/browser/custom_home_pages_table_model.cc +++ b/chrome/browser/custom_home_pages_table_model.cc @@ -19,8 +19,8 @@ #include "chrome/common/url_constants.h" #include "chrome/grit/generated_resources.h" #include "components/history/core/browser/history_service.h" -#include "components/url_formatter/url_formatter.h" #include "content/public/browser/web_contents.h" +#include "net/base/net_util.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/models/table_model_observer.h" #include "ui/gfx/codec/png_codec.h" @@ -305,7 +305,7 @@ void CustomHomePagesTableModel::OnGotTitle(const GURL& entry_url, base::string16 CustomHomePagesTableModel::FormattedURL(int row) const { std::string languages = profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); - base::string16 url = url_formatter::FormatUrl(entries_[row].url, languages); + base::string16 url = net::FormatUrl(entries_[row].url, languages); url = base::i18n::GetDisplayStringInLTRDirectionality(url); return url; } diff --git a/chrome/browser/dom_distiller/tab_utils_android.cc b/chrome/browser/dom_distiller/tab_utils_android.cc index 7dcef25..83598cb 100644 --- a/chrome/browser/dom_distiller/tab_utils_android.cc +++ b/chrome/browser/dom_distiller/tab_utils_android.cc @@ -12,7 +12,6 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/common/pref_names.h" -#include "components/url_formatter/url_formatter.h" #include "content/public/browser/web_contents.h" #include "content/public/common/content_constants.h" #include "jni/DomDistillerTabUtils_jni.h" @@ -57,10 +56,14 @@ jstring GetFormattedUrlFromOriginalDistillerUrl(JNIEnv* env, // and pastes it into another program, that program may think the URL ends at // the space. return base::android::ConvertUTF16ToJavaString( - env, url_formatter::FormatUrl( - url, languages, url_formatter::kFormatUrlOmitAll, - net::UnescapeRule::NORMAL, nullptr, nullptr, nullptr)) - .Release(); + env, + net::FormatUrl(url, + languages, + net::kFormatUrlOmitAll, + net::UnescapeRule::NORMAL, + NULL, + NULL, + NULL)).Release(); } } // namespace android diff --git a/chrome/browser/download/download_query.cc b/chrome/browser/download/download_query.cc index f800888..456f4cc 100644 --- a/chrome/browser/download/download_query.cc +++ b/chrome/browser/download/download_query.cc @@ -25,9 +25,9 @@ #include "base/values.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/pref_names.h" -#include "components/url_formatter/url_formatter.h" #include "content/public/browser/content_browser_client.h" #include "content/public/browser/download_item.h" +#include "net/base/net_util.h" #include "third_party/re2/re2/re2.h" #include "url/gurl.h" @@ -77,7 +77,7 @@ static bool MatchesQuery( base::string16 url_formatted = url_raw; if (item.GetBrowserContext()) { Profile* profile = Profile::FromBrowserContext(item.GetBrowserContext()); - url_formatted = url_formatter::FormatUrl( + url_formatted = net::FormatUrl( item.GetOriginalUrl(), profile->GetPrefs()->GetString(prefs::kAcceptLanguages)); } diff --git a/chrome/browser/extensions/api/sessions/sessions_api.cc b/chrome/browser/extensions/api/sessions/sessions_api.cc index 969c193..35131e3 100644 --- a/chrome/browser/extensions/api/sessions/sessions_api.cc +++ b/chrome/browser/extensions/api/sessions/sessions_api.cc @@ -32,12 +32,12 @@ #include "chrome/common/pref_names.h" #include "components/sync_driver/glue/synced_session.h" #include "components/sync_driver/open_tabs_ui_delegate.h" -#include "components/url_formatter/url_formatter.h" #include "content/public/browser/web_contents.h" #include "extensions/browser/extension_function_dispatcher.h" #include "extensions/browser/extension_function_registry.h" #include "extensions/browser/extension_system.h" #include "extensions/common/error_utils.h" +#include "net/base/net_util.h" #include "ui/base/layout.h" namespace extensions { @@ -93,8 +93,8 @@ scoped_ptr CreateTabModelHelper( } else { const std::string languages = profile->GetPrefs()->GetString(prefs::kAcceptLanguages); - tab_struct->title.reset(new std::string( - base::UTF16ToUTF8(url_formatter::FormatUrl(url, languages)))); + tab_struct->title.reset( + new std::string(base::UTF16ToUTF8(net::FormatUrl(url, languages)))); } tab_struct->index = index; tab_struct->pinned = pinned; diff --git a/chrome/browser/extensions/api/settings_private/prefs_util.cc b/chrome/browser/extensions/api/settings_private/prefs_util.cc index 97ada01..01fac9f 100644 --- a/chrome/browser/extensions/api/settings_private/prefs_util.cc +++ b/chrome/browser/extensions/api/settings_private/prefs_util.cc @@ -9,7 +9,7 @@ #include "chrome/browser/extensions/chrome_extension_function.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/pref_names.h" -#include "components/url_formatter/url_fixer.h" +#include "components/url_fixer/url_fixer.h" #if defined(OS_CHROMEOS) #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h" @@ -215,7 +215,7 @@ bool PrefsUtil::SetPref(const std::string& pref_name, return false; if (IsPrefTypeURL(pref_name)) { - GURL fixed = url_formatter::FixupURL(original, std::string()); + GURL fixed = url_fixer::FixupURL(original, std::string()); temp_value.reset(new base::StringValue(fixed.spec())); value = temp_value.get(); } diff --git a/chrome/browser/extensions/extension_tab_util.cc b/chrome/browser/extensions/extension_tab_util.cc index 45eb61f..6ac0c78 100644 --- a/chrome/browser/extensions/extension_tab_util.cc +++ b/chrome/browser/extensions/extension_tab_util.cc @@ -25,7 +25,7 @@ #include "chrome/browser/ui/tabs/tab_utils.h" #include "chrome/common/extensions/api/tabs.h" #include "chrome/common/url_constants.h" -#include "components/url_formatter/url_fixer.h" +#include "components/url_fixer/url_fixer.h" #include "content/public/browser/favicon_status.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/web_contents.h" @@ -550,7 +550,7 @@ bool ExtensionTabUtil::IsKillURL(const GURL& url) { // Check a fixed-up URL, to normalize the scheme and parse hosts correctly. GURL fixed_url = - url_formatter::FixupURL(url.possibly_invalid_spec(), std::string()); + url_fixer::FixupURL(url.possibly_invalid_spec(), std::string()); if (!fixed_url.SchemeIs(content::kChromeUIScheme)) return false; diff --git a/chrome/browser/geolocation/geolocation_infobar_delegate.cc b/chrome/browser/geolocation/geolocation_infobar_delegate.cc index 52cf183..1b6eb2d 100644 --- a/chrome/browser/geolocation/geolocation_infobar_delegate.cc +++ b/chrome/browser/geolocation/geolocation_infobar_delegate.cc @@ -7,9 +7,9 @@ #include "chrome/browser/infobars/infobar_service.h" #include "chrome/grit/generated_resources.h" #include "components/infobars/core/infobar.h" -#include "components/url_formatter/url_formatter.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "net/base/net_util.h" #include "ui/base/l10n/l10n_util.h" @@ -44,11 +44,9 @@ int GeolocationInfoBarDelegate::GetIconID() const { } base::string16 GeolocationInfoBarDelegate::GetMessageText() const { - return l10n_util::GetStringFUTF16( - IDS_GEOLOCATION_INFOBAR_QUESTION, - url_formatter::FormatUrl( - requesting_frame_, display_languages_, - url_formatter::kFormatUrlOmitUsernamePassword | - url_formatter::kFormatUrlOmitTrailingSlashOnBareHostname, - net::UnescapeRule::SPACES, nullptr, nullptr, nullptr)); + return l10n_util::GetStringFUTF16(IDS_GEOLOCATION_INFOBAR_QUESTION, + net::FormatUrl(requesting_frame_, display_languages_, + net::kFormatUrlOmitUsernamePassword | + net::kFormatUrlOmitTrailingSlashOnBareHostname, + net::UnescapeRule::SPACES, NULL, NULL, NULL)); } diff --git a/chrome/browser/interstitials/security_interstitial_page.cc b/chrome/browser/interstitials/security_interstitial_page.cc index b983456..082e505 100644 --- a/chrome/browser/interstitials/security_interstitial_page.cc +++ b/chrome/browser/interstitials/security_interstitial_page.cc @@ -18,10 +18,10 @@ #include "chrome/grit/generated_resources.h" #include "components/google/core/browser/google_util.h" #include "components/security_interstitials/core/metrics_helper.h" -#include "components/url_formatter/url_formatter.h" #include "content/public/browser/interstitial_page.h" #include "content/public/browser/page_navigator.h" #include "content/public/browser/web_contents.h" +#include "net/base/net_util.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/webui/jstemplate_builder.h" @@ -124,8 +124,7 @@ base::string16 SecurityInterstitialPage::GetFormattedHostName() const { Profile::FromBrowserContext(web_contents()->GetBrowserContext()); if (profile) languages = profile->GetPrefs()->GetString(prefs::kAcceptLanguages); - base::string16 host = - url_formatter::IDNToUnicode(request_url_.host(), languages); + base::string16 host = net::IDNToUnicode(request_url_.host(), languages); if (base::i18n::IsRTL()) base::i18n::WrapStringWithLTRFormatting(&host); return host; diff --git a/chrome/browser/media/media_stream_capture_indicator.cc b/chrome/browser/media/media_stream_capture_indicator.cc index 0c91b5b..978e0e8 100644 --- a/chrome/browser/media/media_stream_capture_indicator.cc +++ b/chrome/browser/media/media_stream_capture_indicator.cc @@ -18,13 +18,13 @@ #include "chrome/browser/tab_contents/tab_util.h" #include "chrome/common/pref_names.h" #include "chrome/grit/chromium_strings.h" -#include "components/url_formatter/url_formatter.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/content_browser_client.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_delegate.h" #include "content/public/browser/web_contents_observer.h" #include "grit/theme_resources.h" +#include "net/base/net_util.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/image/image_skia.h" @@ -112,8 +112,7 @@ base::string16 GetTitle(WebContents* web_contents) { Profile::FromBrowserContext(web_contents->GetBrowserContext()); std::string languages = profile->GetPrefs()->GetString(prefs::kAcceptLanguages); - if (tab_title == - url_formatter::FormatUrl(web_contents->GetURL(), languages)) + if (tab_title == net::FormatUrl(web_contents->GetURL(), languages)) tab_title = GetSecurityOrigin(web_contents); } diff --git a/chrome/browser/media/midi_permission_infobar_delegate.cc b/chrome/browser/media/midi_permission_infobar_delegate.cc index 40cc694..5a590cd 100644 --- a/chrome/browser/media/midi_permission_infobar_delegate.cc +++ b/chrome/browser/media/midi_permission_infobar_delegate.cc @@ -7,8 +7,8 @@ #include "chrome/browser/infobars/infobar_service.h" #include "chrome/grit/generated_resources.h" #include "components/infobars/core/infobar.h" -#include "components/url_formatter/url_formatter.h" #include "grit/theme_resources.h" +#include "net/base/net_util.h" #include "ui/base/l10n/l10n_util.h" // static @@ -45,9 +45,8 @@ int MidiPermissionInfoBarDelegate::GetIconID() const { base::string16 MidiPermissionInfoBarDelegate::GetMessageText() const { return l10n_util::GetStringFUTF16( IDS_MIDI_SYSEX_INFOBAR_QUESTION, - url_formatter::FormatUrl( - requesting_frame_.GetOrigin(), display_languages_, - url_formatter::kFormatUrlOmitUsernamePassword | - url_formatter::kFormatUrlOmitTrailingSlashOnBareHostname, - net::UnescapeRule::SPACES, nullptr, nullptr, nullptr)); + net::FormatUrl(requesting_frame_.GetOrigin(), display_languages_, + net::kFormatUrlOmitUsernamePassword | + net::kFormatUrlOmitTrailingSlashOnBareHostname, + net::UnescapeRule::SPACES, NULL, NULL, NULL)); } diff --git a/chrome/browser/media/protected_media_identifier_infobar_delegate.cc b/chrome/browser/media/protected_media_identifier_infobar_delegate.cc index 5dbd69e..4d4cbcc 100644 --- a/chrome/browser/media/protected_media_identifier_infobar_delegate.cc +++ b/chrome/browser/media/protected_media_identifier_infobar_delegate.cc @@ -10,9 +10,9 @@ #include "chrome/common/url_constants.h" #include "chrome/grit/generated_resources.h" #include "components/infobars/core/infobar.h" -#include "components/url_formatter/url_formatter.h" #include "grit/components_strings.h" #include "grit/theme_resources.h" +#include "net/base/net_util.h" #include "ui/base/l10n/l10n_util.h" // static @@ -77,8 +77,7 @@ void ProtectedMediaIdentifierInfoBarDelegate::InfoBarDismissed() { base::string16 ProtectedMediaIdentifierInfoBarDelegate::GetMessageText() const { return l10n_util::GetStringFUTF16( IDS_PROTECTED_MEDIA_IDENTIFIER_INFOBAR_QUESTION, - url_formatter::FormatUrl(requesting_frame_.GetOrigin(), - display_languages_)); + net::FormatUrl(requesting_frame_.GetOrigin(), display_languages_)); } base::string16 ProtectedMediaIdentifierInfoBarDelegate::GetButtonLabel( diff --git a/chrome/browser/notifications/notification_permission_infobar_delegate.cc b/chrome/browser/notifications/notification_permission_infobar_delegate.cc index 00316e2..54ccf0b 100644 --- a/chrome/browser/notifications/notification_permission_infobar_delegate.cc +++ b/chrome/browser/notifications/notification_permission_infobar_delegate.cc @@ -7,9 +7,8 @@ #include "chrome/browser/infobars/infobar_service.h" #include "chrome/grit/generated_resources.h" #include "components/infobars/core/infobar.h" -#include "components/url_formatter/url_formatter.h" #include "grit/theme_resources.h" -#include "net/base/escape.h" +#include "net/base/net_util.h" #include "ui/base/l10n/l10n_util.h" // static @@ -46,9 +45,8 @@ int NotificationPermissionInfobarDelegate::GetIconID() const { base::string16 NotificationPermissionInfobarDelegate::GetMessageText() const { return l10n_util::GetStringFUTF16( IDS_NOTIFICATION_PERMISSIONS, - url_formatter::FormatUrl( - requesting_frame_.GetOrigin(), display_languages_, - url_formatter::kFormatUrlOmitUsernamePassword | - url_formatter::kFormatUrlOmitTrailingSlashOnBareHostname, - net::UnescapeRule::SPACES, nullptr, nullptr, nullptr)); + net::FormatUrl(requesting_frame_.GetOrigin(), display_languages_, + net::kFormatUrlOmitUsernamePassword | + net::kFormatUrlOmitTrailingSlashOnBareHostname, + net::UnescapeRule::SPACES, nullptr, nullptr, nullptr)); } diff --git a/chrome/browser/notifications/platform_notification_service_impl.cc b/chrome/browser/notifications/platform_notification_service_impl.cc index 407971d..63508b3 100644 --- a/chrome/browser/notifications/platform_notification_service_impl.cc +++ b/chrome/browser/notifications/platform_notification_service_impl.cc @@ -17,13 +17,13 @@ #include "chrome/common/pref_names.h" #include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/content_settings/core/common/content_settings.h" -#include "components/url_formatter/url_formatter.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/desktop_notification_delegate.h" #include "content/public/browser/notification_event_dispatcher.h" #include "content/public/browser/platform_notification_context.h" #include "content/public/browser/storage_partition.h" #include "content/public/common/platform_notification_data.h" +#include "net/base/net_util.h" #include "ui/message_center/notifier_settings.h" #include "url/url_constants.h" @@ -391,8 +391,7 @@ base::string16 PlatformNotificationServiceImpl::WebOriginDisplayName( spec.begin() + parsed.CountCharactersBefore(url::Parsed::USERNAME, true)); } - formatted_origin.append( - url_formatter::IDNToUnicode(origin.host(), languages)); + formatted_origin.append(net::IDNToUnicode(origin.host(), languages)); if (origin.has_port()) { formatted_origin.push_back(':'); formatted_origin.append(base::UTF8ToUTF16(origin.port())); @@ -402,5 +401,5 @@ base::string16 PlatformNotificationServiceImpl::WebOriginDisplayName( // TODO(dewittj): Once file:// URLs are passed in to the origin // GURL here, begin returning the path as the display name. - return url_formatter::FormatUrl(origin, languages); + return net::FormatUrl(origin, languages); } diff --git a/chrome/browser/pepper_broker_infobar_delegate.cc b/chrome/browser/pepper_broker_infobar_delegate.cc index 0fa86d4..ca7a597 100644 --- a/chrome/browser/pepper_broker_infobar_delegate.cc +++ b/chrome/browser/pepper_broker_infobar_delegate.cc @@ -14,7 +14,6 @@ #include "chrome/grit/generated_resources.h" #include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/infobars/core/infobar.h" -#include "components/url_formatter/url_formatter.h" #include "content/public/browser/page_navigator.h" #include "content/public/browser/plugin_service.h" #include "content/public/browser/user_metrics.h" @@ -23,6 +22,7 @@ #include "content/public/common/webplugininfo.h" #include "grit/components_strings.h" #include "grit/theme_resources.h" +#include "net/base/net_util.h" #include "ui/base/l10n/l10n_util.h" @@ -104,9 +104,10 @@ base::string16 PepperBrokerInfoBarDelegate::GetMessageText() const { DCHECK(success); scoped_ptr plugin_metadata( PluginFinder::GetInstance()->GetPluginMetadata(plugin)); - return l10n_util::GetStringFUTF16( - IDS_PEPPER_BROKER_MESSAGE, plugin_metadata->name(), - url_formatter::FormatUrl(url_.GetOrigin(), languages_)); + return l10n_util::GetStringFUTF16(IDS_PEPPER_BROKER_MESSAGE, + plugin_metadata->name(), + net::FormatUrl(url_.GetOrigin(), + languages_)); } base::string16 PepperBrokerInfoBarDelegate::GetButtonLabel( diff --git a/chrome/browser/permissions/permission_bubble_request_impl.cc b/chrome/browser/permissions/permission_bubble_request_impl.cc index 1e2b13c..f175962 100644 --- a/chrome/browser/permissions/permission_bubble_request_impl.cc +++ b/chrome/browser/permissions/permission_bubble_request_impl.cc @@ -7,9 +7,8 @@ #include "chrome/browser/permissions/permission_context_base.h" #include "chrome/browser/permissions/permission_context_uma_util.h" #include "chrome/grit/generated_resources.h" -#include "components/url_formatter/url_formatter.h" #include "grit/theme_resources.h" -#include "net/base/escape.h" +#include "net/base/net_util.h" #include "ui/base/l10n/l10n_util.h" #include "ui/gfx/vector_icons_public2.h" @@ -110,11 +109,10 @@ base::string16 PermissionBubbleRequestImpl::GetMessageText() const { } return l10n_util::GetStringFUTF16( message_id, - url_formatter::FormatUrl( - request_origin_, display_languages_, - url_formatter::kFormatUrlOmitUsernamePassword | - url_formatter::kFormatUrlOmitTrailingSlashOnBareHostname, - net::UnescapeRule::SPACES, nullptr, nullptr, nullptr)); + net::FormatUrl(request_origin_, display_languages_, + net::kFormatUrlOmitUsernamePassword | + net::kFormatUrlOmitTrailingSlashOnBareHostname, + net::UnescapeRule::SPACES, NULL, NULL, NULL)); } base::string16 PermissionBubbleRequestImpl::GetMessageTextFragment() const { diff --git a/chrome/browser/policy/managed_bookmarks_policy_handler.cc b/chrome/browser/policy/managed_bookmarks_policy_handler.cc index 75c8e78..8c71fd3 100644 --- a/chrome/browser/policy/managed_bookmarks_policy_handler.cc +++ b/chrome/browser/policy/managed_bookmarks_policy_handler.cc @@ -10,7 +10,7 @@ #include "components/bookmarks/managed/managed_bookmarks_tracker.h" #include "components/policy/core/browser/policy_error_map.h" #include "components/policy/core/common/policy_map.h" -#include "components/url_formatter/url_fixer.h" +#include "components/url_fixer/url_fixer.h" #include "policy/policy_constants.h" #include "url/gurl.h" @@ -71,7 +71,7 @@ void ManagedBookmarksPolicyHandler::FilterBookmarks(base::ListValue* list) { } else { // Make sure the URL is valid before passing a bookmark to the pref. dict->Remove(ManagedBookmarksTracker::kChildren, NULL); - GURL gurl = url_formatter::FixupURL(url, std::string()); + GURL gurl = url_fixer::FixupURL(url, ""); if (!gurl.is_valid()) { it = list->Erase(it, NULL); continue; diff --git a/chrome/browser/policy/url_blacklist_manager_unittest.cc b/chrome/browser/policy/url_blacklist_manager_unittest.cc index b00a9a3..a21df06 100644 --- a/chrome/browser/policy/url_blacklist_manager_unittest.cc +++ b/chrome/browser/policy/url_blacklist_manager_unittest.cc @@ -15,7 +15,7 @@ #include "base/thread_task_runner_handle.h" #include "chrome/browser/policy/policy_helpers.h" #include "components/policy/core/common/policy_pref_names.h" -#include "components/url_formatter/url_fixer.h" +#include "components/url_fixer/url_fixer.h" #include "google_apis/gaia/gaia_urls.h" #include "net/base/load_flags.h" #include "net/base/net_errors.h" @@ -25,7 +25,7 @@ // TODO(joaodasilva): this file should be moved next to // components/policy/core/browser/url_blacklist_manager.(cc|h). // However, url_fixer_upper.h can't be included from the component. Rather -// than having it mocked out, the actual url_formatter::SegmentURL call is used +// than having it mocked out, the actual url_fixer::SegmentURL call is used // to make sure that the parsing of URL filters is correct. namespace policy { @@ -34,7 +34,7 @@ namespace { // Helper to get the disambiguated SegmentURL() function. URLBlacklist::SegmentURLCallback GetSegmentURLCallback() { - return url_formatter::SegmentURL; + return url_fixer::SegmentURL; } class TestingURLBlacklistManager : public URLBlacklistManager { diff --git a/chrome/browser/prefs/session_startup_pref.cc b/chrome/browser/prefs/session_startup_pref.cc index b75739f..996adc84 100644 --- a/chrome/browser/prefs/session_startup_pref.cc +++ b/chrome/browser/prefs/session_startup_pref.cc @@ -15,7 +15,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/common/pref_names.h" #include "components/pref_registry/pref_registry_syncable.h" -#include "components/url_formatter/url_fixer.h" +#include "components/url_fixer/url_fixer.h" #if defined(OS_MACOSX) #include "chrome/browser/ui/cocoa/window_restore_utils.h" @@ -54,7 +54,7 @@ void URLListToPref(const base::ListValue* url_list, SessionStartupPref* pref) { for (size_t i = 0; i < url_list->GetSize(); ++i) { std::string url_text; if (url_list->GetString(i, &url_text)) { - GURL fixed_url = url_formatter::FixupURL(url_text, std::string()); + GURL fixed_url = url_fixer::FixupURL(url_text, std::string()); pref->urls.push_back(fixed_url); } } diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc index c18b3a8..1e7fa4b 100644 --- a/chrome/browser/profiles/profile_impl.cc +++ b/chrome/browser/profiles/profile_impl.cc @@ -90,7 +90,7 @@ #include "components/pref_registry/pref_registry_syncable.h" #include "components/signin/core/browser/signin_manager.h" #include "components/ui/zoom/zoom_event_manager.h" -#include "components/url_formatter/url_fixer.h" +#include "components/url_fixer/url_fixer.h" #include "components/user_prefs/user_prefs.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/dom_storage_context.h" @@ -1207,7 +1207,7 @@ GURL ProfileImpl::GetHomePage() { base::FilePath browser_directory; PathService::Get(base::DIR_CURRENT, &browser_directory); - GURL home_page(url_formatter::FixupRelativeFile( + GURL home_page(url_fixer::FixupRelativeFile( browser_directory, command_line.GetSwitchValuePath(switches::kHomePage))); if (home_page.is_valid()) @@ -1216,8 +1216,8 @@ GURL ProfileImpl::GetHomePage() { if (GetPrefs()->GetBoolean(prefs::kHomePageIsNewTabPage)) return GURL(chrome::kChromeUINewTabURL); - GURL home_page(url_formatter::FixupURL( - GetPrefs()->GetString(prefs::kHomePage), std::string())); + GURL home_page(url_fixer::FixupURL(GetPrefs()->GetString(prefs::kHomePage), + std::string())); if (!home_page.is_valid()) return GURL(chrome::kChromeUINewTabURL); return home_page; diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc index b0f4b94..a149387 100644 --- a/chrome/browser/profiles/profile_io_data.cc +++ b/chrome/browser/profiles/profile_io_data.cc @@ -58,7 +58,7 @@ #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.h" #include "components/dom_distiller/core/url_constants.h" #include "components/sync_driver/pref_names.h" -#include "components/url_formatter/url_fixer.h" +#include "components/url_fixer/url_fixer.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/host_zoom_map.h" #include "content/public/browser/notification_service.h" @@ -508,7 +508,7 @@ void ProfileIOData::InitializeOnUIThread(Profile* profile) { #if defined(ENABLE_CONFIGURATION_POLICY) policy::URLBlacklist::SegmentURLCallback callback = static_cast( - url_formatter::SegmentURL); + url_fixer::SegmentURL); base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); scoped_refptr background_task_runner = pool->GetSequencedTaskRunner(pool->GetSequenceToken()); diff --git a/chrome/browser/ssl/captive_portal_blocking_page.cc b/chrome/browser/ssl/captive_portal_blocking_page.cc index 9287fe4e..955fea0 100644 --- a/chrome/browser/ssl/captive_portal_blocking_page.cc +++ b/chrome/browser/ssl/captive_portal_blocking_page.cc @@ -17,7 +17,6 @@ #include "chrome/browser/ssl/ssl_cert_reporter.h" #include "chrome/common/pref_names.h" #include "components/captive_portal/captive_portal_detector.h" -#include "components/url_formatter/url_formatter.h" #include "components/wifi/wifi_service.h" #include "content/public/browser/web_contents.h" #include "grit/generated_resources.h" @@ -170,8 +169,7 @@ void CaptivePortalBlockingPage::PopulateInterstitialStrings( web_contents()->GetBrowserContext()); if (profile) languages = profile->GetPrefs()->GetString(prefs::kAcceptLanguages); - base::string16 login_host = - url_formatter::IDNToUnicode(login_url_.host(), languages); + base::string16 login_host = net::IDNToUnicode(login_url_.host(), languages); if (base::i18n::IsRTL()) base::i18n::WrapStringWithLTRFormatting(&login_host); diff --git a/chrome/browser/supervised_user/supervised_user_bookmarks_handler.cc b/chrome/browser/supervised_user/supervised_user_bookmarks_handler.cc index 2b35d14..feaeb61 100644 --- a/chrome/browser/supervised_user/supervised_user_bookmarks_handler.cc +++ b/chrome/browser/supervised_user/supervised_user_bookmarks_handler.cc @@ -7,7 +7,7 @@ #include "base/logging.h" #include "base/strings/string_number_conversions.h" #include "base/values.h" -#include "components/url_formatter/url_fixer.h" +#include "components/url_fixer/url_fixer.h" namespace { @@ -187,7 +187,7 @@ void SupervisedUserBookmarksHandler::AddFoldersToTree() { void SupervisedUserBookmarksHandler::AddLinksToTree() { for (const auto& link : links_) { scoped_ptr node(new base::DictionaryValue); - GURL url = url_formatter::FixupURL(link.url, std::string()); + GURL url = url_fixer::FixupURL(link.url, std::string()); if (!url.is_valid()) { LOG(WARNING) << "Got invalid URL: " << link.url; continue; diff --git a/chrome/browser/supervised_user/supervised_user_url_filter.cc b/chrome/browser/supervised_user/supervised_user_url_filter.cc index d401680..667fc25 100644 --- a/chrome/browser/supervised_user/supervised_user_url_filter.cc +++ b/chrome/browser/supervised_user/supervised_user_url_filter.cc @@ -19,7 +19,7 @@ #include "chrome/browser/supervised_user/experimental/supervised_user_blacklist.h" #include "chrome/grit/generated_resources.h" #include "components/policy/core/browser/url_blacklist_manager.h" -#include "components/url_formatter/url_fixer.h" +#include "components/url_fixer/url_fixer.h" #include "components/url_matcher/url_matcher.h" #include "content/public/browser/browser_thread.h" #include "net/base/registry_controlled_domains/registry_controlled_domain.h" @@ -95,7 +95,7 @@ bool FilterBuilder::AddPattern(const std::string& pattern, int site_id) { std::string query; bool match_subdomains = true; URLBlacklist::SegmentURLCallback callback = - static_cast(url_formatter::SegmentURL); + static_cast(url_fixer::SegmentURL); if (!URLBlacklist::FilterToComponents( callback, pattern, &scheme, &host, &match_subdomains, &port, &path, &query)) { diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index b13909c..0631543 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn @@ -92,8 +92,8 @@ source_set("ui") { "//chrome/installer/util", "//components/autofill/content/browser:risk_proto", "//components/power", + "//components/secure_display", "//components/suggestions/proto", - "//components/url_formatter", "//device/nfc", "//media", "//net:net_with_v8", diff --git a/chrome/browser/ui/DEPS b/chrome/browser/ui/DEPS index 1e7e329..a04f569 100644 --- a/chrome/browser/ui/DEPS +++ b/chrome/browser/ui/DEPS @@ -1,7 +1,7 @@ include_rules = [ "+components/auto_login_parser", "+components/favicon/core", + "+components/secure_display", "+components/toolbar", - "+components/url_formatter", "-chrome/browser/ui/views", ] diff --git a/chrome/browser/ui/bookmarks/bookmark_utils.cc b/chrome/browser/ui/bookmarks/bookmark_utils.cc index 9d7fca2..f2f4bc1 100644 --- a/chrome/browser/ui/bookmarks/bookmark_utils.cc +++ b/chrome/browser/ui/bookmarks/bookmark_utils.cc @@ -25,9 +25,9 @@ #include "components/bookmarks/browser/bookmark_model.h" #include "components/bookmarks/browser/bookmark_node_data.h" #include "components/search/search.h" -#include "components/url_formatter/url_formatter.h" #include "components/user_prefs/user_prefs.h" #include "content/public/browser/web_contents.h" +#include "net/base/net_util.h" #include "ui/base/dragdrop/drag_drop_types.h" #include "ui/base/dragdrop/drop_target_event.h" #include "ui/base/l10n/l10n_util.h" @@ -325,10 +325,10 @@ base::string16 FormatBookmarkURLForDisplay(const GURL& url, // and trailing slash, and unescape most characters. However, it's // important not to drop any username/password, or unescape anything that // changes the URL's meaning. - return url_formatter::FormatUrl( - url, languages, url_formatter::kFormatUrlOmitAll & - ~url_formatter::kFormatUrlOmitUsernamePassword, - net::UnescapeRule::SPACES, nullptr, nullptr, nullptr); + return net::FormatUrl( + url, languages, + net::kFormatUrlOmitAll & ~net::kFormatUrlOmitUsernamePassword, + net::UnescapeRule::SPACES, NULL, NULL, NULL); } bool IsAppsShortcutEnabled(Profile* profile, diff --git a/chrome/browser/ui/bookmarks/bookmark_utils.h b/chrome/browser/ui/bookmarks/bookmark_utils.h index b9682a7..dbd7d0f7 100644 --- a/chrome/browser/ui/bookmarks/bookmark_utils.h +++ b/chrome/browser/ui/bookmarks/bookmark_utils.h @@ -95,7 +95,7 @@ void ToggleBookmarkBarWhenVisible(content::BrowserContext* browser_context); // Returns a formatted version of |url| appropriate to display to a user with // the given |prefs|, which may be NULL. When re-parsing this URL, clients -// should call url_formatter::FixupURL(). +// should call url_fixer::FixupURL(). base::string16 FormatBookmarkURLForDisplay(const GURL& url, const PrefService* prefs); diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.mm index ec02dac..079e509 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.mm @@ -11,7 +11,7 @@ #include "chrome/browser/ui/bookmarks/bookmark_utils.h" #include "components/bookmarks/browser/bookmark_expanded_state_tracker.h" #include "components/bookmarks/browser/bookmark_model.h" -#include "components/url_formatter/url_fixer.h" +#include "components/url_fixer/url_fixer.h" #include "components/user_prefs/user_prefs.h" using bookmarks::BookmarkExpandedStateTracker; @@ -104,7 +104,7 @@ using bookmarks::BookmarkNode; // If possible, return a valid GURL from the URL text field. - (GURL)GURLFromUrlField { NSString* url = [self displayURL]; - return url_formatter::FixupURL([url UTF8String], std::string()); + return url_fixer::FixupURL([url UTF8String], std::string()); } // Enable the OK button if there is a valid URL. diff --git a/chrome/browser/ui/cocoa/status_bubble_mac.mm b/chrome/browser/ui/cocoa/status_bubble_mac.mm index dfa18af..d7418d9 100644 --- a/chrome/browser/ui/cocoa/status_bubble_mac.mm +++ b/chrome/browser/ui/cocoa/status_bubble_mac.mm @@ -17,8 +17,8 @@ #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" #import "chrome/browser/ui/cocoa/bubble_view.h" -#include "components/url_formatter/elide_url.h" -#include "components/url_formatter/url_formatter.h" +#include "components/secure_display/elide_url.h" +#include "net/base/net_util.h" #import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSAnimation+Duration.h" #import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSBezierPath+RoundRect.h" #import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSColor+Luminance.h" @@ -235,9 +235,9 @@ void StatusBubbleMac::SetURL(const GURL& url, const std::string& languages) { gfx::FontList font_list_chr( gfx::Font(gfx::PlatformFont::CreateFromNativeFont(font))); - base::string16 original_url_text = url_formatter::FormatUrl(url, languages); + base::string16 original_url_text = net::FormatUrl(url, languages); base::string16 status = - url_formatter::ElideUrl(url, font_list_chr, text_width, languages); + secure_display::ElideUrl(url, font_list_chr, text_width, languages); SetText(status, true); @@ -706,7 +706,7 @@ void StatusBubbleMac::ExpandBubble() { NSFont* font = [[window_ contentView] font]; gfx::FontList font_list_chr( gfx::Font(gfx::PlatformFont::CreateFromNativeFont(font))); - base::string16 expanded_url = url_formatter::ElideUrl( + base::string16 expanded_url = secure_display::ElideUrl( url_, font_list_chr, max_bubble_width, languages_); // Scale width from gfx::Font in view coordinates to window coordinates. diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm index 8771039..ded9e13 100644 --- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm +++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm @@ -51,7 +51,7 @@ #include "components/metrics/proto/omnibox_event.pb.h" #include "components/omnibox/browser/autocomplete_classifier.h" #include "components/omnibox/browser/autocomplete_match.h" -#include "components/url_formatter/url_fixer.h" +#include "components/url_fixer/url_fixer.h" #include "components/web_modal/web_contents_modal_dialog_manager.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/user_metrics.h" @@ -2093,7 +2093,7 @@ NSImage* Overlay(NSImage* ground, NSImage* overlay, CGFloat alpha) { NOTIMPLEMENTED(); // Get the first URL and fix it up. - GURL url(GURL(url_formatter::FixupURL( + GURL url(GURL(url_fixer::FixupURL( base::SysNSStringToUTF8([urls objectAtIndex:0]), std::string()))); [self openURL:&url inView:view at:point]; diff --git a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm index a5d5572..2566d31 100644 --- a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm +++ b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm @@ -53,7 +53,7 @@ #include "components/omnibox/browser/autocomplete_classifier.h" #include "components/omnibox/browser/autocomplete_match.h" #include "components/search_engines/template_url_service.h" -#include "components/url_formatter/url_fixer.h" +#include "components/url_fixer/url_fixer.h" #include "content/public/browser/web_contents.h" #include "grit/theme_resources.h" #import "ui/base/cocoa/menu_controller.h" @@ -895,8 +895,8 @@ class NotificationBridge : public WrenchMenuBadgeController::Delegate { NOTIMPLEMENTED(); // Get the first URL and fix it up. - GURL url(url_formatter::FixupURL( - base::SysNSStringToUTF8([urls objectAtIndex:0]), std::string())); + GURL url(url_fixer::FixupURL(base::SysNSStringToUTF8([urls objectAtIndex:0]), + std::string())); if (url.SchemeIs(url::kJavaScriptScheme)) { browser_->window()->GetLocationBar()->GetOmniboxView()->SetUserText( diff --git a/chrome/browser/ui/content_settings/content_setting_bubble_model.cc b/chrome/browser/ui/content_settings/content_setting_bubble_model.cc index 0a03d05..339c596 100644 --- a/chrome/browser/ui/content_settings/content_setting_bubble_model.cc +++ b/chrome/browser/ui/content_settings/content_setting_bubble_model.cc @@ -29,7 +29,7 @@ #include "components/content_settings/core/browser/content_settings_utils.h" #include "components/content_settings/core/browser/cookie_settings.h" #include "components/content_settings/core/common/content_settings.h" -#include "components/url_formatter/elide_url.h" +#include "components/secure_display/elide_url.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" @@ -275,7 +275,7 @@ bool ContentSettingSingleRadioGroup::settings_changed() const { // content type and setting the default value based on the content setting. void ContentSettingSingleRadioGroup::SetRadioGroup() { GURL url = web_contents()->GetURL(); - base::string16 display_host = url_formatter::FormatUrlForSecurityDisplay( + base::string16 display_host = secure_display::FormatUrlForSecurityDisplay( url, profile()->GetPrefs()->GetString(prefs::kAcceptLanguages)); if (display_host.empty()) display_host = base::ASCIIToUTF16(url.spec()); @@ -719,7 +719,7 @@ void ContentSettingMediaStreamBubbleModel::SetRadioGroup() { radio_group.url = url; base::string16 display_host_utf16 = - url_formatter::FormatUrlForSecurityDisplay( + secure_display::FormatUrlForSecurityDisplay( url, profile()->GetPrefs()->GetString(prefs::kAcceptLanguages)); std::string display_host(base::UTF16ToUTF8(display_host_utf16)); if (display_host.empty()) diff --git a/chrome/browser/ui/content_settings/content_setting_bubble_model_unittest.cc b/chrome/browser/ui/content_settings/content_setting_bubble_model_unittest.cc index 5f960b4..e9b8d29 100644 --- a/chrome/browser/ui/content_settings/content_setting_bubble_model_unittest.cc +++ b/chrome/browser/ui/content_settings/content_setting_bubble_model_unittest.cc @@ -21,7 +21,7 @@ #include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/content_settings/core/common/content_settings.h" #include "components/infobars/core/infobar_delegate.h" -#include "components/url_formatter/elide_url.h" +#include "components/secure_display/elide_url.h" #include "content/public/browser/web_contents.h" #include "content/public/test/web_contents_tester.h" #include "testing/gtest/include/gtest/gtest.h" @@ -118,7 +118,7 @@ TEST_F(ContentSettingBubbleModelTest, Cookies) { EXPECT_EQ(bubble_content_2.radio_group.radio_items[1], l10n_util::GetStringFUTF8( IDS_ALLOWED_COOKIES_BLOCK, - url_formatter::FormatUrlForSecurityDisplay( + secure_display::FormatUrlForSecurityDisplay( web_contents()->GetURL(), profile()->GetPrefs()->GetString( prefs::kAcceptLanguages)))); EXPECT_FALSE(bubble_content_2.custom_link.empty()); @@ -157,7 +157,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamMicAndCamera) { EXPECT_EQ(bubble_content.radio_group.radio_items[0], l10n_util::GetStringFUTF8( IDS_ALLOWED_MEDIASTREAM_MIC_AND_CAMERA_NO_ACTION, - url_formatter::FormatUrlForSecurityDisplay( + secure_display::FormatUrlForSecurityDisplay( security_origin, profile()->GetPrefs()->GetString( prefs::kAcceptLanguages)))); EXPECT_EQ(bubble_content.radio_group.radio_items[1], @@ -542,7 +542,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamMic) { EXPECT_EQ(bubble_content.radio_group.radio_items[0], l10n_util::GetStringFUTF8( IDS_ALLOWED_MEDIASTREAM_MIC_NO_ACTION, - url_formatter::FormatUrlForSecurityDisplay( + secure_display::FormatUrlForSecurityDisplay( security_origin, profile()->GetPrefs()->GetString( prefs::kAcceptLanguages)))); EXPECT_EQ(bubble_content.radio_group.radio_items[1], @@ -576,7 +576,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamMic) { EXPECT_EQ(new_bubble_content.radio_group.radio_items[0], l10n_util::GetStringFUTF8( IDS_BLOCKED_MEDIASTREAM_MIC_ASK, - url_formatter::FormatUrlForSecurityDisplay( + secure_display::FormatUrlForSecurityDisplay( security_origin, profile()->GetPrefs()->GetString( prefs::kAcceptLanguages)))); EXPECT_EQ(new_bubble_content.radio_group.radio_items[1], @@ -621,7 +621,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamCamera) { EXPECT_EQ(bubble_content.radio_group.radio_items[0], l10n_util::GetStringFUTF8( IDS_ALLOWED_MEDIASTREAM_CAMERA_NO_ACTION, - url_formatter::FormatUrlForSecurityDisplay( + secure_display::FormatUrlForSecurityDisplay( security_origin, profile()->GetPrefs()->GetString( prefs::kAcceptLanguages)))); EXPECT_EQ(bubble_content.radio_group.radio_items[1], @@ -655,7 +655,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamCamera) { EXPECT_EQ(new_bubble_content.radio_group.radio_items[0], l10n_util::GetStringFUTF8( IDS_BLOCKED_MEDIASTREAM_CAMERA_ASK, - url_formatter::FormatUrlForSecurityDisplay( + secure_display::FormatUrlForSecurityDisplay( security_origin, profile()->GetPrefs()->GetString( prefs::kAcceptLanguages)))); EXPECT_EQ(new_bubble_content.radio_group.radio_items[1], @@ -702,7 +702,7 @@ TEST_F(ContentSettingBubbleModelTest, AccumulateMediastreamMicAndCamera) { EXPECT_EQ(bubble_content.radio_group.radio_items[0], l10n_util::GetStringFUTF8( IDS_ALLOWED_MEDIASTREAM_MIC_NO_ACTION, - url_formatter::FormatUrlForSecurityDisplay( + secure_display::FormatUrlForSecurityDisplay( security_origin, profile()->GetPrefs()->GetString( prefs::kAcceptLanguages)))); EXPECT_EQ(bubble_content.radio_group.radio_items[1], @@ -734,7 +734,7 @@ TEST_F(ContentSettingBubbleModelTest, AccumulateMediastreamMicAndCamera) { EXPECT_EQ(new_bubble_content.radio_group.radio_items[0], l10n_util::GetStringFUTF8( IDS_ALLOWED_MEDIASTREAM_MIC_AND_CAMERA_NO_ACTION, - url_formatter::FormatUrlForSecurityDisplay( + secure_display::FormatUrlForSecurityDisplay( security_origin, profile()->GetPrefs()->GetString( prefs::kAcceptLanguages)))); EXPECT_EQ(new_bubble_content.radio_group.radio_items[1], diff --git a/chrome/browser/ui/omnibox/omnibox_edit_model.cc b/chrome/browser/ui/omnibox/omnibox_edit_model.cc index 3acba3e..c94eadd 100644 --- a/chrome/browser/ui/omnibox/omnibox_edit_model.cc +++ b/chrome/browser/ui/omnibox/omnibox_edit_model.cc @@ -45,7 +45,7 @@ #include "components/search_engines/template_url_prepopulate_data.h" #include "components/search_engines/template_url_service.h" #include "components/toolbar/toolbar_model.h" -#include "components/url_formatter/url_fixer.h" +#include "components/url_fixer/url_fixer.h" #include "ui/gfx/image/image.h" #include "url/url_util.h" @@ -310,8 +310,7 @@ bool OmniboxEditModel::UpdatePermanentText() { } GURL OmniboxEditModel::PermanentURL() { - return url_formatter::FixupURL(base::UTF16ToUTF8(permanent_text_), - std::string()); + return url_fixer::FixupURL(base::UTF16ToUTF8(permanent_text_), std::string()); } void OmniboxEditModel::SetUserText(const base::string16& text) { diff --git a/chrome/browser/ui/passwords/manage_passwords_view_utils.cc b/chrome/browser/ui/passwords/manage_passwords_view_utils.cc index d779482..b2c50d2 100644 --- a/chrome/browser/ui/passwords/manage_passwords_view_utils.cc +++ b/chrome/browser/ui/passwords/manage_passwords_view_utils.cc @@ -8,7 +8,7 @@ #include "chrome/grit/chromium_strings.h" #include "chrome/grit/generated_resources.h" #include "components/password_manager/core/browser/affiliation_utils.h" -#include "components/url_formatter/elide_url.h" +#include "components/secure_display/elide_url.h" #include "net/base/net_util.h" #include "net/base/registry_controlled_domains/registry_controlled_domain.h" #include "ui/base/l10n/l10n_util.h" @@ -54,7 +54,7 @@ void GetSavePasswordDialogTitleTextAndLinkRange( net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); if (target_domain_differs) { title_id = IDS_SAVE_PASSWORD_TITLE; - replacements.push_back(url_formatter::FormatUrlForSecurityDisplay( + replacements.push_back(secure_display::FormatUrlForSecurityDisplay( form_origin_url, std::string())); } diff --git a/chrome/browser/ui/search_engines/edit_search_engine_controller.cc b/chrome/browser/ui/search_engines/edit_search_engine_controller.cc index 126af58..29b4574 100644 --- a/chrome/browser/ui/search_engines/edit_search_engine_controller.cc +++ b/chrome/browser/ui/search_engines/edit_search_engine_controller.cc @@ -10,7 +10,7 @@ #include "chrome/browser/search_engines/template_url_service_factory.h" #include "components/search_engines/template_url.h" #include "components/search_engines/template_url_service.h" -#include "components/url_formatter/url_fixer.h" +#include "components/url_fixer/url_fixer.h" #include "content/public/browser/user_metrics.h" #include "url/gurl.h" @@ -142,7 +142,7 @@ std::string EditSearchEngineController::GetFixedUpURL( TemplateURLRef::SearchTermsArgs(base::ASCIIToUTF16("x")), TemplateURLServiceFactory::GetForProfile(profile_)->search_terms_data())); url::Parsed parts; - std::string scheme(url_formatter::SegmentURL(expanded_url, &parts)); + std::string scheme(url_fixer::SegmentURL(expanded_url, &parts)); if (!parts.scheme.is_valid()) url.insert(0, scheme + "://"); diff --git a/chrome/browser/ui/startup/startup_browser_creator.cc b/chrome/browser/ui/startup/startup_browser_creator.cc index b0ed5aa..cb97bd8 100644 --- a/chrome/browser/ui/startup/startup_browser_creator.cc +++ b/chrome/browser/ui/startup/startup_browser_creator.cc @@ -61,7 +61,7 @@ #include "components/google/core/browser/google_util.h" #include "components/search_engines/util.h" #include "components/signin/core/common/profile_management_switches.h" -#include "components/url_formatter/url_fixer.h" +#include "components/url_fixer/url_fixer.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/child_process_security_policy.h" #include "content/public/browser/navigation_controller.h" @@ -473,7 +473,7 @@ std::vector StartupBrowserCreator::GetURLsFromCommandLine( // 'about' if the browser was started with a about:foo argument. if (!url.is_valid()) { base::ThreadRestrictions::ScopedAllowIO allow_io; - url = url_formatter::FixupRelativeFile(cur_dir, param); + url = url_fixer::FixupRelativeFile(cur_dir, param); } // Exclude dangerous schemes. if (url.is_valid()) { diff --git a/chrome/browser/ui/toolbar/toolbar_model_impl.cc b/chrome/browser/ui/toolbar/toolbar_model_impl.cc index 0c2b041..083b11b 100644 --- a/chrome/browser/ui/toolbar/toolbar_model_impl.cc +++ b/chrome/browser/ui/toolbar/toolbar_model_impl.cc @@ -20,7 +20,6 @@ #include "components/omnibox/browser/autocomplete_classifier.h" #include "components/omnibox/browser/autocomplete_input.h" #include "components/omnibox/browser/autocomplete_match.h" -#include "components/url_formatter/url_formatter.h" #include "content/public/browser/cert_store.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_entry.h" @@ -30,6 +29,7 @@ #include "content/public/common/ssl_status.h" #include "grit/components_scaled_resources.h" #include "grit/theme_resources.h" +#include "net/base/net_util.h" #include "net/cert/cert_status_flags.h" #include "net/cert/x509_certificate.h" #include "net/ssl/ssl_connection_status_flags.h" @@ -68,9 +68,8 @@ base::string16 ToolbarModelImpl::GetFormattedURL(size_t* prefix_end) const { // and pastes it into another program, that program may think the URL ends at // the space. return AutocompleteInput::FormattedStringWithEquivalentMeaning( - url, url_formatter::FormatUrl( - url, languages, url_formatter::kFormatUrlOmitAll, - net::UnescapeRule::NORMAL, nullptr, prefix_end, nullptr), + url, net::FormatUrl(url, languages, net::kFormatUrlOmitAll, + net::UnescapeRule::NORMAL, NULL, prefix_end, NULL), ChromeAutocompleteSchemeClassifier(profile)); } diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc index 6222ee3..e5336af 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc @@ -55,7 +55,7 @@ #include "components/bookmarks/browser/bookmark_utils.h" #include "components/bookmarks/managed/managed_bookmark_service.h" #include "components/metrics/metrics_service.h" -#include "components/url_formatter/elide_url.h" +#include "components/secure_display/elide_url.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/page_navigator.h" @@ -722,7 +722,7 @@ base::string16 BookmarkBarView::CreateToolTipForURLAndTitle( std::string languages = profile->GetPrefs()->GetString( prefs::kAcceptLanguages); base::string16 elided_url( - url_formatter::ElideUrl(url, tt_fonts, max_width, languages)); + secure_display::ElideUrl(url, tt_fonts, max_width, languages)); elided_url = base::i18n::GetDisplayStringInLTRDirectionality(elided_url); result.append(elided_url); } diff --git a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc index a591923..0ef71fe 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc @@ -20,7 +20,7 @@ #include "components/bookmarks/browser/bookmark_utils.h" #include "components/constrained_window/constrained_window_views.h" #include "components/history/core/browser/history_service.h" -#include "components/url_formatter/url_fixer.h" +#include "components/url_fixer/url_fixer.h" #include "components/user_prefs/user_prefs.h" #include "ui/accessibility/ax_view_state.h" #include "ui/base/l10n/l10n_util.h" @@ -440,8 +440,7 @@ void BookmarkEditorView::Reset() { GURL BookmarkEditorView::GetInputURL() const { if (details_.GetNodeType() == BookmarkNode::FOLDER) return GURL(); - return url_formatter::FixupURL(base::UTF16ToUTF8(url_tf_->text()), - std::string()); + return url_fixer::FixupURL(base::UTF16ToUTF8(url_tf_->text()), std::string()); } void BookmarkEditorView::UserInputChanged() { diff --git a/chrome/browser/ui/views/status_bubble_views.cc b/chrome/browser/ui/views/status_bubble_views.cc index 52115f4..608c45c 100644 --- a/chrome/browser/ui/views/status_bubble_views.cc +++ b/chrome/browser/ui/views/status_bubble_views.cc @@ -14,8 +14,8 @@ #include "base/strings/utf_string_conversions.h" #include "base/thread_task_runner_handle.h" #include "chrome/browser/themes/theme_properties.h" -#include "components/url_formatter/elide_url.h" -#include "components/url_formatter/url_formatter.h" +#include "components/secure_display/elide_url.h" +#include "net/base/net_util.h" #include "third_party/skia/include/core/SkPaint.h" #include "third_party/skia/include/core/SkRRect.h" #include "ui/base/theme_provider.h" @@ -695,7 +695,7 @@ void StatusBubbleViews::SetURL(const GURL& url, const std::string& languages) { int text_width = static_cast(popup_bounds.width() - (kShadowThickness * 2) - kTextPositionX - kTextHorizPadding - 1); url_text_ = - url_formatter::ElideUrl(url, gfx::FontList(), text_width, languages); + secure_display::ElideUrl(url, gfx::FontList(), text_width, languages); // An URL is always treated as a left-to-right string. On right-to-left UIs // we need to explicitly mark the URL as LTR to make sure it is displayed @@ -711,8 +711,7 @@ void StatusBubbleViews::SetURL(const GURL& url, const std::string& languages) { // size (shrinking or expanding). Otherwise delay. if (is_expanded_ && !url.is_empty()) { ExpandBubble(); - } else if (url_formatter::FormatUrl(url, languages).length() > - url_text_.length()) { + } else if (net::FormatUrl(url, languages).length() > url_text_.length()) { base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, base::Bind(&StatusBubbleViews::ExpandBubble, expand_timer_factory_.GetWeakPtr()), @@ -859,7 +858,7 @@ void StatusBubbleViews::ExpandBubble() { gfx::Rect popup_bounds = popup_->GetWindowBoundsInScreen(); int max_status_bubble_width = GetMaxStatusBubbleWidth(); const gfx::FontList font_list; - url_text_ = url_formatter::ElideUrl(url_, font_list, max_status_bubble_width, + url_text_ = secure_display::ElideUrl(url_, font_list, max_status_bubble_width, languages_); int expanded_bubble_width = std::max(GetStandardStatusBubbleWidth(), diff --git a/chrome/browser/ui/views/website_settings/permissions_bubble_view.cc b/chrome/browser/ui/views/website_settings/permissions_bubble_view.cc index 8f27164..e885ebf 100644 --- a/chrome/browser/ui/views/website_settings/permissions_bubble_view.cc +++ b/chrome/browser/ui/views/website_settings/permissions_bubble_view.cc @@ -18,7 +18,7 @@ #include "chrome/browser/ui/website_settings/permission_bubble_request.h" #include "chrome/common/pref_names.h" #include "chrome/grit/generated_resources.h" -#include "components/url_formatter/url_formatter.h" +#include "net/base/net_util.h" #include "ui/accessibility/ax_view_state.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/models/combobox_model.h" @@ -216,11 +216,12 @@ PermissionsBubbleDelegateView::PermissionsBubbleDelegateView( SetLayoutManager(new views::BoxLayout( views::BoxLayout::kVertical, kBubbleOuterMargin, 0, kItemMajorSpacing)); - hostname_ = url_formatter::FormatUrl( - requests[0]->GetRequestingHostname(), languages, - url_formatter::kFormatUrlOmitUsernamePassword | - url_formatter::kFormatUrlOmitTrailingSlashOnBareHostname, - net::UnescapeRule::SPACES, nullptr, nullptr, nullptr); + hostname_ = net::FormatUrl(requests[0]->GetRequestingHostname(), + languages, + net::kFormatUrlOmitUsernamePassword | + net::kFormatUrlOmitTrailingSlashOnBareHostname, + net::UnescapeRule::SPACES, + nullptr, nullptr, nullptr); ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); for (size_t index = 0; index < requests.size(); index++) { diff --git a/chrome/browser/ui/webui/history_ui.cc b/chrome/browser/ui/webui/history_ui.cc index 69de94b..0fd41b3 100644 --- a/chrome/browser/ui/webui/history_ui.cc +++ b/chrome/browser/ui/webui/history_ui.cc @@ -46,13 +46,13 @@ #include "components/search/search.h" #include "components/signin/core/browser/signin_manager.h" #include "components/sync_driver/device_info.h" -#include "components/url_formatter/url_formatter.h" #include "content/public/browser/url_data_source.h" #include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui_data_source.h" #include "grit/browser_resources.h" #include "grit/theme_resources.h" #include "net/base/escape.h" +#include "net/base/net_util.h" #include "sync/protocol/history_delete_directive_specifics.pb.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/time_format.h" @@ -352,8 +352,7 @@ scoped_ptr BrowsingHistoryHandler::HistoryEntry::ToValue( scoped_ptr result(new base::DictionaryValue()); SetUrlAndTitle(result.get()); - base::string16 domain = - url_formatter::IDNToUnicode(url.host(), accept_languages); + base::string16 domain = net::IDNToUnicode(url.host(), accept_languages); // When the domain is empty, use the scheme instead. This allows for a // sensible treatment of e.g. file: URLs when group by domain is on. if (domain.empty()) diff --git a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc index 8a60bf2..a1b971a 100644 --- a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc +++ b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc @@ -48,7 +48,7 @@ #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_service.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_event_store.h" #include "components/onc/onc_constants.h" -#include "components/url_formatter/url_fixer.h" +#include "components/url_fixer/url_fixer.h" #include "components/version_info/version_info.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_details.h" diff --git a/chrome/browser/ui/webui/options/core_options_handler.cc b/chrome/browser/ui/webui/options/core_options_handler.cc index 77a4acd..9682bb95 100644 --- a/chrome/browser/ui/webui/options/core_options_handler.cc +++ b/chrome/browser/ui/webui/options/core_options_handler.cc @@ -23,7 +23,7 @@ #include "chrome/grit/chromium_strings.h" #include "chrome/grit/generated_resources.h" #include "chrome/grit/locale_settings.h" -#include "components/url_formatter/url_fixer.h" +#include "components/url_fixer/url_fixer.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_types.h" #include "content/public/browser/user_metrics.h" @@ -575,7 +575,7 @@ void CoreOptionsHandler::HandleSetPref(const base::ListValue* args, NOTREACHED(); return; } - GURL fixed = url_formatter::FixupURL(original, std::string()); + GURL fixed = url_fixer::FixupURL(original, std::string()); temp_value.reset(new base::StringValue(fixed.spec())); value = temp_value.get(); break; diff --git a/chrome/browser/ui/webui/options/startup_pages_handler.cc b/chrome/browser/ui/webui/options/startup_pages_handler.cc index 6f9946c..c8ebc9a 100644 --- a/chrome/browser/ui/webui/options/startup_pages_handler.cc +++ b/chrome/browser/ui/webui/options/startup_pages_handler.cc @@ -21,7 +21,7 @@ #include "components/omnibox/browser/autocomplete_controller.h" #include "components/omnibox/browser/autocomplete_input.h" #include "components/omnibox/browser/autocomplete_result.h" -#include "components/url_formatter/url_fixer.h" +#include "components/url_fixer/url_fixer.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/web_ui.h" @@ -163,7 +163,7 @@ void StartupPagesHandler::AddStartupPage(const base::ListValue* args) { std::string url_string; CHECK(args->GetString(0, &url_string)); - GURL url = url_formatter::FixupURL(url_string, std::string()); + GURL url = url_fixer::FixupURL(url_string, std::string()); if (!url.is_valid()) return; @@ -188,7 +188,7 @@ void StartupPagesHandler::EditStartupPage(const base::ListValue* args) { return; } - fixed_url = url_formatter::FixupURL(url_string, std::string()); + fixed_url = url_fixer::FixupURL(url_string, std::string()); if (!fixed_url.is_empty()) { std::vector urls = startup_custom_pages_table_model_->GetURLs(); urls[index] = fixed_url; -- cgit v1.1