Home | History | Annotate | Download | only in suggestions
      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. Serve empty
     27   //     suggestions.
     28   SYNC_OR_HISTORY_SYNC_DISABLED,
     29 };
     30 
     31 // Users of SuggestionsService should always use this function to get SyncState.
     32 SyncState GetSyncState(bool sync_enabled,
     33                        bool sync_initialized,
     34                        bool history_sync_enabled);
     35 
     36 }  // namespace suggestions
     37 
     38 #endif  // COMPONENTS_SUGGESTIONS_SUGGESTIONS_UTILS_H_
     39