OLD | NEW |
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_CLUSTER_SERVICE_H_ | 5 #ifndef COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_SERVER_CLUSTER_SERVICE_H_ |
6 #define COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_SERVER_CLUSTER_SERVICE_H_ | 6 #define COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_SERVER_CLUSTER_SERVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 scoped_refptr<net::URLRequestContextGetter> request_context_getter, | 36 scoped_refptr<net::URLRequestContextGetter> request_context_getter, |
37 ProfileOAuth2TokenService* token_service, | 37 ProfileOAuth2TokenService* token_service, |
38 SigninManagerBase* signin_manager, | 38 SigninManagerBase* signin_manager, |
39 EnhancedBookmarkModel* enhanced_bookmark_model, | 39 EnhancedBookmarkModel* enhanced_bookmark_model, |
40 PrefService* pref_service); | 40 PrefService* pref_service); |
41 ~BookmarkServerClusterService() override; | 41 ~BookmarkServerClusterService() override; |
42 | 42 |
43 // Retrieves all the bookmarks associated with a cluster. The returned | 43 // Retrieves all the bookmarks associated with a cluster. The returned |
44 // BookmarkNodes are owned by the bookmark model, and one must listen to the | 44 // BookmarkNodes are owned by the bookmark model, and one must listen to the |
45 // model observer notification to clear them. | 45 // model observer notification to clear them. |
46 const std::vector<const BookmarkNode*> BookmarksForClusterNamed( | 46 const std::vector<const bookmarks::BookmarkNode*> BookmarksForClusterNamed( |
47 const std::string& cluster_name) const; | 47 const std::string& cluster_name) const; |
48 | 48 |
49 // Returns the clusters in which the passed bookmark is in, if any. | 49 // Returns the clusters in which the passed bookmark is in, if any. |
50 const std::vector<std::string> ClustersForBookmark( | 50 const std::vector<std::string> ClustersForBookmark( |
51 const BookmarkNode* bookmark) const; | 51 const bookmarks::BookmarkNode* bookmark) const; |
52 | 52 |
53 // Dynamically generates a vector of all clusters names. | 53 // Dynamically generates a vector of all clusters names. |
54 const std::vector<std::string> GetClusters() const; | 54 const std::vector<std::string> GetClusters() const; |
55 | 55 |
56 // Registers server cluster service prefs. | 56 // Registers server cluster service prefs. |
57 static void RegisterPrefs(user_prefs::PrefRegistrySyncable* registry); | 57 static void RegisterPrefs(user_prefs::PrefRegistrySyncable* registry); |
58 | 58 |
59 protected: | 59 protected: |
60 // BookmarkServerService methods. | 60 // BookmarkServerService methods. |
61 scoped_ptr<net::URLFetcher> CreateFetcher() override; | 61 scoped_ptr<net::URLFetcher> CreateFetcher() override; |
62 bool ProcessResponse(const std::string& response, | 62 bool ProcessResponse(const std::string& response, |
63 bool* should_notify) override; | 63 bool* should_notify) override; |
64 void CleanAfterFailure() override; | 64 void CleanAfterFailure() override; |
65 | 65 |
66 // EnhancedBookmarkModelObserver methods. | 66 // EnhancedBookmarkModelObserver methods. |
67 void EnhancedBookmarkModelLoaded() override; | 67 void EnhancedBookmarkModelLoaded() override; |
68 void EnhancedBookmarkAdded(const BookmarkNode* node) override; | 68 void EnhancedBookmarkAdded(const bookmarks::BookmarkNode* node) override; |
69 void EnhancedBookmarkRemoved(const BookmarkNode* node) override; | 69 void EnhancedBookmarkRemoved(const bookmarks::BookmarkNode* node) override; |
70 void EnhancedBookmarkNodeChanged(const BookmarkNode* node) override; | 70 void EnhancedBookmarkNodeChanged( |
| 71 const bookmarks::BookmarkNode* node) override; |
71 void EnhancedBookmarkAllUserNodesRemoved() override; | 72 void EnhancedBookmarkAllUserNodesRemoved() override; |
72 void EnhancedBookmarkRemoteIdChanged(const BookmarkNode* node, | 73 void EnhancedBookmarkRemoteIdChanged(const bookmarks::BookmarkNode* node, |
73 const std::string& old_remote_id, | 74 const std::string& old_remote_id, |
74 const std::string& remote_id) override; | 75 const std::string& remote_id) override; |
75 | 76 |
76 private: | 77 private: |
77 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, Cluster); | 78 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, Cluster); |
78 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, SignOut); | 79 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, SignOut); |
79 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, Serialization); | 80 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, Serialization); |
80 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, SaveToPrefs); | 81 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, SaveToPrefs); |
81 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, BadAuth); | 82 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, BadAuth); |
82 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, EmptyAuth); | 83 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, EmptyAuth); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 PrefService* pref_service_; | 117 PrefService* pref_service_; |
117 // The cluster data, a map from cluster name to a vector of stars.id. | 118 // The cluster data, a map from cluster name to a vector of stars.id. |
118 ClusterMap cluster_data_; | 119 ClusterMap cluster_data_; |
119 | 120 |
120 DISALLOW_COPY_AND_ASSIGN(BookmarkServerClusterService); | 121 DISALLOW_COPY_AND_ASSIGN(BookmarkServerClusterService); |
121 }; | 122 }; |
122 | 123 |
123 } // namespace enhanced_bookmarks | 124 } // namespace enhanced_bookmarks |
124 | 125 |
125 #endif // COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_SERVER_CLUSTER_SERVICE_H_ | 126 #endif // COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_SERVER_CLUSTER_SERVICE_H_ |
OLD | NEW |