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

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

Issue 272573004: Handle TemplateURLService load failure better, and make some test correctness fixes that will be ne… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase after revert / presubmit fixes. Created 6 years, 7 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 | « chrome/browser/search_engines/template_url.h ('k') | chrome/browser/search_engines/template_url_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/search_engines/template_url.cc
diff --git a/chrome/browser/search_engines/template_url.cc b/chrome/browser/search_engines/template_url.cc
index 01a15dfd2c8c0011f41a3877e78729ea676f2e7e..4963eb2c3779f5f0f961e634b7708f3d6142c869 100644
--- a/chrome/browser/search_engines/template_url.cc
+++ b/chrome/browser/search_engines/template_url.cc
@@ -1122,6 +1122,33 @@ GURL TemplateURL::GenerateFaviconURL(const GURL& url) {
return url.ReplaceComponents(rep);
}
+// static
+bool TemplateURL::MatchesData(const TemplateURL* t_url,
+ const TemplateURLData* data) {
+ if (!t_url || !data)
+ return !t_url && !data;
+
+ return (t_url->short_name() == data->short_name) &&
+ t_url->HasSameKeywordAs(*data) &&
+ (t_url->url() == data->url()) &&
+ (t_url->suggestions_url() == data->suggestions_url) &&
+ (t_url->instant_url() == data->instant_url) &&
+ (t_url->image_url() == data->image_url) &&
+ (t_url->new_tab_url() == data->new_tab_url) &&
+ (t_url->search_url_post_params() == data->search_url_post_params) &&
+ (t_url->suggestions_url_post_params() ==
+ data->suggestions_url_post_params) &&
+ (t_url->instant_url_post_params() == data->instant_url_post_params) &&
+ (t_url->image_url_post_params() == data->image_url_post_params) &&
+ (t_url->favicon_url() == data->favicon_url) &&
+ (t_url->safe_for_autoreplace() == data->safe_for_autoreplace) &&
+ (t_url->show_in_default_list() == data->show_in_default_list) &&
+ (t_url->input_encodings() == data->input_encodings) &&
+ (t_url->alternate_urls() == data->alternate_urls) &&
+ (t_url->search_terms_replacement_key() ==
+ data->search_terms_replacement_key);
+}
+
base::string16 TemplateURL::AdjustedShortNameForLocaleDirection() const {
base::string16 bidi_safe_short_name = data_.short_name;
base::i18n::AdjustStringForLocaleDirection(&bidi_safe_short_name);
@@ -1142,6 +1169,14 @@ bool TemplateURL::SupportsReplacementUsingTermsData(
return url_ref_.SupportsReplacementUsingTermsData(search_terms_data);
}
+bool TemplateURL::HasGoogleBaseURLs() const {
+ return url_ref_.HasGoogleBaseURLs() ||
+ suggestions_url_ref_.HasGoogleBaseURLs() ||
+ instant_url_ref_.HasGoogleBaseURLs() ||
+ image_url_ref_.HasGoogleBaseURLs() ||
+ new_tab_url_ref_.HasGoogleBaseURLs();
+}
+
bool TemplateURL::IsGoogleSearchURLWithReplaceableKeyword() const {
return (GetType() == NORMAL) && url_ref_.HasGoogleBaseURLs() &&
google_util::IsGoogleHostname(base::UTF16ToUTF8(data_.keyword()),
« no previous file with comments | « chrome/browser/search_engines/template_url.h ('k') | chrome/browser/search_engines/template_url_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698