Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6096)

Unified Diff: chrome/browser/autocomplete/history_url_provider.cc

Issue 31008: Coalesce more hardcoded schemes to using predefined constants. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/autocomplete/search_provider.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autocomplete/history_url_provider.cc
===================================================================
--- chrome/browser/autocomplete/history_url_provider.cc (revision 10345)
+++ chrome/browser/autocomplete/history_url_provider.cc (working copy)
@@ -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 @@
// 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 @@
// 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 @@
// 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.
« no previous file with comments | « no previous file | chrome/browser/autocomplete/search_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698