| 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 |
| 570 Profile* profile() { return profile_; } | 575 Profile* profile() { return profile_; } |
| 571 const TemplateURLData& data() const { return data_; } | 576 const TemplateURLData& data() const { return data_; } |
| 572 | 577 |
| 573 const base::string16& short_name() const { return data_.short_name; } | 578 const base::string16& short_name() const { return data_.short_name; } |
| 574 // An accessor for the short_name, but adjusted so it can be appropriately | 579 // An accessor for the short_name, but adjusted so it can be appropriately |
| 575 // displayed even if it is LTR and the UI is RTL. | 580 // displayed even if it is LTR and the UI is RTL. |
| 576 base::string16 AdjustedShortNameForLocaleDirection() const; | 581 base::string16 AdjustedShortNameForLocaleDirection() const; |
| 577 | 582 |
| 578 const base::string16& keyword() const { return data_.keyword(); } | 583 const base::string16& keyword() const { return data_.keyword(); } |
| 579 | 584 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 const TemplateURLRef& image_url_ref() const { return image_url_ref_; } | 643 const TemplateURLRef& image_url_ref() const { return image_url_ref_; } |
| 639 const TemplateURLRef& new_tab_url_ref() const { return new_tab_url_ref_; } | 644 const TemplateURLRef& new_tab_url_ref() const { return new_tab_url_ref_; } |
| 640 | 645 |
| 641 // Returns true if |url| supports replacement. | 646 // Returns true if |url| supports replacement. |
| 642 bool SupportsReplacement() const; | 647 bool SupportsReplacement() const; |
| 643 | 648 |
| 644 // Like SupportsReplacement but usable on threads other than the UI thread. | 649 // Like SupportsReplacement but usable on threads other than the UI thread. |
| 645 bool SupportsReplacementUsingTermsData( | 650 bool SupportsReplacementUsingTermsData( |
| 646 const SearchTermsData& search_terms_data) const; | 651 const SearchTermsData& search_terms_data) const; |
| 647 | 652 |
| 653 // Returns true if any URLRefs use Googe base URLs. |
| 654 bool HasGoogleBaseURLs() const; |
| 655 |
| 648 // Returns true if this TemplateURL uses Google base URLs and has a keyword | 656 // Returns true if this TemplateURL uses Google base URLs and has a keyword |
| 649 // of "google.TLD". We use this to decide whether we can automatically | 657 // of "google.TLD". We use this to decide whether we can automatically |
| 650 // update the keyword to reflect the current Google base URL TLD. | 658 // update the keyword to reflect the current Google base URL TLD. |
| 651 bool IsGoogleSearchURLWithReplaceableKeyword() const; | 659 bool IsGoogleSearchURLWithReplaceableKeyword() const; |
| 652 | 660 |
| 653 // Returns true if the keywords match or if | 661 // Returns true if the keywords match or if |
| 654 // IsGoogleSearchURLWithReplaceableKeyword() is true for both |this| and | 662 // IsGoogleSearchURLWithReplaceableKeyword() is true for both |this| and |
| 655 // |other|. | 663 // |other|. |
| 656 bool HasSameKeywordAs(const TemplateURLData& other) const; | 664 bool HasSameKeywordAs(const TemplateURLData& other) const; |
| 657 | 665 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 TemplateURLRef image_url_ref_; | 773 TemplateURLRef image_url_ref_; |
| 766 TemplateURLRef new_tab_url_ref_; | 774 TemplateURLRef new_tab_url_ref_; |
| 767 scoped_ptr<AssociatedExtensionInfo> extension_info_; | 775 scoped_ptr<AssociatedExtensionInfo> extension_info_; |
| 768 | 776 |
| 769 // TODO(sky): Add date last parsed OSD file. | 777 // TODO(sky): Add date last parsed OSD file. |
| 770 | 778 |
| 771 DISALLOW_COPY_AND_ASSIGN(TemplateURL); | 779 DISALLOW_COPY_AND_ASSIGN(TemplateURL); |
| 772 }; | 780 }; |
| 773 | 781 |
| 774 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_ | 782 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_ |
| OLD | NEW |