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

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

Issue 701553002: Allow systematic prefix search in bookmarks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 6f6fd6e8035f757bc84f5fbc6225a5a4e1859fbf..659d48a61e0f81b3a3ad4c48cf05d7c5057c004e 100644
--- a/components/bookmarks/browser/bookmark_index.h
+++ b/components/bookmarks/browser/bookmark_index.h
@@ -41,12 +41,13 @@ 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 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<BookmarkMatch>* results);
+ // Returns up to |max_count| of bookmarks containing each term from the text
+ // |query| in either the title or the URL.
+ // |always_prefix_search| is passed to |GetBookmarksMatchingTerm| internally.
+ void GetBookmarksMatching(const base::string16& query,
+ size_t max_count,
+ bool always_prefix_search,
+ std::vector<BookmarkMatch>* results);
private:
typedef std::vector<const BookmarkNode*> Nodes;
@@ -70,8 +71,14 @@ 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.
+ // When |always_prefix_search| is false, if the term is not long enough in the
sky 2014/11/03 21:44:05 This description is confusing. I think you want so
Kibeom Kim (inactive) 2014/11/04 01:28:19 Done. (removed since we put enum and it's self-exp
+ // sense of |query_parser::QueryParser::IsWordLongEnoughForPrefixSearch|, it
+ // is not considered for prefix search but only for an exact match.
+ // When |always_prefix_search| is true, the term is always considered for a
+ // prefix search, no matter its length.
bool GetBookmarksMatchingTerm(const base::string16& term,
bool first_term,
+ bool always_prefix_search,
Matches* matches);
// Iterates over |matches| updating each Match's nodes to contain the
« no previous file with comments | « no previous file | components/bookmarks/browser/bookmark_index.cc » ('j') | components/bookmarks/browser/bookmark_model.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698