OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_SYNC_GLUE_FRONTEND_DATA_TYPE_CONTROLLER_H__ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_FRONTEND_DATA_TYPE_CONTROLLER_H__ |
6 #define CHROME_BROWSER_SYNC_GLUE_FRONTEND_DATA_TYPE_CONTROLLER_H__ | 6 #define CHROME_BROWSER_SYNC_GLUE_FRONTEND_DATA_TYPE_CONTROLLER_H__ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "chrome/browser/sync/glue/data_type_controller.h" | 14 #include "chrome/browser/sync/glue/data_type_controller.h" |
15 #include "chrome/browser/sync/glue/data_type_error_handler.h" | 15 #include "chrome/browser/sync/glue/data_type_error_handler.h" |
16 | 16 |
17 class Profile; | 17 class Profile; |
18 class ProfileSyncService; | 18 class ProfileSyncService; |
19 class ProfileSyncComponentsFactory; | 19 class ProfileSyncComponentsFactory; |
| 20 |
| 21 namespace base { |
| 22 class TimeDelta; |
| 23 } |
| 24 |
| 25 namespace csync { |
20 class SyncError; | 26 class SyncError; |
| 27 } |
21 | 28 |
22 namespace base { class TimeDelta; } | |
23 namespace browser_sync { | 29 namespace browser_sync { |
24 | 30 |
25 class AssociatorInterface; | 31 class AssociatorInterface; |
26 class ChangeProcessor; | 32 class ChangeProcessor; |
27 | 33 |
28 // Implementation for datatypes that reside on the frontend thread | 34 // Implementation for datatypes that reside on the frontend thread |
29 // (UI thread). This is the same thread we perform initialization on, so we | 35 // (UI thread). This is the same thread we perform initialization on, so we |
30 // don't have to worry about thread safety. The main start/stop funtionality is | 36 // don't have to worry about thread safety. The main start/stop funtionality is |
31 // implemented by default. | 37 // implemented by default. |
32 // Derived classes must implement (at least): | 38 // Derived classes must implement (at least): |
33 // syncable::ModelType type() const | 39 // syncable::ModelType type() const |
34 // void CreateSyncComponents(); | 40 // void CreateSyncComponents(); |
35 // NOTE: This class is deprecated! New sync datatypes should be using the | 41 // NOTE: This class is deprecated! New sync datatypes should be using the |
36 // SyncableService API and the UIDataTypeController instead. | 42 // csync::SyncableService API and the UIDataTypeController instead. |
37 // TODO(zea): Delete this once all types are on the new API. | 43 // TODO(zea): Delete this once all types are on the new API. |
38 class FrontendDataTypeController : public DataTypeController { | 44 class FrontendDataTypeController : public DataTypeController { |
39 public: | 45 public: |
40 FrontendDataTypeController( | 46 FrontendDataTypeController( |
41 ProfileSyncComponentsFactory* profile_sync_factory, | 47 ProfileSyncComponentsFactory* profile_sync_factory, |
42 Profile* profile, | 48 Profile* profile, |
43 ProfileSyncService* sync_service); | 49 ProfileSyncService* sync_service); |
44 | 50 |
45 // DataTypeController interface. | 51 // DataTypeController interface. |
46 virtual void LoadModels( | 52 virtual void LoadModels( |
(...skipping 29 matching lines...) Expand all Loading... |
76 virtual void CreateSyncComponents() = 0; | 82 virtual void CreateSyncComponents() = 0; |
77 | 83 |
78 // DataTypeController interface. | 84 // DataTypeController interface. |
79 virtual void OnModelLoaded() OVERRIDE; | 85 virtual void OnModelLoaded() OVERRIDE; |
80 | 86 |
81 // Perform any DataType controller specific state cleanup before stopping | 87 // Perform any DataType controller specific state cleanup before stopping |
82 // the datatype controller. The default implementation is a no-op. | 88 // the datatype controller. The default implementation is a no-op. |
83 virtual void CleanUpState(); | 89 virtual void CleanUpState(); |
84 | 90 |
85 // Helper methods for cleaning up state an running the start callback. | 91 // Helper methods for cleaning up state an running the start callback. |
86 virtual void StartFailed(StartResult result, const SyncError& error); | 92 virtual void StartFailed(StartResult result, const csync::SyncError& error); |
87 virtual void FinishStart(StartResult result); | 93 virtual void FinishStart(StartResult result); |
88 | 94 |
89 // Record association time. | 95 // Record association time. |
90 virtual void RecordAssociationTime(base::TimeDelta time); | 96 virtual void RecordAssociationTime(base::TimeDelta time); |
91 // Record causes of start failure. | 97 // Record causes of start failure. |
92 virtual void RecordStartFailure(StartResult result); | 98 virtual void RecordStartFailure(StartResult result); |
93 | 99 |
94 virtual AssociatorInterface* model_associator() const; | 100 virtual AssociatorInterface* model_associator() const; |
95 virtual void set_model_associator(AssociatorInterface* associator); | 101 virtual void set_model_associator(AssociatorInterface* associator); |
96 virtual ChangeProcessor* change_processor() const; | 102 virtual ChangeProcessor* change_processor() const; |
(...skipping 26 matching lines...) Expand all Loading... |
123 // Clean up our state and state variables. Called in response | 129 // Clean up our state and state variables. Called in response |
124 // to a failure or abort or stop. | 130 // to a failure or abort or stop. |
125 void CleanUp(); | 131 void CleanUp(); |
126 | 132 |
127 DISALLOW_COPY_AND_ASSIGN(FrontendDataTypeController); | 133 DISALLOW_COPY_AND_ASSIGN(FrontendDataTypeController); |
128 }; | 134 }; |
129 | 135 |
130 } // namespace browser_sync | 136 } // namespace browser_sync |
131 | 137 |
132 #endif // CHROME_BROWSER_SYNC_GLUE_FRONTEND_DATA_TYPE_CONTROLLER_H__ | 138 #endif // CHROME_BROWSER_SYNC_GLUE_FRONTEND_DATA_TYPE_CONTROLLER_H__ |
OLD | NEW |