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

Unified Diff: components/suggestions/suggestions_utils.h

Issue 473123002: [Most Visited] Check for Sync state when using SuggestionsService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: new api Created 6 years, 4 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/suggestions/suggestions_utils.h
diff --git a/components/suggestions/suggestions_utils.h b/components/suggestions/suggestions_utils.h
new file mode 100644
index 0000000000000000000000000000000000000000..6b344c46e98a4d743bbbdcca33b75c4ab0639005
--- /dev/null
+++ b/components/suggestions/suggestions_utils.h
@@ -0,0 +1,32 @@
+// 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 COMPONENTS_SUGGESTIONS_SUGGESTIONS_UTILS_H_
+#define COMPONENTS_SUGGESTIONS_SUGGESTIONS_UTILS_H_
+
+namespace suggestions {
+
+// Establishes the different sync states that users of SuggestionsService can
manzagop (departed) 2014/08/20 15:43:51 nit: double space "of Sugg...".
Mathieu 2014/08/20 18:41:29 Done.
+// specify. There are three different concepts in the sync service: initialized,
+// sync enabled and history sync enabled.
+enum SyncState {
manzagop (departed) 2014/08/20 15:43:51 Nit: how about FetchType: CACHE, SERVER, CLEAR. B
Mathieu 2014/08/20 18:41:30 Ack. Discussed offline. I don't want users of Sugg
+ // Sync service is not yet initialized, yet not disabled. History sync state
+ // is unknown (since not initialized).
manzagop (departed) 2014/08/20 15:43:51 Maybe document the fetch type, instead of what mot
Mathieu 2014/08/20 18:41:29 Done.
+ NOT_INITIALIZED_ENABLED,
+
+ // Sync service is initialized, sync is enabled and history sync is enabled.
+ INITIALIZED_ENABLED_HISTORY,
manzagop (departed) 2014/08/20 15:43:51 Update suggestions from the server. Serve from cac
Mathieu 2014/08/20 18:41:29 Done.
+
+ // Sync service is disabled (initialized or not) OR initialized and enabled
+ // with no history sync.
+ DISABLED,
manzagop (departed) 2014/08/20 15:43:51 Do not issue a server request. Clear the cache.
Mathieu 2014/08/20 18:41:29 Done.
+};
+
+SyncState GetSyncState(bool sync_initialized,
manzagop (departed) 2014/08/20 15:43:51 Perhaps this is where you can document what condit
Mathieu 2014/08/20 18:41:29 Acknowledged.
+ bool sync_enabled,
+ bool history_sync_enabled);
+
+} // namespace suggestions
+
+#endif // COMPONENTS_SUGGESTIONS_SUGGESTIONS_UTILS_H_

Powered by Google App Engine
This is Rietveld 408576698