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 <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 // This struct encapsulates arguments passed to | 68 // This struct encapsulates arguments passed to |
69 // TemplateURLRef::ReplaceSearchTerms methods. By default, only search_terms | 69 // TemplateURLRef::ReplaceSearchTerms methods. By default, only search_terms |
70 // is required and is passed in the constructor. | 70 // is required and is passed in the constructor. |
71 struct SearchTermsArgs { | 71 struct SearchTermsArgs { |
72 explicit SearchTermsArgs(const base::string16& search_terms); | 72 explicit SearchTermsArgs(const base::string16& search_terms); |
73 ~SearchTermsArgs(); | 73 ~SearchTermsArgs(); |
74 | 74 |
75 struct ContextualSearchParams { | 75 struct ContextualSearchParams { |
76 ContextualSearchParams(); | 76 ContextualSearchParams(); |
| 77 // TODO(jeremycho): Delete constructor once Clank no longer depends on it. |
77 ContextualSearchParams(const int version, | 78 ContextualSearchParams(const int version, |
78 const size_t start, | 79 const size_t start, |
79 const size_t end, | 80 const size_t end, |
80 const std::string& selection, | 81 const std::string& selection, |
81 const std::string& content, | 82 const std::string& content, |
82 const std::string& base_page_url, | 83 const std::string& base_page_url, |
83 const std::string& encoding); | 84 const std::string& encoding); |
| 85 ContextualSearchParams(const int version, |
| 86 const size_t start, |
| 87 const size_t end, |
| 88 const std::string& selection, |
| 89 const std::string& content, |
| 90 const std::string& base_page_url, |
| 91 const std::string& encoding, |
| 92 const bool resolve); |
84 ~ContextualSearchParams(); | 93 ~ContextualSearchParams(); |
85 | 94 |
86 // The version of contextual search. | 95 // The version of contextual search. |
87 int version; | 96 int version; |
88 | 97 |
89 // Offset into the page content of the start of the user selection. | 98 // Offset into the page content of the start of the user selection. |
90 size_t start; | 99 size_t start; |
91 | 100 |
92 // Offset into the page content of the end of the user selection. | 101 // Offset into the page content of the end of the user selection. |
93 size_t end; | 102 size_t end; |
94 | 103 |
95 // The user selection. | 104 // The user selection. |
96 std::string selection; | 105 std::string selection; |
97 | 106 |
98 // The text including and surrounding the user selection. | 107 // The text including and surrounding the user selection. |
99 std::string content; | 108 std::string content; |
100 | 109 |
101 // The URL of the page containing the user selection. | 110 // The URL of the page containing the user selection. |
102 std::string base_page_url; | 111 std::string base_page_url; |
103 | 112 |
104 // The encoding of content. | 113 // The encoding of content. |
105 std::string encoding; | 114 std::string encoding; |
| 115 |
| 116 // If true, the server will generate a search term based on the user |
| 117 // selection and context. Otherwise the user selection will be used as-is |
| 118 // as the search term. |
| 119 bool resolve; |
106 }; | 120 }; |
107 | 121 |
108 // The search terms (query). | 122 // The search terms (query). |
109 base::string16 search_terms; | 123 base::string16 search_terms; |
110 | 124 |
111 // The original (input) query. | 125 // The original (input) query. |
112 base::string16 original_query; | 126 base::string16 original_query; |
113 | 127 |
114 // The type the original input query was identified as. | 128 // The type the original input query was identified as. |
115 metrics::OmniboxInputType::Type input_type; | 129 metrics::OmniboxInputType::Type input_type; |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 TemplateURLRef new_tab_url_ref_; | 718 TemplateURLRef new_tab_url_ref_; |
705 TemplateURLRef contextual_search_url_ref_; | 719 TemplateURLRef contextual_search_url_ref_; |
706 scoped_ptr<AssociatedExtensionInfo> extension_info_; | 720 scoped_ptr<AssociatedExtensionInfo> extension_info_; |
707 | 721 |
708 // TODO(sky): Add date last parsed OSD file. | 722 // TODO(sky): Add date last parsed OSD file. |
709 | 723 |
710 DISALLOW_COPY_AND_ASSIGN(TemplateURL); | 724 DISALLOW_COPY_AND_ASSIGN(TemplateURL); |
711 }; | 725 }; |
712 | 726 |
713 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_ | 727 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_ |
OLD | NEW |