diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-26 01:56:02 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-26 01:56:02 +0000 |
commit | dcf7d3525aa9b1f16b56a16d16108262db0571ee (patch) | |
tree | 91228f9d96aa74f102df742cdf76598cbb328958 /chrome/browser/net/url_fixer_upper.cc | |
parent | 387b71b7d1d1bf267cbe088136610959b319f3b3 (diff) | |
download | chromium_src-dcf7d3525aa9b1f16b56a16d16108262db0571ee.zip chromium_src-dcf7d3525aa9b1f16b56a16d16108262db0571ee.tar.gz chromium_src-dcf7d3525aa9b1f16b56a16d16108262db0571ee.tar.bz2 |
Coalesce more hardcoded schemes to using predefined constants.
Review URL: http://codereview.chromium.org/31008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10437 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 | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/chrome/browser/net/url_fixer_upper.cc b/chrome/browser/net/url_fixer_upper.cc index ec908cd..121807b 100644 --- a/chrome/browser/net/url_fixer_upper.cc +++ b/chrome/browser/net/url_fixer_upper.cc @@ -10,6 +10,7 @@ #include "base/logging.h" #include "base/string_util.h" #include "chrome/common/gfx/text_elider.h" +#include "chrome/common/url_constants.h" #include "googleurl/src/gurl.h" #include "googleurl/src/url_canon.h" #include "googleurl/src/url_file.h" @@ -303,14 +304,16 @@ string URLFixerUpper::SegmentURL(const string& text, // When we couldn't find a scheme in the input, we need to pick one. Normally // we choose http, but if the URL starts with "ftp.", we match other browsers // and choose ftp. - if (!parts->scheme.is_valid()) - scheme.assign(StartsWithASCII(text, "ftp.", false) ? "ftp" : "http"); + if (!parts->scheme.is_valid()) { + scheme.assign(StartsWithASCII(text, "ftp.", false) ? + chrome::kFtpScheme : chrome::kHttpScheme); + } // Cannonicalize the scheme. StringToLowerASCII(&scheme); // Not segmenting file schemes or nonstandard schemes. - if ((scheme == "file") || + if ((scheme == chrome::kFileScheme) || !url_util::IsStandard(scheme.c_str(), static_cast<int>(scheme.length()), url_parse::Component(0, static_cast<int>(scheme.length())))) return scheme; |