diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-02 02:37:40 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-02 02:37:40 +0000 |
commit | 79845effcd569cb61784e8a8c221f839e6e23525 (patch) | |
tree | d86e942097765499876b48a5d764592e2b9c376f /chrome/browser/autocomplete/autocomplete.h | |
parent | 9902c201466fe4a701f43a124f4d22b6829c87e6 (diff) | |
download | chromium_src-79845effcd569cb61784e8a8c221f839e6e23525.zip chromium_src-79845effcd569cb61784e8a8c221f839e6e23525.tar.gz chromium_src-79845effcd569cb61784e8a8c221f839e6e23525.tar.bz2 |
Strip the trailing slash from URLs like "http://google.com/". This especially helps when the scheme has also been stripped, as it makes the hostname look less unbalanced. We're careful to avoid stripping the slash when doing so would confuse the omnibox.
This also moves to more aggressive stripping and/or unescaping in several places. In general, it seems like we should be as aggressive as is feasible.
BUG=43587
TEST=Visit google.com. There should be no slash in the address bar.
Review URL: http://codereview.chromium.org/2389002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48691 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete/autocomplete.h')
-rw-r--r-- | chrome/browser/autocomplete/autocomplete.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/chrome/browser/autocomplete/autocomplete.h b/chrome/browser/autocomplete/autocomplete.h index e7766dd..4f85cf4 100644 --- a/chrome/browser/autocomplete/autocomplete.h +++ b/chrome/browser/autocomplete/autocomplete.h @@ -190,7 +190,8 @@ class AutocompleteInput { static std::string TypeToString(Type type); // Parses |text| and returns the type of input this will be interpreted as. - // The components of the input are stored in the output parameter |parts|. + // The components of the input are stored in the output parameter |parts|, if + // it is non-NULL. static Type Parse(const std::wstring& text, const std::wstring& desired_tld, url_parse::Parsed* parts, @@ -205,6 +206,16 @@ class AutocompleteInput { url_parse::Component* scheme, url_parse::Component* host); + // Code that wants to format URLs with a format flag including + // net::kFormatUrlOmitTrailingSlashOnBareHostname risk changing the meaning if + // the result is then parsed as AutocompleteInput. Such code can call this + // function with the URL and its formatted string, and it will return a + // formatted string with the same meaning as the original URL (i.e. it will + // re-append a slash if necessary). + static std::wstring FormattedStringWithEquivalentMeaning( + const GURL& url, + const std::wstring& formatted_url); + // User-provided text to be completed. const std::wstring& text() const { return text_; } |