| Index: chrome/browser/net/url_fixer_upper.cc
|
| diff --git a/chrome/browser/net/url_fixer_upper.cc b/chrome/browser/net/url_fixer_upper.cc
|
| index 10d930b0fa6c2aeb71860d435f874d0b544d4326..37125d02cd4176fa394c8ef3e03da2f2e9b58964 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);
|
| }
|
|
|
|
|