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_OMNIBOX_BROWSER_AUTOCOMPLETE_INPUT_H_ | 5 #ifndef COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_INPUT_H_ |
6 #define COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_INPUT_H_ | 6 #define COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_INPUT_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 // omnibox being focused, instead of due to user input changes. Most | 65 // omnibox being focused, instead of due to user input changes. Most |
66 // providers should not provide matches in this case. Providers which want to | 66 // providers should not provide matches in this case. Providers which want to |
67 // display matches on focus can use this flag to know when they can do so. | 67 // display matches on focus can use this flag to know when they can do so. |
68 // | 68 // |
69 // |scheme_classifier| is passed to Parse() to help determine the type of | 69 // |scheme_classifier| is passed to Parse() to help determine the type of |
70 // input this is; see comments there. | 70 // input this is; see comments there. |
71 AutocompleteInput(const base::string16& text, | 71 AutocompleteInput(const base::string16& text, |
72 size_t cursor_position, | 72 size_t cursor_position, |
73 const std::string& desired_tld, | 73 const std::string& desired_tld, |
74 const GURL& current_url, | 74 const GURL& current_url, |
75 const base::string16& current_title, | |
Mark P
2017/04/10 22:38:02
Please revise the function comment.
gcomanici
2017/04/11 20:51:41
Done.
| |
75 metrics::OmniboxEventProto::PageClassification | 76 metrics::OmniboxEventProto::PageClassification |
76 current_page_classification, | 77 current_page_classification, |
77 bool prevent_inline_autocomplete, | 78 bool prevent_inline_autocomplete, |
78 bool prefer_keyword, | 79 bool prefer_keyword, |
79 bool allow_exact_keyword_match, | 80 bool allow_exact_keyword_match, |
80 bool want_asynchronous_matches, | 81 bool want_asynchronous_matches, |
81 bool from_omnibox_focus, | 82 bool from_omnibox_focus, |
82 const AutocompleteSchemeClassifier& scheme_classifier); | 83 const AutocompleteSchemeClassifier& scheme_classifier); |
83 AutocompleteInput(const AutocompleteInput& other); | 84 AutocompleteInput(const AutocompleteInput& other); |
84 ~AutocompleteInput(); | 85 ~AutocompleteInput(); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
140 // Use of this setter is risky, since no other internal state is updated | 141 // Use of this setter is risky, since no other internal state is updated |
141 // besides |text_|, |cursor_position_| and |parts_|. Only callers who know | 142 // besides |text_|, |cursor_position_| and |parts_|. Only callers who know |
142 // that they're not changing the type/scheme/etc. should use this. | 143 // that they're not changing the type/scheme/etc. should use this. |
143 void UpdateText(const base::string16& text, | 144 void UpdateText(const base::string16& text, |
144 size_t cursor_position, | 145 size_t cursor_position, |
145 const url::Parsed& parts); | 146 const url::Parsed& parts); |
146 | 147 |
147 // The current URL, or an invalid GURL if query refinement is not desired. | 148 // The current URL, or an invalid GURL if query refinement is not desired. |
148 const GURL& current_url() const { return current_url_; } | 149 const GURL& current_url() const { return current_url_; } |
149 | 150 |
151 // The title of the current page, corresponding to the current URL, or empty | |
152 // if this is not available. | |
153 const base::string16& current_title() const { return current_title_; } | |
154 | |
150 // The type of page that is currently behind displayed and how it is | 155 // The type of page that is currently behind displayed and how it is |
151 // displayed (e.g., with search term replacement or without). | 156 // displayed (e.g., with search term replacement or without). |
152 metrics::OmniboxEventProto::PageClassification current_page_classification() | 157 metrics::OmniboxEventProto::PageClassification current_page_classification() |
153 const { | 158 const { |
154 return current_page_classification_; | 159 return current_page_classification_; |
155 } | 160 } |
156 | 161 |
157 // The type of input supplied. | 162 // The type of input supplied. |
158 metrics::OmniboxInputType::Type type() const { return type_; } | 163 metrics::OmniboxInputType::Type type() const { return type_; } |
159 | 164 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
202 void Clear(); | 207 void Clear(); |
203 | 208 |
204 private: | 209 private: |
205 friend class AutocompleteProviderTest; | 210 friend class AutocompleteProviderTest; |
206 | 211 |
207 // NOTE: Whenever adding a new field here, please make sure to update Clear() | 212 // NOTE: Whenever adding a new field here, please make sure to update Clear() |
208 // method. | 213 // method. |
209 base::string16 text_; | 214 base::string16 text_; |
210 size_t cursor_position_; | 215 size_t cursor_position_; |
211 GURL current_url_; | 216 GURL current_url_; |
217 base::string16 current_title_; | |
212 metrics::OmniboxEventProto::PageClassification current_page_classification_; | 218 metrics::OmniboxEventProto::PageClassification current_page_classification_; |
213 metrics::OmniboxInputType::Type type_; | 219 metrics::OmniboxInputType::Type type_; |
214 url::Parsed parts_; | 220 url::Parsed parts_; |
215 base::string16 scheme_; | 221 base::string16 scheme_; |
216 GURL canonicalized_url_; | 222 GURL canonicalized_url_; |
217 bool prevent_inline_autocomplete_; | 223 bool prevent_inline_autocomplete_; |
218 bool prefer_keyword_; | 224 bool prefer_keyword_; |
219 bool allow_exact_keyword_match_; | 225 bool allow_exact_keyword_match_; |
220 bool want_asynchronous_matches_; | 226 bool want_asynchronous_matches_; |
221 bool from_omnibox_focus_; | 227 bool from_omnibox_focus_; |
222 std::vector<base::string16> terms_prefixed_by_http_or_https_; | 228 std::vector<base::string16> terms_prefixed_by_http_or_https_; |
223 }; | 229 }; |
224 | 230 |
225 #endif // COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_INPUT_H_ | 231 #endif // COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_INPUT_H_ |
OLD | NEW |