| Index: chrome/browser/bookmarks/bookmark_index.h
|
| diff --git a/chrome/browser/bookmarks/bookmark_index.h b/chrome/browser/bookmarks/bookmark_index.h
|
| index f406268dc138d84fc15cf3c307d1083e1b5b7ce7..03bd5d833f7a780f359c0e3c2686d8a902faa3c9 100644
|
| --- a/chrome/browser/bookmarks/bookmark_index.h
|
| +++ b/chrome/browser/bookmarks/bookmark_index.h
|
| @@ -13,7 +13,7 @@
|
| #include "base/strings/string16.h"
|
|
|
| class BookmarkNode;
|
| -struct BookmarkTitleMatch;
|
| +struct BookmarkMatch;
|
| class QueryNode;
|
| class QueryParser;
|
|
|
| @@ -25,16 +25,17 @@ namespace history {
|
| class URLDatabase;
|
| }
|
|
|
| -// BookmarkIndex maintains an index of the titles of bookmarks for quick
|
| -// look up. BookmarkIndex is owned and maintained by BookmarkModel, you
|
| +// BookmarkIndex maintains an index of the titles and URLs of bookmarks for
|
| +// quick look up. BookmarkIndex is owned and maintained by BookmarkModel, you
|
| // shouldn't need to interact directly with BookmarkIndex.
|
| //
|
| // 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.
|
| +// BookmarkNodes that contain that string in their title or URL.
|
| class BookmarkIndex {
|
| public:
|
| - explicit BookmarkIndex(content::BrowserContext* browser_context);
|
| + explicit BookmarkIndex(content::BrowserContext* browser_context,
|
| + const std::string& languages);
|
| ~BookmarkIndex();
|
|
|
| // Invoked when a bookmark has been added to the model.
|
| @@ -43,11 +44,12 @@ class BookmarkIndex {
|
| // Invoked when a bookmark has been removed from the model.
|
| void Remove(const BookmarkNode* node);
|
|
|
| - // Returns up to |max_count| of bookmarks containing the text |query|.
|
| - void GetBookmarksWithTitlesMatching(
|
| + // Returns up to |max_count| of bookmarks containing each term from
|
| + // the text |query| in either the title or the URL.
|
| + void GetBookmarksMatching(
|
| const base::string16& query,
|
| size_t max_count,
|
| - std::vector<BookmarkTitleMatch>* results);
|
| + std::vector<BookmarkMatch>* results);
|
|
|
| private:
|
| typedef std::set<const BookmarkNode*> NodeSet;
|
| @@ -85,20 +87,20 @@ class BookmarkIndex {
|
| void AddMatchToResults(const BookmarkNode* node,
|
| QueryParser* parser,
|
| const std::vector<QueryNode*>& query_nodes,
|
| - std::vector<BookmarkTitleMatch>* results);
|
| + std::vector<BookmarkMatch>* results);
|
|
|
| // 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 GetBookmarksWithTitleMatchingTerm(const base::string16& term,
|
| - bool first_term,
|
| - Matches* matches);
|
| + bool GetBookmarksMatchingTerm(const base::string16& term,
|
| + bool first_term,
|
| + 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 GetBookmarksWithTitleMatchingTerm.
|
| + // This is invoked from GetBookmarksMatchingTerm.
|
| void CombineMatchesInPlace(const Index::const_iterator& index_i,
|
| Matches* matches);
|
|
|
| @@ -110,7 +112,7 @@ class BookmarkIndex {
|
| // non-empty the result is added to result, not combined in place. This
|
| // variant is used for prefix matching.
|
| //
|
| - // This is invoked from GetBookmarksWithTitleMatchingTerm.
|
| + // This is invoked from GetBookmarksMatchingTerm.
|
| void CombineMatches(const Index::const_iterator& index_i,
|
| const Matches& current_matches,
|
| Matches* result);
|
| @@ -128,6 +130,9 @@ class BookmarkIndex {
|
|
|
| content::BrowserContext* browser_context_;
|
|
|
| + // Languages used to help parse IDNs in URLs for the bookmark index.
|
| + std::string languages_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(BookmarkIndex);
|
| };
|
|
|
|
|