Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Unified Diff: components/bookmarks/browser/bookmark_index.h

Issue 882823004: Omnibox: BookmarksProvider: Make Multiple Prefix Matches Work (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/bookmarks/browser/bookmark_index.h
diff --git a/components/bookmarks/browser/bookmark_index.h b/components/bookmarks/browser/bookmark_index.h
index e3d8dd50070ea59218f44b5c35bc049ec8a5d335..619d6c233e33734baf10943c0030a65165fcbc75 100644
--- a/components/bookmarks/browser/bookmark_index.h
+++ b/components/bookmarks/browser/bookmark_index.h
@@ -53,12 +53,10 @@ class BookmarkIndex {
typedef std::set<const BookmarkNode*> NodeSet;
typedef std::map<base::string16, NodeSet> Index;
- struct Match;
- typedef std::vector<Match> Matches;
-
- // Extracts |matches.nodes| into Nodes, sorts the pairs in decreasing order of
- // typed count (if supported by the client), and then de-dupes the matches.
- void SortMatches(const Matches& matches, Nodes* sorted_nodes) const;
+ // Constructs |sorted_nodes| by taking the matches in |matches| and sorting
+ // them in decreasing order of typed count (if supported by the client) and
+ // deduping.
+ void SortMatches(const NodeSet& matches, Nodes* sorted_nodes) const;
// Add |node| to |results| if the node matches the query.
void AddMatchToResults(
@@ -74,28 +72,12 @@ class BookmarkIndex {
const base::string16& term,
bool first_term,
query_parser::MatchingAlgorithm matching_algorithm,
- Matches* matches);
-
- // Iterates over |matches| updating each Match's nodes to contain the
- // intersection of the Match's current nodes and the nodes at |index_i|.
- // If the intersection is empty, the Match is removed.
- //
- // This is invoked from GetBookmarksMatchingTerm.
- void CombineMatchesInPlace(const Index::const_iterator& index_i,
- Matches* matches);
-
- // Iterates over |current_matches| calculating the intersection between the
- // Match's nodes and the nodes at |index_i|. If the intersection between the
- // two is non-empty, a new match is added to |result|.
- //
- // This differs from CombineMatchesInPlace in that if the intersection is
- // non-empty the result is added to result, not combined in place. This
- // variant is used for prefix matching.
- //
- // This is invoked from GetBookmarksMatchingTerm.
- void CombineMatches(const Index::const_iterator& index_i,
- const Matches& current_matches,
- Matches* result);
+ NodeSet* matches);
+
+ // Replaces |*matches| with the intersection of |*matches| and
+ // |matches_to_incorporate|.
+ void CombineMatchesInPlace(const NodeSet& matches_to_incorporate,
+ NodeSet* matches);
// Returns the set of query words from |query|.
std::vector<base::string16> ExtractQueryWords(const base::string16& query);
« no previous file with comments | « no previous file | components/bookmarks/browser/bookmark_index.cc » ('j') | components/bookmarks/browser/bookmark_index.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698