summaryrefslogtreecommitdiffstats
path: root/chrome/browser/template_url_parser.cc
diff options
context:
space:
mode:
authorsky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-12 17:28:12 +0000
committersky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-12 17:28:12 +0000
commit187f9ad7e4dd8eda57744b6100ff35990e21a4a6 (patch)
tree149548c73c9c0ac8a151f472dd626f09813d1b69 /chrome/browser/template_url_parser.cc
parent0435f737a39aa8d6a0b8d567264dbfd02242c0d9 (diff)
downloadchromium_src-187f9ad7e4dd8eda57744b6100ff35990e21a4a6.zip
chromium_src-187f9ad7e4dd8eda57744b6100ff35990e21a4a6.tar.gz
chromium_src-187f9ad7e4dd8eda57744b6100ff35990e21a4a6.tar.bz2
Allows OSDD files to contain https.
BUG=2153 TEST=covered by unit tests Review URL: http://codereview.chromium.org/2454 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2119 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/template_url_parser.cc')
-rw-r--r--chrome/browser/template_url_parser.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/chrome/browser/template_url_parser.cc b/chrome/browser/template_url_parser.cc
index f87692b..8c4f8be 100644
--- a/chrome/browser/template_url_parser.cc
+++ b/chrome/browser/template_url_parser.cc
@@ -518,16 +518,16 @@ void CharactersImpl(void *ctx, const xmlChar *ch, int len) {
}
// Returns true if the ref is null, or the url wrapped by ref is
-// valid with a spec of http.
+// valid with a spec of http/https.
bool IsHTTPRef(const TemplateURLRef* ref) {
if (ref == NULL)
return true;
GURL url(ref->url());
- return (url.is_valid() && url.SchemeIs("http"));
+ return (url.is_valid() && (url.SchemeIs("http") || url.SchemeIs("https")));
}
// Returns true if the TemplateURL is legal. A legal TemplateURL is one
-// where all URLs have a spec of http.
+// where all URLs have a spec of http/https.
bool IsLegal(TemplateURL* url) {
if (!IsHTTPRef(url->url()) || !IsHTTPRef(url->suggestions_url()))
return false;
@@ -535,8 +535,10 @@ bool IsLegal(TemplateURL* url) {
const std::vector<TemplateURL::ImageRef>& image_refs = url->image_refs();
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"))
+ if (!image_url.is_valid() ||
+ !(image_url.SchemeIs("http") || image_url.SchemeIs("https"))) {
return false;
+ }
}
return true;
}