Chromium Code Reviews| Index: chrome/browser/search_engines/template_url.h |
| diff --git a/chrome/browser/search_engines/template_url.h b/chrome/browser/search_engines/template_url.h |
| index 32642205a7b20e5dcf9daa91520c31c2fe391c81..e79da9820875e174055a7e06d6120a11e13adae3 100644 |
| --- a/chrome/browser/search_engines/template_url.h |
| +++ b/chrome/browser/search_engines/template_url.h |
| @@ -19,6 +19,25 @@ class SearchTermsData; |
| class TemplateURL; |
| +// SearchTermsArgs ------------------------------------------------------------ |
|
Peter Kasting
2012/06/16 03:14:17
Nit: While I'm loathe to spoil the simplicity of t
Bart N
2012/06/16 23:38:10
Yes. I also think it makes more sense.
|
| + |
| +// This struct encapsulates arguments passed to |
| +// TemplateURLRef::ReplaceSearchTerms methods. By default, only search_terms |
| +// is required and is passed in the constructor. |
| +struct SearchTermsArgs { |
| + explicit SearchTermsArgs(const string16& search_terms); |
| + |
| + // The search terms (query). |
| + const string16 search_terms; |
| + // The original (input) query. |
| + string16 original_query; |
| + // Teh optional query stats, aka AQS, used for logging purposes. |
|
Peter Kasting
2012/06/16 03:14:17
Nit: Teh->The
Bart N
2012/06/16 23:38:10
Done.
|
| + string16 assisted_query_stats; |
|
Peter Kasting
2012/06/16 03:14:17
Use a std::string here. This isn't a UI string, a
Bart N
2012/06/16 23:38:10
Done.
|
| + |
| + // TODO: Remove along with "aq" CGI param. |
| + int accepted_suggestion; |
| +}; |
| + |
| // TemplateURLRef ------------------------------------------------------------- |
| // A TemplateURLRef represents a single URL within the larger TemplateURL class |
| @@ -62,22 +81,18 @@ class TemplateURLRef { |
| const SearchTermsData& search_terms_data) const; |
| // Returns a string that is the result of replacing the search terms in |
| - // the url with the specified value. We use our owner's input encoding. |
| + // the url with the specified arguments. We use our owner's input encoding. |
| // |
| // If this TemplateURLRef does not support replacement (SupportsReplacement |
| // returns false), an empty string is returned. |
| std::string ReplaceSearchTerms( |
| - const string16& terms, |
| - int accepted_suggestion, |
| - const string16& original_query_for_suggestion) const; |
| + const SearchTermsArgs& search_terms_args) const; |
| // Just like ReplaceSearchTerms except that it takes SearchTermsData to supply |
| // the data for some search terms. Most of the time ReplaceSearchTerms should |
| // be called. |
| std::string ReplaceSearchTermsUsingTermsData( |
| - const string16& terms, |
| - int accepted_suggestion, |
| - const string16& original_query_for_suggestion, |
| + const SearchTermsArgs& search_terms_args, |
| const SearchTermsData& search_terms_data) const; |
| // Returns true if the TemplateURLRef is valid. An invalid TemplateURLRef is |
| @@ -126,6 +141,7 @@ class TemplateURLRef { |
| enum ReplacementType { |
| ENCODING, |
| GOOGLE_ACCEPTED_SUGGESTION, |
| + GOOGLE_ASSISTED_QUERY_STATS, |
| GOOGLE_BASE_URL, |
| GOOGLE_BASE_SUGGEST_URL, |
| GOOGLE_INSTANT_ENABLED, |