diff options
author | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-08 18:34:03 +0000 |
---|---|---|
committer | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-08 18:34:03 +0000 |
commit | 89f550b854228a6414d017c9186e3e8540b69e13 (patch) | |
tree | 863139cb1cfeeeeeebbfb48b729373ce4c12f112 /chrome/browser/net/url_fixer_upper.cc | |
parent | 56283961a67c5beb667589a547adf3d94db018e9 (diff) | |
download | chromium_src-89f550b854228a6414d017c9186e3e8540b69e13.zip chromium_src-89f550b854228a6414d017c9186e3e8540b69e13.tar.gz chromium_src-89f550b854228a6414d017c9186e3e8540b69e13.tar.bz2 |
*Fixup about and chrome scheme URLs in URLFixerUpper::FixupURL.
*Update AboutSource to use the source_name of each about/chrome page.
*Make WillHandleBrowserAboutURL fix up schemes and handle chrome://foo/
-Redirect memory to memory-redirect (wasn't handling chrome://memory/).
-Catalog all kChromeUI*Hosts in url_constants.cc
-Simplify paths (credits, os-credits, ipc, settings, about/version).
-Nix web_ui_util::ChromeURLHostEquals (use scheme & host comparison).
-Favor GURL::SchemeIs and url_constants, update & expand tests.
-Add and fixup chrome://chrome-urls (the about:about page).
-Update special_tabs.py from Nirnimesh's codereview.chromium.org/6995057/.
This change was reverted with r88166 for sync_integration_tests failures.
These failures are a tangential issue, crbug.com/85294; I'll re-land this soon.
BUG=55771
TEST=Access about:, about://, chrome:, chrome:// pages.
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=88142
Review URL: http://codereview.chromium.org/7068007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88367 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net/url_fixer_upper.cc')
-rw-r--r-- | chrome/browser/net/url_fixer_upper.cc | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/chrome/browser/net/url_fixer_upper.cc b/chrome/browser/net/url_fixer_upper.cc index 10d930b..37125d0 100644 --- a/chrome/browser/net/url_fixer_upper.cc +++ b/chrome/browser/net/url_fixer_upper.cc @@ -406,10 +406,10 @@ std::string URLFixerUpper::SegmentURL(const std::string& text, chrome::kFtpScheme : chrome::kHttpScheme); } - // Not segmenting file schemes or nonstandard schemes. - if ((scheme == chrome::kFileScheme) || - !url_util::IsStandard(scheme.c_str(), - url_parse::Component(0, static_cast<int>(scheme.length())))) + // Proceed with about and chrome schemes, but not file or nonstandard schemes. + if ((scheme != chrome::kAboutScheme) && (scheme != chrome::kChromeUIScheme) && + ((scheme == chrome::kFileScheme) || !url_util::IsStandard(scheme.c_str(), + url_parse::Component(0, static_cast<int>(scheme.length()))))) return scheme; if (parts->scheme.is_valid()) { @@ -427,7 +427,7 @@ std::string URLFixerUpper::SegmentURL(const std::string& text, // Construct the text to parse by inserting the scheme. std::string inserted_text(scheme); - inserted_text.append("://"); + inserted_text.append(chrome::kStandardSchemeSeparator); std::string text_to_parse(text.begin(), first_nonwhite); text_to_parse.append(inserted_text); text_to_parse.append(first_nonwhite, text.end()); @@ -478,11 +478,16 @@ GURL URLFixerUpper::FixupURL(const std::string& text, if (scheme == chrome::kFileScheme) return GURL(parts.scheme.is_valid() ? text : FixupPath(text)); + // Parse and rebuild about: and chrome: URLs, except about:blank. + bool chrome_url = !LowerCaseEqualsASCII(trimmed, chrome::kAboutBlankURL) && + ((scheme == chrome::kAboutScheme) || (scheme == chrome::kChromeUIScheme)); + // For some schemes whose layouts we understand, we rebuild it. - if (url_util::IsStandard(scheme.c_str(), + if (chrome_url || url_util::IsStandard(scheme.c_str(), url_parse::Component(0, static_cast<int>(scheme.length())))) { - std::string url(scheme); - url.append("://"); + // Replace the about: scheme with the chrome: scheme. + std::string url(chrome_url ? chrome::kChromeUIScheme : scheme); + url.append(chrome::kStandardSchemeSeparator); // We need to check whether the |username| is valid because it is our // responsibility to append the '@' to delineate the user information from @@ -494,6 +499,8 @@ GURL URLFixerUpper::FixupURL(const std::string& text, } FixupHost(trimmed, parts.host, parts.scheme.is_valid(), desired_tld, &url); + if (chrome_url && !parts.host.is_valid()) + url.append(chrome::kChromeUIDefaultHost); FixupPort(trimmed, parts.port, &url); FixupPath(trimmed, parts.path, &url); FixupQuery(trimmed, parts.query, &url); @@ -505,7 +512,7 @@ GURL URLFixerUpper::FixupURL(const std::string& text, // In the worst-case, we insert a scheme if the URL lacks one. if (!parts.scheme.is_valid()) { std::string fixed_scheme(scheme); - fixed_scheme.append("://"); + fixed_scheme.append(chrome::kStandardSchemeSeparator); trimmed.insert(0, fixed_scheme); } |