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

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

Issue 184663002: Omnibox: Make URLs of Bookmarks Searchable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tested; works Created 6 years, 8 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: chrome/browser/bookmarks/bookmark_index.h
diff --git a/chrome/browser/bookmarks/bookmark_index.h b/chrome/browser/bookmarks/bookmark_index.h
index f406268dc138d84fc15cf3c307d1083e1b5b7ce7..ab2819efbfb4de0a4ee80e33d9bd9eff8b8fe8ff 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,
Peter Kasting 2014/04/16 23:44:25 Nit: No "explicit"
Mark P 2014/04/17 20:24:18 Done.
+ 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);
@@ -126,8 +128,14 @@ class BookmarkIndex {
Index index_;
+ // True if URLs are stored in the index as well as bookmark titles.
+ const bool index_urls_;
+
content::BrowserContext* browser_context_;
+ // Languages used to help parse IDNs in URLs for the bookmark index.
+ std::string languages_;
+
DISALLOW_COPY_AND_ASSIGN(BookmarkIndex);
};

Powered by Google App Engine
This is Rietveld 408576698