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

Unified Diff: chrome/browser/search_engines/template_url_parser.cc

Issue 9968016: Move the URL string from TemplateURLRef onto the owning TemplateURL. This will make it easier to m… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 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
Index: chrome/browser/search_engines/template_url_parser.cc
===================================================================
--- chrome/browser/search_engines/template_url_parser.cc (revision 130285)
+++ chrome/browser/search_engines/template_url_parser.cc (working copy)
@@ -94,14 +94,13 @@
query->append(value);
}
-// Returns true if the ref is null, or the url wrapped by ref is
-// valid with a spec of http/https.
-bool IsHTTPRef(const TemplateURLRef* ref) {
- if (ref == NULL)
+// Returns true if |url| is empty or is a valid URL with a scheme of HTTP[S].
+bool IsHTTPRef(const std::string& url) {
+ if (url.empty())
return true;
- GURL url(ref->url());
- return (url.is_valid() && (url.SchemeIs(chrome::kHttpScheme) ||
- url.SchemeIs(chrome::kHttpsScheme)));
+ GURL gurl(url);
+ return (gurl.is_valid() && (gurl.SchemeIs(chrome::kHttpScheme) ||
+ gurl.SchemeIs(chrome::kHttpsScheme)));
}
} // namespace
@@ -299,7 +298,7 @@
// If the image was a data URL, use the favicon from the search URL instead.
// (see TODO inEndElementImpl()).
- GURL url(url_->url()->url());
+ GURL url(url_->url());
if (derive_image_from_url_ && url_->favicon_url().is_empty())
url_->set_favicon_url(TemplateURL::GenerateFaviconURL(url));
@@ -414,11 +413,10 @@
if (!parameter_filter_ && extra_params_.empty())
return;
- const TemplateURLRef* t_url_ref =
- is_suggest_url_ ? url_->suggestions_url() : url_->url();
- if (!t_url_ref)
+ GURL url(is_suggest_url_ ? url_->suggestions_url() : url_->url());
+ if (url.is_empty())
return;
- GURL url(t_url_ref->url());
+
// If there is a parameter filter, parse the existing URL and remove any
// unwanted parameter.
std::string new_query;

Powered by Google App Engine
This is Rietveld 408576698