Chromium Code Reviews| Index: components/bookmarks/browser/bookmark_index.h |
| diff --git a/components/bookmarks/browser/bookmark_index.h b/components/bookmarks/browser/bookmark_index.h |
| index 1e00c8d5224aba12ac0064db289bc5c67131839d..d8a88cdec298762da595ddf44baf8d8e41e3100d 100644 |
| --- a/components/bookmarks/browser/bookmark_index.h |
| +++ b/components/bookmarks/browser/bookmark_index.h |
| @@ -19,7 +19,7 @@ |
| namespace bookmarks { |
| class BookmarkClient; |
| -class BookmarkNode; |
| +class TitledUrlNode; |
| struct BookmarkMatch; |
| // BookmarkIndex maintains an index of the titles and URLs of bookmarks for |
| @@ -28,37 +28,38 @@ struct BookmarkMatch; |
| // |
| // BookmarkIndex maintains the index (index_) as a map of sets. The map (type |
| // Index) maps from a lower case string to the set (type NodeSet) of |
| -// BookmarkNodes that contain that string in their title or URL. |
| +// TitledUrlNodes that contain that string in their title or URL. |
| class BookmarkIndex { |
| public: |
| BookmarkIndex(BookmarkClient* client); |
| ~BookmarkIndex(); |
| - // Invoked when a bookmark has been added to the model. |
| - void Add(const BookmarkNode* node); |
| + // Invoked when a title/URL pair has been added to the model. |
| + void Add(const TitledUrlNode* node); |
| - // Invoked when a bookmark has been removed from the model. |
| - void Remove(const BookmarkNode* node); |
| + // Invoked when a title/URL pair has been removed from the model. |
| + void Remove(const TitledUrlNode* node); |
| - // Returns up to |max_count| of bookmarks containing each term from the text |
| + // Returns up to |max_count| of matches containing each term from the text |
| // |query| in either the title or the URL. |
| - void GetBookmarksMatching(const base::string16& query, |
| - size_t max_count, |
| - query_parser::MatchingAlgorithm matching_algorithm, |
| - std::vector<BookmarkMatch>* results); |
| - |
| - private: |
| - typedef std::vector<const BookmarkNode*> Nodes; |
| - typedef std::set<const BookmarkNode*> NodeSet; |
| + void GetResultsMatching(const base::string16& query, |
| + size_t max_count, |
| + query_parser::MatchingAlgorithm matching_algorithm, |
| + std::vector<BookmarkMatch>* results); |
| + |
| + protected: |
| + typedef std::vector<const TitledUrlNode*> Nodes; |
|
sky
2016/12/02 00:21:24
While you are changing this code update to using.
mattreynolds
2016/12/02 21:02:06
Done.
|
| + typedef std::set<const TitledUrlNode*> NodeSet; |
| typedef std::map<base::string16, NodeSet> Index; |
| + private: |
| // 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 them. |
| - void SortMatches(const NodeSet& matches, Nodes* sorted_nodes) const; |
| + virtual void SortMatches(const NodeSet& matches, Nodes* sorted_nodes) const; |
| // Add |node| to |results| if the node matches the query. |
| - void AddMatchToResults(const BookmarkNode* node, |
| + void AddMatchToResults(const TitledUrlNode* node, |
| query_parser::QueryParser* parser, |
| const query_parser::QueryNodeVector& query_nodes, |
| std::vector<BookmarkMatch>* results); |
| @@ -66,7 +67,7 @@ class BookmarkIndex { |
| // Populates |matches| for the specified term. If |first_term| is true, this |
| // is the first term in the query. Returns true if there is at least one node |
| // matching the term. |
| - bool GetBookmarksMatchingTerm( |
| + bool GetResultsMatchingTerm( |
| const base::string16& term, |
| bool first_term, |
| query_parser::MatchingAlgorithm matching_algorithm, |
| @@ -76,10 +77,10 @@ class BookmarkIndex { |
| std::vector<base::string16> ExtractQueryWords(const base::string16& query); |
| // Adds |node| to |index_|. |
| - void RegisterNode(const base::string16& term, const BookmarkNode* node); |
| + void RegisterNode(const base::string16& term, const TitledUrlNode* node); |
| // Removes |node| from |index_|. |
| - void UnregisterNode(const base::string16& term, const BookmarkNode* node); |
| + void UnregisterNode(const base::string16& term, const TitledUrlNode* node); |
| Index index_; |