| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_SYNC_DRIVER_DIRECTORY_DATA_TYPE_CONTROLLER_H__ | 5 #ifndef COMPONENTS_SYNC_DRIVER_DIRECTORY_DATA_TYPE_CONTROLLER_H__ |
| 6 #define COMPONENTS_SYNC_DRIVER_DIRECTORY_DATA_TYPE_CONTROLLER_H__ | 6 #define COMPONENTS_SYNC_DRIVER_DIRECTORY_DATA_TYPE_CONTROLLER_H__ |
| 7 | 7 |
| 8 #include "components/sync/driver/data_type_controller.h" | 8 #include "components/sync/driver/data_type_controller.h" |
| 9 | 9 |
| 10 #include "components/sync/driver/sync_client.h" | 10 #include "components/sync/driver/sync_client.h" |
| 11 #include "components/sync/engine/model_safe_worker.h" | 11 #include "components/sync/engine/model_safe_worker.h" |
| 12 #include "components/sync/syncable/directory.h" | 12 #include "components/sync/syncable/directory.h" |
| 13 | 13 |
| 14 namespace sync_driver { | 14 namespace syncer { |
| 15 |
| 15 class ChangeProcessor; | 16 class ChangeProcessor; |
| 16 | 17 |
| 17 // Base class for Directory based Data type controllers. | 18 // Base class for Directory based Data type controllers. |
| 18 class DirectoryDataTypeController : public DataTypeController { | 19 class DirectoryDataTypeController : public DataTypeController { |
| 19 public: | 20 public: |
| 20 ~DirectoryDataTypeController() override; | 21 ~DirectoryDataTypeController() override; |
| 21 | 22 |
| 22 // DataTypeController implementation. | 23 // DataTypeController implementation. |
| 23 bool ShouldLoadModelBeforeConfigure() const override; | 24 bool ShouldLoadModelBeforeConfigure() const override; |
| 24 void GetAllNodes(const AllNodesCallback& callback) override; | 25 void GetAllNodes(const AllNodesCallback& callback) override; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 38 | 39 |
| 39 // Directory specific implementation of DeactivateDataType. | 40 // Directory specific implementation of DeactivateDataType. |
| 40 // Deactivates change processing on the controlled data type (by removing | 41 // Deactivates change processing on the controlled data type (by removing |
| 41 // the data type's ChangeProcessor registration with the backend). | 42 // the data type's ChangeProcessor registration with the backend). |
| 42 // See BackendDataTypeConfigurer::DeactivateDataType for more details. | 43 // See BackendDataTypeConfigurer::DeactivateDataType for more details. |
| 43 void DeactivateDataType(BackendDataTypeConfigurer* configurer) override; | 44 void DeactivateDataType(BackendDataTypeConfigurer* configurer) override; |
| 44 | 45 |
| 45 // Returns a ListValue representing all nodes for a specified type by querying | 46 // Returns a ListValue representing all nodes for a specified type by querying |
| 46 // the directory. | 47 // the directory. |
| 47 static std::unique_ptr<base::ListValue> GetAllNodesForTypeFromDirectory( | 48 static std::unique_ptr<base::ListValue> GetAllNodesForTypeFromDirectory( |
| 48 syncer::ModelType type, | 49 ModelType type, |
| 49 syncer::syncable::Directory* directory); | 50 syncable::Directory* directory); |
| 50 | 51 |
| 51 protected: | 52 protected: |
| 52 // |dump_stack| is called when an unrecoverable error occurs. | 53 // |dump_stack| is called when an unrecoverable error occurs. |
| 53 DirectoryDataTypeController(syncer::ModelType type, | 54 DirectoryDataTypeController(ModelType type, |
| 54 const base::Closure& dump_stack, | 55 const base::Closure& dump_stack, |
| 55 SyncClient* sync_client); | 56 SyncClient* sync_client); |
| 56 | 57 |
| 57 // The model safe group of this data type. This should reflect the | 58 // The model safe group of this data type. This should reflect the |
| 58 // thread that should be used to modify the data type's native | 59 // thread that should be used to modify the data type's native |
| 59 // model. | 60 // model. |
| 60 virtual syncer::ModelSafeGroup model_safe_group() const = 0; | 61 virtual ModelSafeGroup model_safe_group() const = 0; |
| 61 | 62 |
| 62 // Access to the ChangeProcessor for the type being controlled by |this|. | 63 // Access to the ChangeProcessor for the type being controlled by |this|. |
| 63 // Returns NULL if the ChangeProcessor isn't created or connected. | 64 // Returns NULL if the ChangeProcessor isn't created or connected. |
| 64 virtual ChangeProcessor* GetChangeProcessor() const = 0; | 65 virtual ChangeProcessor* GetChangeProcessor() const = 0; |
| 65 | 66 |
| 66 SyncClient* const sync_client_; | 67 SyncClient* const sync_client_; |
| 67 }; | 68 }; |
| 68 | 69 |
| 69 } // namespace sync_driver | 70 } // namespace syncer |
| 70 | 71 |
| 71 #endif // COMPONENTS_SYNC_DRIVER_DIRECTORY_DATA_TYPE_CONTROLLER_H__ | 72 #endif // COMPONENTS_SYNC_DRIVER_DIRECTORY_DATA_TYPE_CONTROLLER_H__ |
| OLD | NEW |