OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_DATA_TYPE_CONTROLLER_H__ | 5 #ifndef COMPONENTS_SYNC_DRIVER_DATA_TYPE_CONTROLLER_H__ |
6 #define COMPONENTS_SYNC_DRIVER_DATA_TYPE_CONTROLLER_H__ | 6 #define COMPONENTS_SYNC_DRIVER_DATA_TYPE_CONTROLLER_H__ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // determined by cloud state. | 54 // determined by cloud state. |
55 ASSOCIATION_FAILED, // An error occurred during model association. | 55 ASSOCIATION_FAILED, // An error occurred during model association. |
56 ABORTED, // Start was aborted by calling Stop(). | 56 ABORTED, // Start was aborted by calling Stop(). |
57 UNRECOVERABLE_ERROR, // An unrecoverable error occured. | 57 UNRECOVERABLE_ERROR, // An unrecoverable error occured. |
58 NEEDS_CRYPTO, // The data type cannot be started yet because it | 58 NEEDS_CRYPTO, // The data type cannot be started yet because it |
59 // depends on the cryptographer. | 59 // depends on the cryptographer. |
60 RUNTIME_ERROR, // After starting, a runtime error was encountered. | 60 RUNTIME_ERROR, // After starting, a runtime error was encountered. |
61 MAX_CONFIGURE_RESULT | 61 MAX_CONFIGURE_RESULT |
62 }; | 62 }; |
63 | 63 |
64 typedef base::Callback< | 64 using StartCallback = base::Callback< |
65 void(ConfigureResult, const SyncMergeResult&, const SyncMergeResult&)> | 65 void(ConfigureResult, const SyncMergeResult&, const SyncMergeResult&)>; |
66 StartCallback; | |
67 | 66 |
68 typedef base::Callback<void(ModelType, const SyncError&)> ModelLoadCallback; | 67 using ModelLoadCallback = base::Callback<void(ModelType, const SyncError&)>; |
69 | 68 |
70 typedef base::Callback<void(const ModelType, | 69 using AllNodesCallback = |
71 std::unique_ptr<base::ListValue>)> | 70 base::Callback<void(const ModelType, std::unique_ptr<base::ListValue>)>; |
72 AllNodesCallback; | |
73 | 71 |
74 typedef base::Callback<void(ModelType, const StatusCounters&)> | 72 using StatusCountersCallback = |
75 StatusCountersCallback; | 73 base::Callback<void(ModelType, const StatusCounters&)>; |
76 | 74 |
77 typedef std::map<ModelType, std::unique_ptr<DataTypeController>> TypeMap; | 75 using TypeMap = std::map<ModelType, std::unique_ptr<DataTypeController>>; |
78 typedef std::map<ModelType, DataTypeController::State> StateMap; | 76 using StateMap = std::map<ModelType, DataTypeController::State>; |
79 | 77 |
80 // Returns true if the start result should trigger an unrecoverable error. | 78 // Returns true if the start result should trigger an unrecoverable error. |
81 // Public so unit tests can use this function as well. | 79 // Public so unit tests can use this function as well. |
82 static bool IsUnrecoverableResult(ConfigureResult result); | 80 static bool IsUnrecoverableResult(ConfigureResult result); |
83 | 81 |
84 // Returns true if the datatype started successfully. | 82 // Returns true if the datatype started successfully. |
85 static bool IsSuccessfulResult(ConfigureResult result); | 83 static bool IsSuccessfulResult(ConfigureResult result); |
86 | 84 |
87 virtual ~DataTypeController(); | 85 virtual ~DataTypeController(); |
88 | 86 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // The type this object is responsible for controlling. | 170 // The type this object is responsible for controlling. |
173 const ModelType type_; | 171 const ModelType type_; |
174 | 172 |
175 // Used to check that functions are called on the correct thread. | 173 // Used to check that functions are called on the correct thread. |
176 base::ThreadChecker thread_checker_; | 174 base::ThreadChecker thread_checker_; |
177 }; | 175 }; |
178 | 176 |
179 } // namespace syncer | 177 } // namespace syncer |
180 | 178 |
181 #endif // COMPONENTS_SYNC_DRIVER_DATA_TYPE_CONTROLLER_H__ | 179 #endif // COMPONENTS_SYNC_DRIVER_DATA_TYPE_CONTROLLER_H__ |
OLD | NEW |