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

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

Issue 242693003: Introduce BookmarkClient interface to abstract embedder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing reviewer comments 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 4027e14def711b865eb2c144c15a9d573043d61f..2ac74129aac60f77b57a22df52422e394351bb7b 100644
--- a/chrome/browser/bookmarks/bookmark_index.h
+++ b/chrome/browser/bookmarks/bookmark_index.h
@@ -12,17 +12,10 @@
#include "base/basictypes.h"
#include "base/strings/string16.h"
+class BookmarkClient;
class BookmarkNode;
struct BookmarkTitleMatch;
-namespace content {
-class BrowserContext;
-}
-
-namespace history {
-class URLDatabase;
-}
-
namespace query_parser {
class QueryNode;
class QueryParser;
@@ -37,7 +30,7 @@ class QueryParser;
// BookmarkNodes that contain that string in their title.
class BookmarkIndex {
public:
- explicit BookmarkIndex(content::BrowserContext* browser_context);
+ explicit BookmarkIndex();
~BookmarkIndex();
// Invoked when a bookmark has been added to the model.
@@ -47,10 +40,10 @@ class BookmarkIndex {
void Remove(const BookmarkNode* node);
// Returns up to |max_count| of bookmarks containing the text |query|.
- void GetBookmarksWithTitlesMatching(
- const base::string16& query,
- size_t max_count,
- std::vector<BookmarkTitleMatch>* results);
+ void GetBookmarksWithTitlesMatching(BookmarkClient* client,
+ const base::string16& query,
+ size_t max_count,
+ std::vector<BookmarkTitleMatch>* results);
private:
typedef std::set<const BookmarkNode*> NodeSet;
@@ -66,17 +59,10 @@ class BookmarkIndex {
// Extracts |matches.nodes| into NodeTypedCountPairs, sorts the pairs in
// decreasing order of typed count, and then de-dupes the matches.
- void SortMatches(const Matches& matches,
+ void SortMatches(BookmarkClient* client,
+ const Matches& matches,
NodeTypedCountPairs* node_typed_counts) const;
- // Extracts BookmarkNodes from |match| and retrieves typed counts for each
- // node from the in-memory database. Inserts pairs containing the node and
- // typed count into the vector |node_typed_counts|. |node_typed_counts| is
- // sorted in decreasing order of typed count.
- void ExtractBookmarkNodePairs(history::URLDatabase* url_db,
- const Match& match,
- NodeTypedCountPairs* node_typed_counts) const;
-
// Sort function for NodeTypedCountPairs. We sort in decreasing order of typed
// count so that the best matches will always be added to the results.
static bool NodeTypedCountPairSortFunc(const NodeTypedCountPair& a,
@@ -130,8 +116,6 @@ class BookmarkIndex {
Index index_;
- content::BrowserContext* browser_context_;
-
DISALLOW_COPY_AND_ASSIGN(BookmarkIndex);
};
« no previous file with comments | « no previous file | chrome/browser/bookmarks/bookmark_index.cc » ('j') | chrome/browser/bookmarks/bookmark_index.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698