Index: components/sync/driver/data_type_manager_impl.h |
diff --git a/components/sync/driver/data_type_manager_impl.h b/components/sync/driver/data_type_manager_impl.h |
index b20f75bbcfaa5b51341c27acb51a8fbfd47fe6c3..2f64a457433cca49c8b154ab56aee3cfa6a6e771 100644 |
--- a/components/sync/driver/data_type_manager_impl.h |
+++ b/components/sync/driver/data_type_manager_impl.h |
@@ -74,7 +74,30 @@ class DataTypeManagerImpl : public DataTypeManager, |
return &model_association_manager_; |
} |
+ protected: |
+ // Returns the priority types (control + priority user types). |
+ // Virtual for overriding during tests. |
+ virtual ModelTypeSet GetPriorityTypes() const; |
+ |
+ // The set of types whose initial download of sync data has completed. |
+ ModelTypeSet downloaded_types_; |
+ |
private: |
+ enum DataTypeConfigState { |
+ CONFIGURE_ACTIVE, // Actively being configured. Data of such types |
+ // will be downloaded if not present locally. |
+ CONFIGURE_INACTIVE, // Already configured or to be configured in future. |
+ // Data of such types is left as it is, no |
+ // downloading or purging. |
+ CONFIGURE_CLEAN, // Actively being configured but requiring unapply |
+ // and GetUpdates first (e.g. for persistence errors). |
+ DISABLED, // Not syncing. Disabled by user. |
+ FATAL, // Not syncing due to unrecoverable error. |
+ CRYPTO, // Not syncing due to a cryptographer error. |
+ UNREADY, // Not syncing due to transient error. |
+ }; |
+ using DataTypeConfigStateMap = std::map<ModelType, DataTypeConfigState>; |
+ |
// Helper enum for identifying which types within a priority group to |
// associate. |
enum AssociationGroup { |
@@ -89,15 +112,24 @@ class DataTypeManagerImpl : public DataTypeManager, |
UNREADY_AT_CONFIG, |
}; |
- friend class TestDataTypeManager; |
+ // Return model types in |state_map| that match |state|. |
+ static ModelTypeSet GetDataTypesInState( |
+ DataTypeConfigState state, |
+ const DataTypeConfigStateMap& state_map); |
+ |
+ // Set state of |types| in |state_map| to |state|. |
+ static void SetDataTypesState(DataTypeConfigState state, |
+ ModelTypeSet types, |
+ DataTypeConfigStateMap* state_map); |
+ |
+ // Prepare the parameters for the configurer's configuration. Returns the set |
+ // of types that are already ready for association. |
+ ModelTypeSet PrepareConfigureParams( |
+ ModelTypeConfigurer::ConfigureParams* params); |
// Abort configuration and stop all data types due to configuration errors. |
void Abort(ConfigureStatus status); |
- // Returns the priority types (control + priority user types). |
- // Virtual for overriding during tests. |
- virtual ModelTypeSet GetPriorityTypes() const; |
- |
// Divide |types| into sets by their priorities and return the sets from |
// high priority to low priority. |
TypeSetPriorityList PrioritizeTypes(const ModelTypeSet& types); |
@@ -125,7 +157,7 @@ class DataTypeManagerImpl : public DataTypeManager, |
// Calls data type controllers of requested types to register with backend. |
void RegisterTypesWithBackend(); |
- ModelTypeConfigurer::DataTypeConfigStateMap BuildDataTypeConfigStateMap( |
+ DataTypeConfigStateMap BuildDataTypeConfigStateMap( |
const ModelTypeSet& types_being_configured) const; |
// Start download of next set of types in |download_types_queue_| (if |
@@ -144,6 +176,9 @@ class DataTypeManagerImpl : public DataTypeManager, |
// Returns the currently enabled types. |
ModelTypeSet GetEnabledTypes() const; |
+ // Adds or removes |type| from |downloaded_types_| based on |downloaded|. |
+ void SetTypeDownloaded(ModelType type, bool downloaded); |
+ |
SyncClient* sync_client_; |
ModelTypeConfigurer* configurer_; |