| 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> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 class AutocompleteProvider; | 21 class AutocompleteProvider; |
| 22 class SuggestionAnswer; | 22 class SuggestionAnswer; |
| 23 class TemplateURL; | 23 class TemplateURL; |
| 24 class TemplateURLService; | 24 class TemplateURLService; |
| 25 | 25 |
| 26 namespace base { | 26 namespace base { |
| 27 class Time; | 27 class Time; |
| 28 } // namespace base | 28 } // namespace base |
| 29 | 29 |
| 30 namespace gfx { | 30 namespace gfx { |
| 31 enum class VectorIconId; | 31 struct VectorIcon; |
| 32 } // namespace gfx | 32 } // namespace gfx |
| 33 | 33 |
| 34 const char kACMatchPropertyInputText[] = "input text"; | 34 const char kACMatchPropertyInputText[] = "input text"; |
| 35 const char kACMatchPropertyContentsPrefix[] = "match contents prefix"; | 35 const char kACMatchPropertyContentsPrefix[] = "match contents prefix"; |
| 36 const char kACMatchPropertyContentsStartIndex[] = "match contents start index"; | 36 const char kACMatchPropertyContentsStartIndex[] = "match contents start index"; |
| 37 | 37 |
| 38 // AutocompleteMatch ---------------------------------------------------------- | 38 // AutocompleteMatch ---------------------------------------------------------- |
| 39 | 39 |
| 40 // A single result line with classified spans. The autocomplete popup displays | 40 // A single result line with classified spans. The autocomplete popup displays |
| 41 // the 'contents' and the 'description' (the description is optional) in the | 41 // the 'contents' and the 'description' (the description is optional) in the |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 int relevance, | 102 int relevance, |
| 103 bool deletable, | 103 bool deletable, |
| 104 Type type); | 104 Type type); |
| 105 AutocompleteMatch(const AutocompleteMatch& match); | 105 AutocompleteMatch(const AutocompleteMatch& match); |
| 106 ~AutocompleteMatch(); | 106 ~AutocompleteMatch(); |
| 107 | 107 |
| 108 // Converts |type| to a string representation. Used in logging and debugging. | 108 // Converts |type| to a string representation. Used in logging and debugging. |
| 109 AutocompleteMatch& operator=(const AutocompleteMatch& match); | 109 AutocompleteMatch& operator=(const AutocompleteMatch& match); |
| 110 | 110 |
| 111 // Gets the vector icon identifier for the icon to be shown for |type|. | 111 // Gets the vector icon identifier for the icon to be shown for |type|. |
| 112 static gfx::VectorIconId TypeToVectorIcon(Type type); | 112 static const gfx::VectorIcon& TypeToVectorIcon(Type type); |
| 113 | 113 |
| 114 // Comparison function for determining when one match is better than another. | 114 // Comparison function for determining when one match is better than another. |
| 115 static bool MoreRelevant(const AutocompleteMatch& elem1, | 115 static bool MoreRelevant(const AutocompleteMatch& elem1, |
| 116 const AutocompleteMatch& elem2); | 116 const AutocompleteMatch& elem2); |
| 117 | 117 |
| 118 // Comparison function for removing matches with duplicate destinations. | 118 // Comparison function for removing matches with duplicate destinations. |
| 119 // Destinations are compared using |stripped_destination_url|. Pairs of | 119 // Destinations are compared using |stripped_destination_url|. Pairs of |
| 120 // matches with empty destinations are treated as differing, since empty | 120 // matches with empty destinations are treated as differing, since empty |
| 121 // destinations are expected for non-navigable matches. | 121 // destinations are expected for non-navigable matches. |
| 122 static bool DestinationsEqual(const AutocompleteMatch& elem1, | 122 static bool DestinationsEqual(const AutocompleteMatch& elem1, |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 const base::string16& text, | 420 const base::string16& text, |
| 421 const ACMatchClassifications& classifications) const; | 421 const ACMatchClassifications& classifications) const; |
| 422 #endif | 422 #endif |
| 423 }; | 423 }; |
| 424 | 424 |
| 425 typedef AutocompleteMatch::ACMatchClassification ACMatchClassification; | 425 typedef AutocompleteMatch::ACMatchClassification ACMatchClassification; |
| 426 typedef std::vector<ACMatchClassification> ACMatchClassifications; | 426 typedef std::vector<ACMatchClassification> ACMatchClassifications; |
| 427 typedef std::vector<AutocompleteMatch> ACMatches; | 427 typedef std::vector<AutocompleteMatch> ACMatches; |
| 428 | 428 |
| 429 #endif // COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_MATCH_H_ | 429 #endif // COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_MATCH_H_ |
| OLD | NEW |