OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/search_engines/template_url.h" | 5 #include "components/search_engines/template_url.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1246 (t_url->instant_url() == data->instant_url) && | 1246 (t_url->instant_url() == data->instant_url) && |
1247 (t_url->image_url() == data->image_url) && | 1247 (t_url->image_url() == data->image_url) && |
1248 (t_url->new_tab_url() == data->new_tab_url) && | 1248 (t_url->new_tab_url() == data->new_tab_url) && |
1249 (t_url->search_url_post_params() == data->search_url_post_params) && | 1249 (t_url->search_url_post_params() == data->search_url_post_params) && |
1250 (t_url->suggestions_url_post_params() == | 1250 (t_url->suggestions_url_post_params() == |
1251 data->suggestions_url_post_params) && | 1251 data->suggestions_url_post_params) && |
1252 (t_url->instant_url_post_params() == data->instant_url_post_params) && | 1252 (t_url->instant_url_post_params() == data->instant_url_post_params) && |
1253 (t_url->image_url_post_params() == data->image_url_post_params) && | 1253 (t_url->image_url_post_params() == data->image_url_post_params) && |
1254 (t_url->favicon_url() == data->favicon_url) && | 1254 (t_url->favicon_url() == data->favicon_url) && |
1255 (t_url->safe_for_autoreplace() == data->safe_for_autoreplace) && | 1255 (t_url->safe_for_autoreplace() == data->safe_for_autoreplace) && |
1256 (t_url->show_in_default_list() == data->show_in_default_list) && | |
1257 (t_url->input_encodings() == data->input_encodings) && | 1256 (t_url->input_encodings() == data->input_encodings) && |
1258 (t_url->alternate_urls() == data->alternate_urls) && | 1257 (t_url->alternate_urls() == data->alternate_urls) && |
1259 (t_url->search_terms_replacement_key() == | 1258 (t_url->search_terms_replacement_key() == |
1260 data->search_terms_replacement_key); | 1259 data->search_terms_replacement_key); |
1261 } | 1260 } |
1262 | 1261 |
1263 base::string16 TemplateURL::AdjustedShortNameForLocaleDirection() const { | 1262 base::string16 TemplateURL::AdjustedShortNameForLocaleDirection() const { |
1264 base::string16 bidi_safe_short_name = data_.short_name(); | 1263 base::string16 bidi_safe_short_name = data_.short_name(); |
1265 base::i18n::AdjustStringForLocaleDirection(&bidi_safe_short_name); | 1264 base::i18n::AdjustStringForLocaleDirection(&bidi_safe_short_name); |
1266 return bidi_safe_short_name; | 1265 return bidi_safe_short_name; |
1267 } | 1266 } |
1268 | 1267 |
1269 bool TemplateURL::ShowInDefaultList( | |
1270 const SearchTermsData& search_terms_data) const { | |
1271 return data_.show_in_default_list && | |
1272 url_ref_->SupportsReplacement(search_terms_data); | |
1273 } | |
1274 | |
1275 bool TemplateURL::SupportsReplacement( | 1268 bool TemplateURL::SupportsReplacement( |
1276 const SearchTermsData& search_terms_data) const { | 1269 const SearchTermsData& search_terms_data) const { |
1277 return url_ref_->SupportsReplacement(search_terms_data); | 1270 return url_ref_->SupportsReplacement(search_terms_data); |
1278 } | 1271 } |
1279 | 1272 |
1280 bool TemplateURL::HasGoogleBaseURLs( | 1273 bool TemplateURL::HasGoogleBaseURLs( |
1281 const SearchTermsData& search_terms_data) const { | 1274 const SearchTermsData& search_terms_data) const { |
1282 for (const TemplateURLRef& ref : url_refs_) { | 1275 for (const TemplateURLRef& ref : url_refs_) { |
1283 if (ref.HasGoogleBaseURLs(search_terms_data)) | 1276 if (ref.HasGoogleBaseURLs(search_terms_data)) |
1284 return true; | 1277 return true; |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1531 // patterns. This means that given patterns | 1524 // patterns. This means that given patterns |
1532 // [ "http://foo/#q={searchTerms}", "http://foo/?q={searchTerms}" ], | 1525 // [ "http://foo/#q={searchTerms}", "http://foo/?q={searchTerms}" ], |
1533 // calling ExtractSearchTermsFromURL() on "http://foo/?q=bar#q=' would | 1526 // calling ExtractSearchTermsFromURL() on "http://foo/?q=bar#q=' would |
1534 // return false. This is important for at least Google, where such URLs | 1527 // return false. This is important for at least Google, where such URLs |
1535 // are invalid. | 1528 // are invalid. |
1536 return !search_terms->empty(); | 1529 return !search_terms->empty(); |
1537 } | 1530 } |
1538 } | 1531 } |
1539 return false; | 1532 return false; |
1540 } | 1533 } |
OLD | NEW |