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()), |