summaryrefslogtreecommitdiffstats
path: root/chrome/browser/search_engines
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/search_engines
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/search_engines')
-rw-r--r--chrome/browser/search_engines/template_url_model.cc3
-rw-r--r--chrome/browser/search_engines/template_url_parser.cc9
2 files changed, 8 insertions, 4 deletions
diff --git a/chrome/browser/search_engines/template_url_model.cc b/chrome/browser/search_engines/template_url_model.cc
index c1a4415..316ad80 100644
--- a/chrome/browser/search_engines/template_url_model.cc
+++ b/chrome/browser/search_engines/template_url_model.cc
@@ -20,6 +20,7 @@
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "chrome/common/stl_util-inl.h"
+#include "chrome/common/url_constants.h"
#include "googleurl/src/gurl.h"
#include "googleurl/src/url_parse.h"
#include "grit/locale_settings.h"
@@ -159,7 +160,7 @@ std::wstring TemplateURLModel::GenerateKeyword(const GURL& url,
// elements and update AutocompletePopup to look for keywords using the path.
// See http://b/issue?id=863583.
if (!url.is_valid() ||
- (autodetected && (url.has_query() || (url.scheme() != "http") ||
+ (autodetected && (url.has_query() || !url.SchemeIs(chrome::kHttpScheme) ||
((url.path() != "") && (url.path() != "/")))))
return std::wstring();
diff --git a/chrome/browser/search_engines/template_url_parser.cc b/chrome/browser/search_engines/template_url_parser.cc
index c3d6c7e..0bec982 100644
--- a/chrome/browser/search_engines/template_url_parser.cc
+++ b/chrome/browser/search_engines/template_url_parser.cc
@@ -11,6 +11,7 @@
#include "base/scoped_ptr.h"
#include "base/string_util.h"
#include "chrome/browser/search_engines/template_url.h"
+#include "chrome/common/url_constants.h"
#include "googleurl/src/gurl.h"
#include "libxml/parser.h"
#include "libxml/xmlwriter.h"
@@ -482,7 +483,7 @@ void EndElementImpl(void *ctx, const xmlChar *name) {
break;
case ParsingContext::IMAGE: {
GURL image_url(WideToUTF8(context->GetString()));
- if (image_url.SchemeIs("data")) {
+ if (image_url.SchemeIs(chrome::kDataScheme)) {
// TODO (jcampan): bug 1169256: when dealing with data URL, we need to
// decode the data URL in the renderer. For now, we'll just point to the
// fav icon from the URL.
@@ -523,7 +524,8 @@ bool IsHTTPRef(const TemplateURLRef* ref) {
if (ref == NULL)
return true;
GURL url(WideToUTF8(ref->url()));
- return (url.is_valid() && (url.SchemeIs("http") || url.SchemeIs("https")));
+ return (url.is_valid() && (url.SchemeIs(chrome::kHttpScheme) ||
+ url.SchemeIs(chrome::kHttpsScheme)));
}
// Returns true if the TemplateURL is legal. A legal TemplateURL is one
@@ -536,7 +538,8 @@ bool IsLegal(TemplateURL* url) {
for (size_t i = 0; i < image_refs.size(); i++) {
GURL image_url(image_refs[i].url);
if (!image_url.is_valid() ||
- !(image_url.SchemeIs("http") || image_url.SchemeIs("https"))) {
+ !(image_url.SchemeIs(chrome::kHttpScheme) ||
+ image_url.SchemeIs(chrome::kHttpsScheme))) {
return false;
}
}