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/autocomplete | |
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/autocomplete')
-rw-r--r-- | chrome/browser/autocomplete/history_url_provider.cc | 11 | ||||
-rw-r--r-- | chrome/browser/autocomplete/search_provider.cc | 4 |
2 files changed, 10 insertions, 5 deletions
diff --git a/chrome/browser/autocomplete/history_url_provider.cc b/chrome/browser/autocomplete/history_url_provider.cc index 97ccd03..7ecba26 100644 --- a/chrome/browser/autocomplete/history_url_provider.cc +++ b/chrome/browser/autocomplete/history_url_provider.cc @@ -19,6 +19,7 @@ #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" #include "chrome/common/sqlite_utils.h" +#include "chrome/common/url_constants.h" #include "googleurl/src/gurl.h" #include "googleurl/src/url_parse.h" #include "googleurl/src/url_util.h" @@ -344,8 +345,9 @@ std::wstring HistoryURLProvider::FixupUserInput(const std::wstring& input) { // Don't prepend a scheme when the user didn't have one. Since the fixer // upper only prepends the "http" scheme, that's all we need to check for. url_parse::Component scheme; - if (canonical_gurl.SchemeIs("http") && - !url_util::FindAndCompareScheme(WideToUTF8(input), "http", &scheme)) + if (canonical_gurl.SchemeIs(chrome::kHttpScheme) && + !url_util::FindAndCompareScheme(WideToUTF8(input), chrome::kHttpScheme, + &scheme)) TrimHttpPrefix(&output); // Make the number of trailing slashes on the output exactly match the input. @@ -380,7 +382,8 @@ std::wstring HistoryURLProvider::FixupUserInput(const std::wstring& input) { // static size_t HistoryURLProvider::TrimHttpPrefix(std::wstring* url) { url_parse::Component scheme; - if (!url_util::FindAndCompareScheme(WideToUTF8(*url), "http", &scheme)) + if (!url_util::FindAndCompareScheme(WideToUTF8(*url), chrome::kHttpScheme, + &scheme)) return 0; // Not "http". // Erase scheme plus up to two slashes. @@ -593,7 +596,7 @@ void HistoryURLProvider::RunAutocompletePasses(const AutocompleteInput& input, // Create a match for exactly what the user typed. This will always be one // of the top two results we return. const bool trim_http = !url_util::FindAndCompareScheme( - WideToUTF8(input.text()), "http", NULL); + WideToUTF8(input.text()), chrome::kHttpScheme, NULL); SuggestExactInput(input, trim_http); // We'll need the history service to run both passes, so try to obtain it. diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc index 477543d..1b51449 100644 --- a/chrome/browser/autocomplete/search_provider.cc +++ b/chrome/browser/autocomplete/search_provider.cc @@ -15,6 +15,7 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" +#include "chrome/common/url_constants.h" #include "googleurl/src/url_util.h" #include "grit/generated_resources.h" #include "net/base/escape.h" @@ -606,7 +607,8 @@ AutocompleteMatch SearchProvider::NavigationToMatch( // static size_t SearchProvider::TrimHttpPrefix(std::wstring* url) { url_parse::Component scheme; - if (!url_util::FindAndCompareScheme(WideToUTF8(*url), "http", &scheme)) + if (!url_util::FindAndCompareScheme(WideToUTF8(*url), chrome::kHttpScheme, + &scheme)) return 0; // Not "http". // Erase scheme plus up to two slashes. |