| 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 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 bool HasSameKeywordAs(const TemplateURLData& other, | 637 bool HasSameKeywordAs(const TemplateURLData& other, |
| 638 const SearchTermsData& search_terms_data) const; | 638 const SearchTermsData& search_terms_data) const; |
| 639 | 639 |
| 640 Type GetType() const; | 640 Type GetType() const; |
| 641 | 641 |
| 642 // Returns the id of the extension that added this search engine. Only call | 642 // Returns the id of the extension that added this search engine. Only call |
| 643 // this for TemplateURLs of type NORMAL_CONTROLLED_BY_EXTENSION or | 643 // this for TemplateURLs of type NORMAL_CONTROLLED_BY_EXTENSION or |
| 644 // OMNIBOX_API_EXTENSION. | 644 // OMNIBOX_API_EXTENSION. |
| 645 std::string GetExtensionId() const; | 645 std::string GetExtensionId() const; |
| 646 | 646 |
| 647 // Returns the type of this search engine, or SEARCH_ENGINE_OTHER if no |
| 648 // engines match. |
| 649 SearchEngineType GetEngineType( |
| 650 const SearchTermsData& search_terms_data) const; |
| 651 |
| 647 // Use the alternate URLs and the search URL to match the provided |url| | 652 // Use the alternate URLs and the search URL to match the provided |url| |
| 648 // and extract |search_terms| from it. Returns false and an empty | 653 // and extract |search_terms| from it. Returns false and an empty |
| 649 // |search_terms| if no search terms can be matched. The order in which the | 654 // |search_terms| if no search terms can be matched. The order in which the |
| 650 // alternate URLs are listed dictates their priority, the URL at index 0 is | 655 // alternate URLs are listed dictates their priority, the URL at index 0 is |
| 651 // treated as the highest priority and the primary search URL is treated as | 656 // treated as the highest priority and the primary search URL is treated as |
| 652 // the lowest priority. For example, if a TemplateURL has alternate URL | 657 // the lowest priority. For example, if a TemplateURL has alternate URL |
| 653 // "http://foo/#q={searchTerms}" and search URL "http://foo/?q={searchTerms}", | 658 // "http://foo/#q={searchTerms}" and search URL "http://foo/?q={searchTerms}", |
| 654 // and the URL to be decoded is "http://foo/?q=a#q=b", the alternate URL will | 659 // and the URL to be decoded is "http://foo/?q=a#q=b", the alternate URL will |
| 655 // match first and the decoded search term will be "b". | 660 // match first and the decoded search term will be "b". |
| 656 bool ExtractSearchTermsFromURL(const GURL& url, | 661 bool ExtractSearchTermsFromURL(const GURL& url, |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 TemplateURLRef new_tab_url_ref_; | 753 TemplateURLRef new_tab_url_ref_; |
| 749 TemplateURLRef contextual_search_url_ref_; | 754 TemplateURLRef contextual_search_url_ref_; |
| 750 std::unique_ptr<AssociatedExtensionInfo> extension_info_; | 755 std::unique_ptr<AssociatedExtensionInfo> extension_info_; |
| 751 | 756 |
| 752 // TODO(sky): Add date last parsed OSD file. | 757 // TODO(sky): Add date last parsed OSD file. |
| 753 | 758 |
| 754 DISALLOW_COPY_AND_ASSIGN(TemplateURL); | 759 DISALLOW_COPY_AND_ASSIGN(TemplateURL); |
| 755 }; | 760 }; |
| 756 | 761 |
| 757 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_ | 762 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_ |
| OLD | NEW |