Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_SUGGESTIONS_SUGGESTIONS_UTILS_H_ | |
| 6 #define COMPONENTS_SUGGESTIONS_SUGGESTIONS_UTILS_H_ | |
| 7 | |
| 8 namespace suggestions { | |
| 9 | |
| 10 // Establishes the different sync states that users of SuggestionsService can | |
| 11 // specify. There are three different concepts in the sync service: initialized, | |
| 12 // sync enabled and history sync enabled. | |
| 13 enum SyncState { | |
| 14 // State: Sync service is not initialized, yet not disabled. History sync | |
| 15 // state is unknown (since not initialized). | |
| 16 // Behavior: Does not issue a server request, but serves from cache if | |
| 17 // available. | |
| 18 NOT_INITIALIZED_ENABLED, | |
| 19 | |
| 20 // State: Sync service is initialized, sync is enabled and history sync is | |
| 21 // enabled. | |
| 22 // Behavior: Update suggestions from the server. Serve from cache on timeout. | |
| 23 INITIALIZED_ENABLED_HISTORY, | |
| 24 | |
| 25 // State: Sync service is disabled or history sync is disabled. | |
| 26 // Behavior: Do not issue a server request. Clear the cache. | |
|
manzagop (departed)
2014/08/20 19:28:14
Also "Serve empty suggestions"? To make it clear t
Mathieu
2014/08/20 21:37:48
Done.
| |
| 27 SYNC_OR_HISTORY_SYNC_DISABLED, | |
| 28 }; | |
| 29 | |
| 30 // Users of SuggestionsService should always use this function to get SyncState. | |
| 31 SyncState GetSyncState(bool sync_enabled, | |
| 32 bool sync_initialized, | |
| 33 bool history_sync_enabled); | |
| 34 | |
| 35 } // namespace suggestions | |
| 36 | |
| 37 #endif // COMPONENTS_SUGGESTIONS_SUGGESTIONS_UTILS_H_ | |
| OLD | NEW |