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 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 | 653 |
654 // Given a |url| corresponding to this TemplateURL, identifies the search | 654 // Given a |url| corresponding to this TemplateURL, identifies the search |
655 // terms and replaces them with the ones in |search_terms_args|, leaving the | 655 // terms and replaces them with the ones in |search_terms_args|, leaving the |
656 // other parameters untouched. If the replacement fails, returns false and | 656 // other parameters untouched. If the replacement fails, returns false and |
657 // leaves |result| untouched. This is used by mobile ports to perform query | 657 // leaves |result| untouched. This is used by mobile ports to perform query |
658 // refinement. | 658 // refinement. |
659 bool ReplaceSearchTermsInURL( | 659 bool ReplaceSearchTermsInURL( |
660 const GURL& url, | 660 const GURL& url, |
661 const TemplateURLRef::SearchTermsArgs& search_terms_args, | 661 const TemplateURLRef::SearchTermsArgs& search_terms_args, |
662 const SearchTermsData& search_terms_data, | 662 const SearchTermsData& search_terms_data, |
663 GURL* result); | 663 GURL* result) const; |
664 | 664 |
665 // Encodes the search terms from |search_terms_args| so that we know the | 665 // Encodes the search terms from |search_terms_args| so that we know the |
666 // |input_encoding|. Returns the |encoded_terms| and the | 666 // |input_encoding|. Returns the |encoded_terms| and the |
667 // |encoded_original_query|. |encoded_terms| may be escaped as path or query | 667 // |encoded_original_query|. |encoded_terms| may be escaped as path or query |
668 // depending on |is_in_query|; |encoded_original_query| is always escaped as | 668 // depending on |is_in_query|; |encoded_original_query| is always escaped as |
669 // query. | 669 // query. |
670 void EncodeSearchTerms( | 670 void EncodeSearchTerms( |
671 const TemplateURLRef::SearchTermsArgs& search_terms_args, | 671 const TemplateURLRef::SearchTermsArgs& search_terms_args, |
672 bool is_in_query, | 672 bool is_in_query, |
673 std::string* input_encoding, | 673 std::string* input_encoding, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 | 733 |
734 // Caches the computed engine type across successive calls to GetEngineType(). | 734 // Caches the computed engine type across successive calls to GetEngineType(). |
735 mutable SearchEngineType engine_type_; | 735 mutable SearchEngineType engine_type_; |
736 | 736 |
737 // TODO(sky): Add date last parsed OSD file. | 737 // TODO(sky): Add date last parsed OSD file. |
738 | 738 |
739 DISALLOW_COPY_AND_ASSIGN(TemplateURL); | 739 DISALLOW_COPY_AND_ASSIGN(TemplateURL); |
740 }; | 740 }; |
741 | 741 |
742 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_ | 742 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_ |
OLD | NEW |