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

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

Issue 666133002: Standardize usage of virtual/override/final in components/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 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
11 #include "components/enhanced_bookmarks/bookmark_server_service.h" 11 #include "components/enhanced_bookmarks/bookmark_server_service.h"
12 #include "net/url_request/url_fetcher.h" 12 #include "net/url_request/url_fetcher.h"
13 13
14 namespace enhanced_bookmarks { 14 namespace enhanced_bookmarks {
15 15
16 class EnhancedBookmarkModel; 16 class EnhancedBookmarkModel;
17 17
18 // Sends requests to the bookmark server to search for bookmarks relevant to a 18 // Sends requests to the bookmark server to search for bookmarks relevant to a
19 // given query. Will handle one outgoing request at a time. 19 // given query. Will handle one outgoing request at a time.
20 class BookmarkServerSearchService : public BookmarkServerService { 20 class BookmarkServerSearchService : public BookmarkServerService {
21 public: 21 public:
22 BookmarkServerSearchService( 22 BookmarkServerSearchService(
23 scoped_refptr<net::URLRequestContextGetter> request_context_getter, 23 scoped_refptr<net::URLRequestContextGetter> request_context_getter,
24 ProfileOAuth2TokenService* token_service, 24 ProfileOAuth2TokenService* token_service,
25 SigninManagerBase* signin_manager, 25 SigninManagerBase* signin_manager,
26 EnhancedBookmarkModel* bookmark_model); 26 EnhancedBookmarkModel* bookmark_model);
27 virtual ~BookmarkServerSearchService(); 27 ~BookmarkServerSearchService() override;
28 28
29 // Triggers a search. The query must not be empty. A call to this method 29 // Triggers a search. The query must not be empty. A call to this method
30 // cancels any previous searches. OnChange() is garanteed to be called once 30 // cancels any previous searches. OnChange() is garanteed to be called once
31 // per query. 31 // per query.
32 void Search(const std::string& query); 32 void Search(const std::string& query);
33 33
34 // Returns the search results. The results are only available after the 34 // Returns the search results. The results are only available after the
35 // OnChange() observer methods has been sent. This method will return an empty 35 // OnChange() observer methods has been sent. This method will return an empty
36 // result otherwise. query should be a string passed to Search() previously. 36 // result otherwise. query should be a string passed to Search() previously.
37 std::vector<const BookmarkNode*> ResultForQuery(const std::string& query); 37 std::vector<const BookmarkNode*> ResultForQuery(const std::string& query);
38 38
39 protected: 39 protected:
40 virtual scoped_ptr<net::URLFetcher> CreateFetcher() override; 40 scoped_ptr<net::URLFetcher> CreateFetcher() override;
41 41
42 virtual bool ProcessResponse(const std::string& response, 42 bool ProcessResponse(const std::string& response,
43 bool* should_notify) override; 43 bool* should_notify) override;
44 44
45 virtual void CleanAfterFailure() override; 45 void CleanAfterFailure() override;
46 46
47 // EnhancedBookmarkModelObserver methods. 47 // EnhancedBookmarkModelObserver methods.
48 virtual void EnhancedBookmarkModelLoaded() override{}; 48 void EnhancedBookmarkModelLoaded() override{};
49 virtual void EnhancedBookmarkAdded(const BookmarkNode* node) override; 49 void EnhancedBookmarkAdded(const BookmarkNode* node) override;
50 virtual void EnhancedBookmarkRemoved(const BookmarkNode* node) override{}; 50 void EnhancedBookmarkRemoved(const BookmarkNode* node) override{};
51 virtual void EnhancedBookmarkAllUserNodesRemoved() override; 51 void EnhancedBookmarkAllUserNodesRemoved() override;
52 virtual void EnhancedBookmarkRemoteIdChanged( 52 void EnhancedBookmarkRemoteIdChanged(const BookmarkNode* node,
53 const BookmarkNode* node, 53 const std::string& old_remote_id,
54 const std::string& old_remote_id, 54 const std::string& remote_id) override;
55 const std::string& remote_id) override;
56 55
57 private: 56 private:
58 // The search data, a map from query to a vector of stars.id. 57 // The search data, a map from query to a vector of stars.id.
59 std::map<std::string, std::vector<std::string> > searches_; 58 std::map<std::string, std::vector<std::string> > searches_;
60 std::string current_query_; 59 std::string current_query_;
61 DISALLOW_COPY_AND_ASSIGN(BookmarkServerSearchService); 60 DISALLOW_COPY_AND_ASSIGN(BookmarkServerSearchService);
62 }; 61 };
63 } // namespace enhanced_bookmarks 62 } // namespace enhanced_bookmarks
64 63
65 #endif // COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_SERVER_SEARCH_SERVICE_H_ 64 #endif // COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_SERVER_SEARCH_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698