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_MODEL_ASSOCIATION_MANAGER_H__ | 5 #ifndef COMPONENTS_SYNC_DRIVER_MODEL_ASSOCIATION_MANAGER_H__ |
6 #define COMPONENTS_SYNC_DRIVER_MODEL_ASSOCIATION_MANAGER_H__ | 6 #define COMPONENTS_SYNC_DRIVER_MODEL_ASSOCIATION_MANAGER_H__ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "base/timer/timer.h" | 11 #include "base/timer/timer.h" |
12 | 12 |
13 #include "components/sync_driver/data_type_manager.h" | 13 #include "components/sync_driver/data_type_manager.h" |
14 #include "sync/internal_api/public/data_type_association_stats.h" | 14 #include "sync/internal_api/public/data_type_association_stats.h" |
15 #include "sync/internal_api/public/util/weak_handle.h" | 15 #include "sync/internal_api/public/util/weak_handle.h" |
16 | 16 |
| 17 namespace sync_driver { |
| 18 |
| 19 class DataTypeController; |
| 20 |
17 // |ModelAssociationManager| does the heavy lifting for doing the actual model | 21 // |ModelAssociationManager| does the heavy lifting for doing the actual model |
18 // association. It instructs DataTypeControllers to load models, start | 22 // association. It instructs DataTypeControllers to load models, start |
19 // associating and stopping. Since the operations are async it uses an | 23 // associating and stopping. Since the operations are async it uses an |
20 // interface to inform DataTypeManager the results of the operations. | 24 // interface to inform DataTypeManager the results of the operations. |
21 // This class is owned by DataTypeManager. | 25 // This class is owned by DataTypeManager. |
22 namespace browser_sync { | |
23 | |
24 class DataTypeController; | |
25 | |
26 // |ModelAssociationManager| association functions are async. The results of | 26 // |ModelAssociationManager| association functions are async. The results of |
27 // those operations are passed back via this interface. | 27 // those operations are passed back via this interface. |
28 class ModelAssociationManagerDelegate { | 28 class ModelAssociationManagerDelegate { |
29 public: | 29 public: |
30 // Called when model association (MergeDataAndStartSyncing) has completed | 30 // Called when model association (MergeDataAndStartSyncing) has completed |
31 // for |type|, regardless of success or failure. | 31 // for |type|, regardless of success or failure. |
32 virtual void OnSingleDataTypeAssociationDone( | 32 virtual void OnSingleDataTypeAssociationDone( |
33 syncer::ModelType type, | 33 syncer::ModelType type, |
34 const syncer::DataTypeAssociationStats& association_stats) = 0; | 34 const syncer::DataTypeAssociationStats& association_stats) = 0; |
35 | 35 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 | 160 |
161 // Timer to track and limit how long a datatype takes to model associate. | 161 // Timer to track and limit how long a datatype takes to model associate. |
162 base::OneShotTimer<ModelAssociationManager> timer_; | 162 base::OneShotTimer<ModelAssociationManager> timer_; |
163 | 163 |
164 base::WeakPtrFactory<ModelAssociationManager> weak_ptr_factory_; | 164 base::WeakPtrFactory<ModelAssociationManager> weak_ptr_factory_; |
165 | 165 |
166 DataTypeManager::ConfigureStatus configure_status_; | 166 DataTypeManager::ConfigureStatus configure_status_; |
167 | 167 |
168 DISALLOW_COPY_AND_ASSIGN(ModelAssociationManager); | 168 DISALLOW_COPY_AND_ASSIGN(ModelAssociationManager); |
169 }; | 169 }; |
170 } // namespace browser_sync | 170 |
| 171 } // namespace sync_driver |
| 172 |
171 #endif // COMPONENTS_SYNC_DRIVER_MODEL_ASSOCIATION_MANAGER_H__ | 173 #endif // COMPONENTS_SYNC_DRIVER_MODEL_ASSOCIATION_MANAGER_H__ |
OLD | NEW |