OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_ | 5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_ |
6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_ | 6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 OMNIBOX_API_EXTENSION, | 560 OMNIBOX_API_EXTENSION, |
561 }; | 561 }; |
562 // |profile| may be NULL. This will affect the results of e.g. calling | 562 // |profile| may be NULL. This will affect the results of e.g. calling |
563 // ReplaceSearchTerms() on the member TemplateURLRefs. | 563 // ReplaceSearchTerms() on the member TemplateURLRefs. |
564 TemplateURL(Profile* profile, const TemplateURLData& data); | 564 TemplateURL(Profile* profile, const TemplateURLData& data); |
565 ~TemplateURL(); | 565 ~TemplateURL(); |
566 | 566 |
567 // Generates a favicon URL from the specified url. | 567 // Generates a favicon URL from the specified url. |
568 static GURL GenerateFaviconURL(const GURL& url); | 568 static GURL GenerateFaviconURL(const GURL& url); |
569 | 569 |
570 // Returns true if |t_url| and |data| are equal in all meaningful respects. | |
571 // Static to allow either or both params to be NULL. | |
572 static bool MatchesData(const TemplateURL* t_url, | |
573 const TemplateURLData* data); | |
574 | |
575 Profile* profile() { return profile_; } | 570 Profile* profile() { return profile_; } |
576 const TemplateURLData& data() const { return data_; } | 571 const TemplateURLData& data() const { return data_; } |
577 | 572 |
578 const base::string16& short_name() const { return data_.short_name; } | 573 const base::string16& short_name() const { return data_.short_name; } |
579 // An accessor for the short_name, but adjusted so it can be appropriately | 574 // An accessor for the short_name, but adjusted so it can be appropriately |
580 // displayed even if it is LTR and the UI is RTL. | 575 // displayed even if it is LTR and the UI is RTL. |
581 base::string16 AdjustedShortNameForLocaleDirection() const; | 576 base::string16 AdjustedShortNameForLocaleDirection() const; |
582 | 577 |
583 const base::string16& keyword() const { return data_.keyword(); } | 578 const base::string16& keyword() const { return data_.keyword(); } |
584 | 579 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 const TemplateURLRef& image_url_ref() const { return image_url_ref_; } | 638 const TemplateURLRef& image_url_ref() const { return image_url_ref_; } |
644 const TemplateURLRef& new_tab_url_ref() const { return new_tab_url_ref_; } | 639 const TemplateURLRef& new_tab_url_ref() const { return new_tab_url_ref_; } |
645 | 640 |
646 // Returns true if |url| supports replacement. | 641 // Returns true if |url| supports replacement. |
647 bool SupportsReplacement() const; | 642 bool SupportsReplacement() const; |
648 | 643 |
649 // Like SupportsReplacement but usable on threads other than the UI thread. | 644 // Like SupportsReplacement but usable on threads other than the UI thread. |
650 bool SupportsReplacementUsingTermsData( | 645 bool SupportsReplacementUsingTermsData( |
651 const SearchTermsData& search_terms_data) const; | 646 const SearchTermsData& search_terms_data) const; |
652 | 647 |
653 // Returns true if any URLRefs use Googe base URLs. | |
654 bool HasGoogleBaseURLs() const; | |
655 | |
656 // Returns true if this TemplateURL uses Google base URLs and has a keyword | 648 // Returns true if this TemplateURL uses Google base URLs and has a keyword |
657 // of "google.TLD". We use this to decide whether we can automatically | 649 // of "google.TLD". We use this to decide whether we can automatically |
658 // update the keyword to reflect the current Google base URL TLD. | 650 // update the keyword to reflect the current Google base URL TLD. |
659 bool IsGoogleSearchURLWithReplaceableKeyword() const; | 651 bool IsGoogleSearchURLWithReplaceableKeyword() const; |
660 | 652 |
661 // Returns true if the keywords match or if | 653 // Returns true if the keywords match or if |
662 // IsGoogleSearchURLWithReplaceableKeyword() is true for both |this| and | 654 // IsGoogleSearchURLWithReplaceableKeyword() is true for both |this| and |
663 // |other|. | 655 // |other|. |
664 bool HasSameKeywordAs(const TemplateURLData& other) const; | 656 bool HasSameKeywordAs(const TemplateURLData& other) const; |
665 | 657 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 TemplateURLRef image_url_ref_; | 765 TemplateURLRef image_url_ref_; |
774 TemplateURLRef new_tab_url_ref_; | 766 TemplateURLRef new_tab_url_ref_; |
775 scoped_ptr<AssociatedExtensionInfo> extension_info_; | 767 scoped_ptr<AssociatedExtensionInfo> extension_info_; |
776 | 768 |
777 // TODO(sky): Add date last parsed OSD file. | 769 // TODO(sky): Add date last parsed OSD file. |
778 | 770 |
779 DISALLOW_COPY_AND_ASSIGN(TemplateURL); | 771 DISALLOW_COPY_AND_ASSIGN(TemplateURL); |
780 }; | 772 }; |
781 | 773 |
782 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_ | 774 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_ |
OLD | NEW |