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_MATCH_H_ | 5 #ifndef COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_MATCH_H_ |
6 #define COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_MATCH_H_ | 6 #define COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_MATCH_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <memory> | 11 #include <memory> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/strings/utf_offset_string_conversions.h" | |
Justin Donnelly
2017/06/20 17:31:01
Can you forward declare base::OffsetAdjuster::Adju
tommycli
2017/06/20 22:51:21
Unfortunately it's not possible to forward declare
| |
15 #include "components/omnibox/browser/autocomplete_input.h" | 16 #include "components/omnibox/browser/autocomplete_input.h" |
16 #include "components/omnibox/browser/autocomplete_match_type.h" | 17 #include "components/omnibox/browser/autocomplete_match_type.h" |
17 #include "components/search_engines/template_url.h" | 18 #include "components/search_engines/template_url.h" |
18 #include "ui/base/page_transition_types.h" | 19 #include "ui/base/page_transition_types.h" |
19 #include "url/gurl.h" | 20 #include "url/gurl.h" |
20 | 21 |
21 class AutocompleteProvider; | 22 class AutocompleteProvider; |
22 class SuggestionAnswer; | 23 class SuggestionAnswer; |
23 class TemplateURL; | 24 class TemplateURL; |
24 class TemplateURLService; | 25 class TemplateURLService; |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
200 // be altered during stripping. If this URL, minus the scheme and separator, | 201 // be altered during stripping. If this URL, minus the scheme and separator, |
201 // starts with any the terms in input.terms_prefixed_by_http_or_https(), we | 202 // starts with any the terms in input.terms_prefixed_by_http_or_https(), we |
202 // avoid converting an HTTPS scheme to HTTP. This means URLs that differ | 203 // avoid converting an HTTPS scheme to HTTP. This means URLs that differ |
203 // only by these schemes won't be marked as dupes, since the distinction | 204 // only by these schemes won't be marked as dupes, since the distinction |
204 // seems to matter to the user. | 205 // seems to matter to the user. |
205 static GURL GURLToStrippedGURL(const GURL& url, | 206 static GURL GURLToStrippedGURL(const GURL& url, |
206 const AutocompleteInput& input, | 207 const AutocompleteInput& input, |
207 TemplateURLService* template_url_service, | 208 TemplateURLService* template_url_service, |
208 const base::string16& keyword); | 209 const base::string16& keyword); |
209 | 210 |
211 // These are convenience functions for formatting a URL into an abridged form | |
212 // for display within the Omnibox suggestions dropdown. | |
213 // | |
214 // The results are explicitly for non-security surfaces. Do not use the | |
215 // results for anything other than the Omnibox dropdown. | |
216 static base::string16 FormatUrlForSuggestionDisplay( | |
217 const GURL& url, | |
218 bool trim_scheme, | |
219 size_t* offset_for_adjustment); | |
220 static base::string16 FormatUrlForSuggestionDisplayWithAdjustments( | |
221 const GURL& url, | |
222 bool trim_scheme, | |
223 base::OffsetAdjuster::Adjustments* adjustments); | |
224 | |
210 // Computes the stripped destination URL (via GURLToStrippedGURL()) and | 225 // Computes the stripped destination URL (via GURLToStrippedGURL()) and |
211 // stores the result in |stripped_destination_url|. |input| is used for the | 226 // stores the result in |stripped_destination_url|. |input| is used for the |
212 // same purpose as in GURLToStrippedGURL(). | 227 // same purpose as in GURLToStrippedGURL(). |
213 void ComputeStrippedDestinationURL(const AutocompleteInput& input, | 228 void ComputeStrippedDestinationURL(const AutocompleteInput& input, |
214 TemplateURLService* template_url_service); | 229 TemplateURLService* template_url_service); |
215 | 230 |
216 // Sets |allowed_to_be_default_match| to true if this match is effectively | 231 // Sets |allowed_to_be_default_match| to true if this match is effectively |
217 // the URL-what-you-typed match (i.e., would be dupped against the UWYT | 232 // the URL-what-you-typed match (i.e., would be dupped against the UWYT |
218 // match when AutocompleteResult merges matches). | 233 // match when AutocompleteResult merges matches). |
219 void EnsureUWYTIsAllowedToBeDefault( | 234 void EnsureUWYTIsAllowedToBeDefault( |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
425 const base::string16& text, | 440 const base::string16& text, |
426 const ACMatchClassifications& classifications) const; | 441 const ACMatchClassifications& classifications) const; |
427 #endif | 442 #endif |
428 }; | 443 }; |
429 | 444 |
430 typedef AutocompleteMatch::ACMatchClassification ACMatchClassification; | 445 typedef AutocompleteMatch::ACMatchClassification ACMatchClassification; |
431 typedef std::vector<ACMatchClassification> ACMatchClassifications; | 446 typedef std::vector<ACMatchClassification> ACMatchClassifications; |
432 typedef std::vector<AutocompleteMatch> ACMatches; | 447 typedef std::vector<AutocompleteMatch> ACMatches; |
433 | 448 |
434 #endif // COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_MATCH_H_ | 449 #endif // COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_MATCH_H_ |
OLD | NEW |