Index: components/omnibox/browser/shortcuts_provider.h |
diff --git a/components/omnibox/browser/shortcuts_provider.h b/components/omnibox/browser/shortcuts_provider.h |
index 3344fe36d28d6a49bef689798136151e55a417dc..c97c8c70d5987896fb929a9d1272a1a623c87d84 100644 |
--- a/components/omnibox/browser/shortcuts_provider.h |
+++ b/components/omnibox/browser/shortcuts_provider.h |
@@ -15,6 +15,7 @@ |
class AutocompleteProviderClient; |
class ShortcutsProviderTest; |
+struct ShortcutMatch; |
// Provider of recently autocompleted links. Provides autocomplete suggestions |
// from previously selected suggestions. The more often a user selects a |
@@ -36,6 +37,8 @@ class ShortcutsProvider : public AutocompleteProvider, |
friend class ShortcutsProviderExtensionTest; |
friend class ShortcutsProviderTest; |
FRIEND_TEST_ALL_PREFIXES(ShortcutsProviderTest, CalculateScore); |
+ FRIEND_TEST_ALL_PREFIXES(ShortcutsProviderTest, |
+ DedupShortcutMatchesByDestination); |
typedef std::multimap<base::char16, base::string16> WordMap; |
@@ -52,11 +55,12 @@ class ShortcutsProvider : public AutocompleteProvider, |
// contents against |input|, which should be the lower-cased version of |
// the user's input. |input| and |fixed_up_input_text| are used to decide |
// what can be inlined. |
- AutocompleteMatch ShortcutToACMatch( |
- const ShortcutsDatabase::Shortcut& shortcut, |
- int relevance, |
+ AutocompleteMatch ShortcutMatchToACMatch( |
+ const ShortcutMatch& shortcut_match, |
const AutocompleteInput& input, |
- const base::string16& fixed_up_input_text); |
+ const base::string16& fixed_up_input_text, |
+ const base::string16 term_string, |
+ const WordMap& terms_map); |
// Returns a map mapping characters to groups of words from |text| that start |
// with those characters, ordered lexicographically descending so that longer |
@@ -100,6 +104,14 @@ class ShortcutsProvider : public AutocompleteProvider, |
const ShortcutsDatabase::Shortcut& shortcut, |
int max_relevance); |
+ // Function removes duplicates from vector of ShortcutMatch objects. |
+ // Deduplication algorithm is the same as used in |
+ // AutocompleteResult::DedupMatchesByDestination. |
+ // Matches with higher relevance are left from duplicates. |
Peter Kasting
2016/04/12 23:29:50
Nit: Let's use a similar comment to what's in Auto
Alexander Yashkin
2016/04/13 09:29:36
Done, thanks.
|
+ static void DedupShortcutMatchesByDestination( |
+ metrics::OmniboxEventProto::PageClassification page_classification, |
+ std::vector<ShortcutMatch>* matches); |
+ |
// The default max relevance unless overridden by a field trial. |
static const int kShortcutsProviderDefaultMaxRelevance; |