| 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 #ifndef COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_ | 5 #ifndef COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_ |
| 6 #define COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_ | 6 #define COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 | 505 |
| 506 // Generates a favicon URL from the specified url. | 506 // Generates a favicon URL from the specified url. |
| 507 static GURL GenerateFaviconURL(const GURL& url); | 507 static GURL GenerateFaviconURL(const GURL& url); |
| 508 | 508 |
| 509 // Returns true if |t_url| and |data| are equal in all meaningful respects. | 509 // Returns true if |t_url| and |data| are equal in all meaningful respects. |
| 510 // Static to allow either or both params to be NULL. | 510 // Static to allow either or both params to be NULL. |
| 511 static bool MatchesData(const TemplateURL* t_url, | 511 static bool MatchesData(const TemplateURL* t_url, |
| 512 const TemplateURLData* data, | 512 const TemplateURLData* data, |
| 513 const SearchTermsData& search_terms_data); | 513 const SearchTermsData& search_terms_data); |
| 514 | 514 |
| 515 // Special case for search_terms_replacement_key comparison, because of |
| 516 // its special initialization in TemplateURL constructor. |
| 517 static bool SearchTermsReplacementKeysMatch(const std::string& key1, |
| 518 const std::string& key2); |
| 519 |
| 515 const TemplateURLData& data() const { return data_; } | 520 const TemplateURLData& data() const { return data_; } |
| 516 | 521 |
| 517 const base::string16& short_name() const { return data_.short_name(); } | 522 const base::string16& short_name() const { return data_.short_name(); } |
| 518 // An accessor for the short_name, but adjusted so it can be appropriately | 523 // An accessor for the short_name, but adjusted so it can be appropriately |
| 519 // displayed even if it is LTR and the UI is RTL. | 524 // displayed even if it is LTR and the UI is RTL. |
| 520 base::string16 AdjustedShortNameForLocaleDirection() const; | 525 base::string16 AdjustedShortNameForLocaleDirection() const; |
| 521 | 526 |
| 522 const base::string16& keyword() const { return data_.keyword(); } | 527 const base::string16& keyword() const { return data_.keyword(); } |
| 523 | 528 |
| 524 const std::string& url() const { return data_.url(); } | 529 const std::string& url() const { return data_.url(); } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 } | 585 } |
| 581 const TemplateURLRef& instant_url_ref() const { return instant_url_ref_; } | 586 const TemplateURLRef& instant_url_ref() const { return instant_url_ref_; } |
| 582 const TemplateURLRef& image_url_ref() const { return image_url_ref_; } | 587 const TemplateURLRef& image_url_ref() const { return image_url_ref_; } |
| 583 const TemplateURLRef& new_tab_url_ref() const { return new_tab_url_ref_; } | 588 const TemplateURLRef& new_tab_url_ref() const { return new_tab_url_ref_; } |
| 584 const TemplateURLRef& contextual_search_url_ref() const { | 589 const TemplateURLRef& contextual_search_url_ref() const { |
| 585 return contextual_search_url_ref_; | 590 return contextual_search_url_ref_; |
| 586 } | 591 } |
| 587 | 592 |
| 588 Type type() const { return type_; } | 593 Type type() const { return type_; } |
| 589 | 594 |
| 590 // This setter shouldn't be used except by TemplateURLService and | 595 const AssociatedExtensionInfo* GetExtensionInfoForTesting() const { |
| 591 // TemplateURLServiceClient implementations. | 596 return extension_info_.get(); |
| 592 void set_extension_info( | |
| 593 std::unique_ptr<AssociatedExtensionInfo> extension_info) { | |
| 594 extension_info_ = std::move(extension_info); | |
| 595 } | 597 } |
| 596 | 598 |
| 597 // Returns true if |url| supports replacement. | 599 // Returns true if |url| supports replacement. |
| 598 bool SupportsReplacement(const SearchTermsData& search_terms_data) const; | 600 bool SupportsReplacement(const SearchTermsData& search_terms_data) const; |
| 599 | 601 |
| 600 // Returns true if any URLRefs use Googe base URLs. | 602 // Returns true if any URLRefs use Googe base URLs. |
| 601 bool HasGoogleBaseURLs(const SearchTermsData& search_terms_data) const; | 603 bool HasGoogleBaseURLs(const SearchTermsData& search_terms_data) const; |
| 602 | 604 |
| 603 // Returns true if this TemplateURL uses Google base URLs and has a keyword | 605 // Returns true if this TemplateURL uses Google base URLs and has a keyword |
| 604 // of "google.TLD". We use this to decide whether we can automatically | 606 // of "google.TLD". We use this to decide whether we can automatically |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 | 733 |
| 732 // Caches the computed engine type across successive calls to GetEngineType(). | 734 // Caches the computed engine type across successive calls to GetEngineType(). |
| 733 mutable SearchEngineType engine_type_; | 735 mutable SearchEngineType engine_type_; |
| 734 | 736 |
| 735 // TODO(sky): Add date last parsed OSD file. | 737 // TODO(sky): Add date last parsed OSD file. |
| 736 | 738 |
| 737 DISALLOW_COPY_AND_ASSIGN(TemplateURL); | 739 DISALLOW_COPY_AND_ASSIGN(TemplateURL); |
| 738 }; | 740 }; |
| 739 | 741 |
| 740 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_ | 742 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_ |
| OLD | NEW |