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_NON_FRONTEND_DATA_TYPE_CONTROLLER_H__ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_NON_FRONTEND_DATA_TYPE_CONTROLLER_H__ |
6 #define CHROME_BROWSER_SYNC_GLUE_NON_FRONTEND_DATA_TYPE_CONTROLLER_H__ | 6 #define CHROME_BROWSER_SYNC_GLUE_NON_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/callback_forward.h" | 12 #include "base/callback_forward.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
16 #include "base/synchronization/waitable_event.h" | 16 #include "base/synchronization/waitable_event.h" |
17 #include "chrome/browser/sync/glue/data_type_controller.h" | 17 #include "chrome/browser/sync/glue/data_type_controller.h" |
18 #include "chrome/browser/sync/glue/data_type_error_handler.h" | 18 #include "chrome/browser/sync/glue/data_type_error_handler.h" |
19 | 19 |
20 class Profile; | 20 class Profile; |
21 class ProfileSyncService; | 21 class ProfileSyncService; |
22 class ProfileSyncComponentsFactory; | 22 class ProfileSyncComponentsFactory; |
| 23 |
| 24 namespace base { |
| 25 class TimeDelta; |
| 26 } |
| 27 |
| 28 namespace csync { |
23 class SyncError; | 29 class SyncError; |
| 30 } |
24 | 31 |
25 namespace base { class TimeDelta; } | |
26 namespace browser_sync { | 32 namespace browser_sync { |
27 | 33 |
28 class AssociatorInterface; | 34 class AssociatorInterface; |
29 class ChangeProcessor; | 35 class ChangeProcessor; |
30 | 36 |
31 // TODO(zea): Rename frontend to UI (http://crbug.com/78833). | 37 // TODO(zea): Rename frontend to UI (http://crbug.com/78833). |
32 // Implementation for datatypes that do not reside on the frontend thread | 38 // Implementation for datatypes that do not reside on the frontend thread |
33 // (UI thread). This is the same thread we perform initialization | 39 // (UI thread). This is the same thread we perform initialization |
34 // on, so we don't have to worry about thread safety. The main start/stop | 40 // on, so we don't have to worry about thread safety. The main start/stop |
35 // funtionality is implemented by default. Derived classes must implement: | 41 // funtionality is implemented by default. Derived classes must implement: |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 const tracked_objects::Location& from_here, | 94 const tracked_objects::Location& from_here, |
89 const base::Closure& task) = 0; | 95 const base::Closure& task) = 0; |
90 | 96 |
91 // Datatype specific creation of sync components. | 97 // Datatype specific creation of sync components. |
92 // Note: this is performed on the datatype's thread. | 98 // Note: this is performed on the datatype's thread. |
93 virtual void CreateSyncComponents() = 0; | 99 virtual void CreateSyncComponents() = 0; |
94 | 100 |
95 // Start failed, make sure we record it, clean up state, and invoke the | 101 // Start failed, make sure we record it, clean up state, and invoke the |
96 // callback on the frontend thread. | 102 // callback on the frontend thread. |
97 // Note: this is performed on the datatype's thread. | 103 // Note: this is performed on the datatype's thread. |
98 virtual void StartFailed(StartResult result, const SyncError& error); | 104 virtual void StartFailed(StartResult result, const csync::SyncError& error); |
99 | 105 |
100 // Start up complete, update the state and invoke the callback. | 106 // Start up complete, update the state and invoke the callback. |
101 // Note: this is performed on the datatype's thread. | 107 // Note: this is performed on the datatype's thread. |
102 virtual void StartDone(DataTypeController::StartResult result, | 108 virtual void StartDone(DataTypeController::StartResult result, |
103 DataTypeController::State new_state, | 109 DataTypeController::State new_state, |
104 const SyncError& error); | 110 const csync::SyncError& error); |
105 | 111 |
106 // UI thread implementation of StartDone. | 112 // UI thread implementation of StartDone. |
107 virtual void StartDoneImpl(DataTypeController::StartResult result, | 113 virtual void StartDoneImpl(DataTypeController::StartResult result, |
108 DataTypeController::State new_state, | 114 DataTypeController::State new_state, |
109 const SyncError& error); | 115 const csync::SyncError& error); |
110 | 116 |
111 // Perform any DataType controller specific state cleanup before stopping | 117 // Perform any DataType controller specific state cleanup before stopping |
112 // the datatype controller. The default implementation is a no-op. | 118 // the datatype controller. The default implementation is a no-op. |
113 // Note: this is performed on the frontend (UI) thread. | 119 // Note: this is performed on the frontend (UI) thread. |
114 virtual void StopModels(); | 120 virtual void StopModels(); |
115 | 121 |
116 // The actual implementation of Disabling the datatype. This happens | 122 // The actual implementation of Disabling the datatype. This happens |
117 // on the UI thread. | 123 // on the UI thread. |
118 virtual void DisableImpl(const tracked_objects::Location& from_here, | 124 virtual void DisableImpl(const tracked_objects::Location& from_here, |
119 const std::string& message); | 125 const std::string& message); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 // This is added for debugging purpose. | 191 // This is added for debugging purpose. |
186 // TODO(lipalani): Remove after debugging. | 192 // TODO(lipalani): Remove after debugging. |
187 bool start_models_failed_; | 193 bool start_models_failed_; |
188 | 194 |
189 DISALLOW_COPY_AND_ASSIGN(NonFrontendDataTypeController); | 195 DISALLOW_COPY_AND_ASSIGN(NonFrontendDataTypeController); |
190 }; | 196 }; |
191 | 197 |
192 } // namespace browser_sync | 198 } // namespace browser_sync |
193 | 199 |
194 #endif // CHROME_BROWSER_SYNC_GLUE_NON_FRONTEND_DATA_TYPE_CONTROLLER_H__ | 200 #endif // CHROME_BROWSER_SYNC_GLUE_NON_FRONTEND_DATA_TYPE_CONTROLLER_H__ |
OLD | NEW |