Index: chrome/browser/enhanced_bookmarks/chrome_bookmark_server_cluster_service.h |
diff --git a/chrome/browser/enhanced_bookmarks/chrome_bookmark_server_cluster_service.h b/chrome/browser/enhanced_bookmarks/chrome_bookmark_server_cluster_service.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4cf51f53fc470a21fe5f3f877971cdace9c548df |
--- /dev/null |
+++ b/chrome/browser/enhanced_bookmarks/chrome_bookmark_server_cluster_service.h |
@@ -0,0 +1,45 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_ENHANCED_BOOKMARKS_CHROME_BOOKMARK_SERVER_CLUSTER_SERVICE_H_ |
+#define CHROME_BROWSER_ENHANCED_BOOKMARKS_CHROME_BOOKMARK_SERVER_CLUSTER_SERVICE_H_ |
+ |
+#include "chrome/browser/sync/profile_sync_service_observer.h" |
+#include "components/enhanced_bookmarks/bookmark_server_cluster_service.h" |
+ |
+class ProfileSyncService; |
+ |
+namespace enhanced_bookmarks { |
+ |
+// Manages requests to the bookmark server to do just-in-time requests. |
+class ChromeBookmarkServerClusterService : public BookmarkServerClusterService, |
+ public ProfileSyncServiceObserver { |
+ public: |
+ ChromeBookmarkServerClusterService( |
+ const std::string& application_language_code, |
+ scoped_refptr<net::URLRequestContextGetter> request_context_getter, |
+ ProfileOAuth2TokenService* token_service, |
+ SigninManagerBase* signin_manager, |
+ BookmarkModel* bookmark_model, |
+ PrefService* pref_service, |
+ ProfileSyncService* sync_service); |
+ virtual ~ChromeBookmarkServerClusterService(); |
+ |
+ // ProfileSyncServiceObserver implementation. |
+ virtual void OnStateChanged() OVERRIDE; |
+ // The stars cluster API relies on the information in chrome-sync. Sending a |
+ // cluster request immediately after a bookmark is changed from the bookmark |
+ // observer notification will yield the wrong results. The request must be |
+ // delayed until the sync cycle has completed. |
+ virtual void OnSyncCycleCompleted() OVERRIDE; |
+ |
+ private: |
+ // This class observes the sync service for changes. |
+ ProfileSyncService* sync_service_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ChromeBookmarkServerClusterService); |
+}; |
+} // namespace enhanced_bookmarks |
+ |
+#endif // CHROME_BROWSER_ENHANCED_BOOKMARKS_CHROME_BOOKMARK_SERVER_CLUSTER_SERVICE_H_ |