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_SHARED_CHANGE_PROCESSOR_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SHARED_CHANGE_PROCESSOR_H_ |
6 #define CHROME_BROWSER_SYNC_GLUE_SHARED_CHANGE_PROCESSOR_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_SHARED_CHANGE_PROCESSOR_H_ |
7 | 7 |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "base/message_loop/message_loop_proxy.h" | 11 #include "base/message_loop/message_loop_proxy.h" |
12 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
13 #include "chrome/browser/sync/glue/data_type_error_handler.h" | 13 #include "chrome/browser/sync/glue/data_type_error_handler.h" |
14 #include "sync/api/sync_change_processor.h" | 14 #include "sync/api/sync_change_processor.h" |
15 #include "sync/api/sync_error.h" | 15 #include "sync/api/sync_error.h" |
16 #include "sync/api/sync_error_factory.h" | 16 #include "sync/api/sync_error_factory.h" |
17 #include "sync/api/sync_merge_result.h" | 17 #include "sync/api/sync_merge_result.h" |
18 #include "sync/internal_api/public/engine/model_safe_worker.h" | 18 #include "sync/internal_api/public/engine/model_safe_worker.h" |
19 | 19 |
20 class ProfileSyncComponentsFactory; | 20 class ProfileSyncComponentsFactory; |
21 class ProfileSyncService; | 21 class ProfileSyncService; |
22 | 22 |
23 namespace syncer { | 23 namespace syncer { |
24 class SyncData; | 24 class SyncData; |
25 class SyncableService; | 25 class SyncableService; |
26 | 26 |
27 typedef std::vector<syncer::SyncData> SyncDataList; | 27 typedef std::vector<syncer::SyncData> SyncDataList; |
28 } // namespace | 28 } // namespace syncer |
29 | 29 |
30 namespace browser_sync { | 30 namespace browser_sync { |
31 | 31 |
32 class GenericChangeProcessor; | 32 class GenericChangeProcessor; |
33 class DataTypeErrorHandler; | 33 class DataTypeErrorHandler; |
34 | 34 |
35 // A ref-counted wrapper around a GenericChangeProcessor for use with datatypes | 35 // A ref-counted wrapper around a GenericChangeProcessor for use with datatypes |
36 // that don't live on the UI thread. | 36 // that don't live on the UI thread. |
37 // | 37 // |
38 // We need to make it refcounted as the ownership transfer from the | 38 // We need to make it refcounted as the ownership transfer from the |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // |local_service_| are dropped and return errors. The syncer will be safe to | 72 // |local_service_| are dropped and return errors. The syncer will be safe to |
73 // shut down from the point of view of this datatype. | 73 // shut down from the point of view of this datatype. |
74 // Note: Once disconnected, you cannot reconnect without creating a new | 74 // Note: Once disconnected, you cannot reconnect without creating a new |
75 // SharedChangeProcessor. | 75 // SharedChangeProcessor. |
76 // Returns: true if we were previously succesfully connected, false if we were | 76 // Returns: true if we were previously succesfully connected, false if we were |
77 // already disconnected. | 77 // already disconnected. |
78 virtual bool Disconnect(); | 78 virtual bool Disconnect(); |
79 | 79 |
80 // GenericChangeProcessor stubs (with disconnect support). | 80 // GenericChangeProcessor stubs (with disconnect support). |
81 // Should only be called on the same thread the datatype resides. | 81 // Should only be called on the same thread the datatype resides. |
82 virtual syncer::SyncError GetSyncData( | |
83 syncer::SyncDataList* current_sync_data); | |
84 virtual int GetSyncCount(); | 82 virtual int GetSyncCount(); |
85 virtual syncer::SyncError ProcessSyncChanges( | 83 virtual syncer::SyncError ProcessSyncChanges( |
86 const tracked_objects::Location& from_here, | 84 const tracked_objects::Location& from_here, |
87 const syncer::SyncChangeList& change_list); | 85 const syncer::SyncChangeList& change_list); |
| 86 virtual syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const; |
| 87 virtual syncer::SyncError GetAllSyncDataReturnError( |
| 88 syncer::ModelType type, |
| 89 syncer::SyncDataList* data) const; |
88 virtual bool SyncModelHasUserCreatedNodes(bool* has_nodes); | 90 virtual bool SyncModelHasUserCreatedNodes(bool* has_nodes); |
89 virtual bool CryptoReadyIfNecessary(); | 91 virtual bool CryptoReadyIfNecessary(); |
90 | 92 |
91 // Register |generic_change_processor_| as the change processor for the | 93 // Register |generic_change_processor_| as the change processor for the |
92 // current type on |model_safe_group|. | 94 // current type on |model_safe_group|. |
93 // Does nothing if |disconnected_| is true. | 95 // Does nothing if |disconnected_| is true. |
94 virtual void ActivateDataType(syncer::ModelSafeGroup model_safe_group); | 96 virtual void ActivateDataType(syncer::ModelSafeGroup model_safe_group); |
95 | 97 |
96 virtual syncer::SyncError CreateAndUploadError( | 98 virtual syncer::SyncError CreateAndUploadError( |
97 const tracked_objects::Location& location, | 99 const tracked_objects::Location& location, |
(...skipping 26 matching lines...) Expand all Loading... |
124 GenericChangeProcessor* generic_change_processor_; | 126 GenericChangeProcessor* generic_change_processor_; |
125 | 127 |
126 DataTypeErrorHandler* error_handler_; | 128 DataTypeErrorHandler* error_handler_; |
127 | 129 |
128 DISALLOW_COPY_AND_ASSIGN(SharedChangeProcessor); | 130 DISALLOW_COPY_AND_ASSIGN(SharedChangeProcessor); |
129 }; | 131 }; |
130 | 132 |
131 } // namespace browser_sync | 133 } // namespace browser_sync |
132 | 134 |
133 #endif // CHROME_BROWSER_SYNC_GLUE_SHARED_CHANGE_PROCESSOR_H_ | 135 #endif // CHROME_BROWSER_SYNC_GLUE_SHARED_CHANGE_PROCESSOR_H_ |
OLD | NEW |