OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_OMNIBOX_BROWSER_SHORTCUT_MATCH_H_ | |
6 #define COMPONENTS_OMNIBOX_BROWSER_SHORTCUT_MATCH_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "base/strings/string16.h" | |
11 #include "components/omnibox/browser/shortcuts_backend.h" | |
12 #include "url/gurl.h" | |
13 | |
14 // ShortcutMatch holds sufficient information about a single match from the | |
15 // shortcut database to allow for destination deduping and relevance sorting. | |
16 // After those stages the top matches are converted to the more heavyweight | |
17 // AutocompleteMatch struct. Avoiding constructing the larger struct for every | |
18 // such match can save significant time when there are many shortcut matches to | |
19 // process. | |
20 struct ShortcutMatch { | |
21 ShortcutMatch(int relevance, | |
22 const GURL& stripped_destination_url, | |
23 const ShortcutsDatabase::Shortcut* shortcut); | |
24 static bool DestinationsEqual(const ShortcutMatch& elem1, | |
Peter Kasting
2016/04/12 23:29:50
Nit: Since these two methods are each used just on
Alexander Yashkin
2016/04/13 09:29:36
Done, yet i had to inline this call to match_compa
| |
25 const ShortcutMatch& elem2); | |
26 static bool MoreRelevant(const ShortcutMatch& elem1, | |
27 const ShortcutMatch& elem2); | |
28 int relevance; | |
29 GURL stripped_destination_url; | |
30 const ShortcutsDatabase::Shortcut* shortcut; | |
31 base::string16 contents; | |
32 AutocompleteMatch::Type type; | |
33 }; | |
34 | |
35 typedef std::vector<ShortcutMatch> ShortcutMatches; | |
36 | |
37 #endif // COMPONENTS_YANDEX_OMNIBOX_BROWSER_SHORTCUT_MATCH_H_ | |
OLD | NEW |