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 67f27cacea1cc0e39eaa7ab49d562489c9c2ea45..bffd3e69676f9b734129e8c8502d1d47706f4465 100644 |
| --- a/chrome/browser/search_engines/template_url.h |
| +++ b/chrome/browser/search_engines/template_url.h |
| @@ -53,6 +53,7 @@ class TemplateURLRef { |
| INSTANT, |
| IMAGE, |
| NEW_TAB, |
| + CONTEXTUAL_SEARCH, |
| INDEXED |
| }; |
| @@ -70,6 +71,29 @@ class TemplateURLRef { |
| explicit SearchTermsArgs(const base::string16& search_terms); |
| ~SearchTermsArgs(); |
| + struct ContextualSearchParams { |
| + ContextualSearchParams() : version(-1), start(-1), end(-1) { |
|
Peter Kasting
2014/06/04 00:40:49
It's surprising you don't have a 6-arg variant to
jeremycho
2014/06/04 21:49:35
If it's being used in a /search, then only version
|
| + } |
| + |
| + // The version of contextual search. |
| + int version; |
| + |
| + // Offset into content of the start of the user selection. |
| + int start; |
|
Peter Kasting
2014/06/04 00:40:49
These should probably be size_ts and use npos to r
jeremycho
2014/06/04 21:49:35
Done.
|
| + |
| + // Offset into content of the end of the user selection. |
| + int end; |
| + |
| + // The text including and surrounding the user selection. |
| + std::string content; |
| + |
| + // The URL of the page containing the user selection. |
| + std::string base_page_url; |
| + |
| + // The encoding of content. |
| + std::string encoding; |
| + }; |
| + |
| // The search terms (query). |
| base::string16 search_terms; |
| @@ -140,6 +164,8 @@ class TemplateURLRef { |
| // True if the search was made using the app list search box. Otherwise, the |
| // search was made using the omnibox. |
| bool from_app_list; |
| + |
| + ContextualSearchParams contextual_search_params; |
| }; |
| TemplateURLRef(TemplateURL* owner, Type type); |
| @@ -271,6 +297,12 @@ class TemplateURLRef { |
| GOOGLE_INSTANT_EXTENDED_ENABLED, |
| GOOGLE_NTP_IS_THEMED, |
| GOOGLE_OMNIBOX_START_MARGIN, |
| + GOOGLE_CONTEXTUAL_SEARCH_VERSION, |
| + GOOGLE_CONTEXTUAL_SEARCH_START, |
| + GOOGLE_CONTEXTUAL_SEARCH_END, |
| + GOOGLE_CONTEXTUAL_SEARCH_CONTENT, |
| + GOOGLE_CONTEXTUAL_SEARCH_BASE_PAGE_URL, |
| + GOOGLE_CONTEXTUAL_SEARCH_ENCODING, |
| GOOGLE_ORIGINAL_QUERY_FOR_SUGGESTION, |
| GOOGLE_PAGE_CLASSIFICATION, |
| GOOGLE_RLZ, |
| @@ -444,6 +476,7 @@ struct TemplateURLData { |
| std::string instant_url; |
| std::string image_url; |
| std::string new_tab_url; |
| + std::string contextual_search_url; |
| // The following post_params are comma-separated lists used to specify the |
| // post parameters for the corresponding URL. |
| @@ -591,6 +624,9 @@ class TemplateURL { |
| const std::string& instant_url() const { return data_.instant_url; } |
| const std::string& image_url() const { return data_.image_url; } |
| const std::string& new_tab_url() const { return data_.new_tab_url; } |
| + const std::string& contextual_search_url() const { |
| + return data_.contextual_search_url; |
| + } |
| const std::string& search_url_post_params() const { |
| return data_.search_url_post_params; |
| } |
| @@ -646,6 +682,9 @@ class TemplateURL { |
| const TemplateURLRef& instant_url_ref() const { return instant_url_ref_; } |
| const TemplateURLRef& image_url_ref() const { return image_url_ref_; } |
| const TemplateURLRef& new_tab_url_ref() const { return new_tab_url_ref_; } |
| + const TemplateURLRef& contextual_search_url_ref() const { |
| + return contextual_search_url_ref_; |
| + } |
| // Returns true if |url| supports replacement. |
| bool SupportsReplacement() const; |
| @@ -776,6 +815,7 @@ class TemplateURL { |
| TemplateURLRef instant_url_ref_; |
| TemplateURLRef image_url_ref_; |
| TemplateURLRef new_tab_url_ref_; |
| + TemplateURLRef contextual_search_url_ref_; |
| scoped_ptr<AssociatedExtensionInfo> extension_info_; |
| // TODO(sky): Add date last parsed OSD file. |