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

Side by Side Diff: components/enhanced_bookmarks/bookmark_server_search_service.h

Issue 865163003: bookmarks: Move BookmarkNode into 'bookmarks' namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: enhanced_bookmarks fix Created 5 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_SERVER_SEARCH_SERVICE_H_ 5 #ifndef COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_SERVER_SEARCH_SERVICE_H_
6 #define COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_SERVER_SEARCH_SERVICE_H_ 6 #define COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_SERVER_SEARCH_SERVICE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 22 matching lines...) Expand all
33 // Note this method will be synchronous if query hits the cache. 33 // Note this method will be synchronous if query hits the cache.
34 void Search(const std::string& query); 34 void Search(const std::string& query);
35 35
36 // Returns search results for a query. Results for a query are only available 36 // Returns search results for a query. Results for a query are only available
37 // after Search() is called and after then OnChange() observer methods has 37 // after Search() is called and after then OnChange() observer methods has
38 // been sent.This method might return an empty vector, meaning there are no 38 // been sent.This method might return an empty vector, meaning there are no
39 // bookmarks matching the given query. Returning null means we are still 39 // bookmarks matching the given query. Returning null means we are still
40 // loading and no results have come to the client. Previously cancelled 40 // loading and no results have come to the client. Previously cancelled
41 // queries will not trigger onChange(), and this method will also return null 41 // queries will not trigger onChange(), and this method will also return null
42 // for queries that have never been passed to Search() before. 42 // for queries that have never been passed to Search() before.
43 scoped_ptr<std::vector<const BookmarkNode*>> ResultForQuery( 43 scoped_ptr<std::vector<const bookmarks::BookmarkNode*>> ResultForQuery(
44 const std::string& query); 44 const std::string& query);
45 45
46 protected: 46 protected:
47 scoped_ptr<net::URLFetcher> CreateFetcher() override; 47 scoped_ptr<net::URLFetcher> CreateFetcher() override;
48 48
49 bool ProcessResponse(const std::string& response, 49 bool ProcessResponse(const std::string& response,
50 bool* should_notify) override; 50 bool* should_notify) override;
51 51
52 void CleanAfterFailure() override; 52 void CleanAfterFailure() override;
53 53
54 // EnhancedBookmarkModelObserver methods. 54 // EnhancedBookmarkModelObserver methods.
55 void EnhancedBookmarkModelLoaded() override{}; 55 void EnhancedBookmarkModelLoaded() override{};
56 void EnhancedBookmarkAdded(const BookmarkNode* node) override; 56 void EnhancedBookmarkAdded(const bookmarks::BookmarkNode* node) override;
57 void EnhancedBookmarkRemoved(const BookmarkNode* node) override{}; 57 void EnhancedBookmarkRemoved(const bookmarks::BookmarkNode* node) override {}
58 void EnhancedBookmarkNodeChanged(const BookmarkNode* node) override{}; 58 void EnhancedBookmarkNodeChanged(
59 const bookmarks::BookmarkNode* node) override {}
59 void EnhancedBookmarkAllUserNodesRemoved() override; 60 void EnhancedBookmarkAllUserNodesRemoved() override;
60 void EnhancedBookmarkRemoteIdChanged(const BookmarkNode* node, 61 void EnhancedBookmarkRemoteIdChanged(const bookmarks::BookmarkNode* node,
61 const std::string& old_remote_id, 62 const std::string& old_remote_id,
62 const std::string& remote_id) override; 63 const std::string& remote_id) override;
63 64
64 private: 65 private:
65 // Cache for previous search result, a map from a query string to vector of 66 // Cache for previous search result, a map from a query string to vector of
66 // star_ids. 67 // star_ids.
67 base::MRUCache<std::string, std::vector<std::string>> cache_; 68 base::MRUCache<std::string, std::vector<std::string>> cache_;
68 // The query currently on the fly, and is cleared as soon as the result is 69 // The query currently on the fly, and is cleared as soon as the result is
69 // available. 70 // available.
70 std::string current_query_; 71 std::string current_query_;
71 DISALLOW_COPY_AND_ASSIGN(BookmarkServerSearchService); 72 DISALLOW_COPY_AND_ASSIGN(BookmarkServerSearchService);
72 }; 73 };
74
73 } // namespace enhanced_bookmarks 75 } // namespace enhanced_bookmarks
74 76
75 #endif // COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_SERVER_SEARCH_SERVICE_H_ 77 #endif // COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_SERVER_SEARCH_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698