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

Unified Diff: components/enhanced_bookmarks/bookmark_server_search_service.h

Issue 637323005: Add Search Service in Enhanced Bookmark Bridge (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix few nits Created 6 years, 2 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: components/enhanced_bookmarks/bookmark_server_search_service.h
diff --git a/components/enhanced_bookmarks/bookmark_server_search_service.h b/components/enhanced_bookmarks/bookmark_server_search_service.h
index 97713185418368ce34a427eb54a50588a96c7eee..c2b61b607b116a28c7cb8e71f1753f9230f31c4c 100644
--- a/components/enhanced_bookmarks/bookmark_server_search_service.h
+++ b/components/enhanced_bookmarks/bookmark_server_search_service.h
@@ -8,6 +8,7 @@
#include <string>
#include <vector>
+#include "base/containers/mru_cache.h"
#include "components/enhanced_bookmarks/bookmark_server_service.h"
#include "net/url_request/url_fetcher.h"
@@ -28,7 +29,8 @@ class BookmarkServerSearchService : public BookmarkServerService {
// Triggers a search. The query must not be empty. A call to this method
// cancels any previous searches. OnChange() is garanteed to be called once
- // per query.
+ // per query. If there have been multiple queries in between, onChange will
+ // only be called for the last query.
lpromero 2014/10/29 10:31:35 This comment contradicts the previous sentence: "
Ian Wen 2014/10/29 21:54:37 Done.
void Search(const std::string& query);
// Returns the search results. The results are only available after the
@@ -36,6 +38,12 @@ class BookmarkServerSearchService : public BookmarkServerService {
// result otherwise. query should be a string passed to Search() previously.
std::vector<const BookmarkNode*> ResultForQuery(const std::string& query);
lpromero 2014/10/29 10:31:35 With the new API you introduce, will we ever use t
noyau (Ping after 24h) 2014/10/29 12:49:48 Probably add HasResultForQuery() returning a boole
+ // Returns search retults for most recent query.
lpromero 2014/10/29 10:31:35 s/retults/results
Ian Wen 2014/10/29 21:54:37 Done.
+ std::vector<const BookmarkNode*> ResultForQuery();
lpromero 2014/10/29 10:31:35 s/ResultForQuery/ResultsForLastQuery or ResultsFor
noyau (Ping after 24h) 2014/10/29 12:49:48 I'm curious why you think you need this API? I'm r
Ian Wen 2014/10/29 21:54:36 The reason why I made the server to remember the l
+
+ // Returns most recent query string.
+ std::string GetCurrentQuery();
noyau (Ping after 24h) 2014/10/29 12:49:48 GetSomething is a javaism. Just use CurrentQuery()
Ian Wen 2014/10/29 21:54:36 Done.
+
protected:
scoped_ptr<net::URLFetcher> CreateFetcher() override;
@@ -55,7 +63,7 @@ class BookmarkServerSearchService : public BookmarkServerService {
private:
// The search data, a map from query to a vector of stars.id.
lpromero 2014/10/29 10:31:35 s/map/cache?
Ian Wen 2014/10/29 21:54:37 Done.
- std::map<std::string, std::vector<std::string> > searches_;
+ base::MRUCache<std::string, std::vector<std::string> >* searches_;
Kibeom Kim (inactive) 2014/10/29 07:51:47 Since the lifetime of |searches_| is the scope of
Ian Wen 2014/10/29 21:54:36 Done.
std::string current_query_;
noyau (Ping after 24h) 2014/10/29 12:49:48 Add a comment to this variable: current_query_ hol
Ian Wen 2014/10/29 21:54:37 Done.
DISALLOW_COPY_AND_ASSIGN(BookmarkServerSearchService);
};

Powered by Google App Engine
This is Rietveld 408576698