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