summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete/history_url_provider.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-26 01:56:02 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-26 01:56:02 +0000
commitdcf7d3525aa9b1f16b56a16d16108262db0571ee (patch)
tree91228f9d96aa74f102df742cdf76598cbb328958 /chrome/browser/autocomplete/history_url_provider.cc
parent387b71b7d1d1bf267cbe088136610959b319f3b3 (diff)
downloadchromium_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/history_url_provider.cc')
-rw-r--r--chrome/browser/autocomplete/history_url_provider.cc11
1 files changed, 7 insertions, 4 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.