OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_API_SYNCABLE_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_API_SYNCABLE_SERVICE_H_ |
6 #define CHROME_BROWSER_SYNC_API_SYNCABLE_SERVICE_H_ | 6 #define CHROME_BROWSER_SYNC_API_SYNCABLE_SERVICE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/weak_ptr.h" | |
12 #include "chrome/browser/sync/syncable/model_type.h" | 13 #include "chrome/browser/sync/syncable/model_type.h" |
13 #include "chrome/browser/sync/api/sync_change_processor.h" | 14 #include "chrome/browser/sync/api/sync_change_processor.h" |
14 #include "chrome/browser/sync/api/sync_data.h" | 15 #include "chrome/browser/sync/api/sync_data.h" |
15 #include "chrome/browser/sync/api/sync_error.h" | 16 #include "chrome/browser/sync/api/sync_error.h" |
16 | 17 |
17 class SyncData; | 18 class SyncData; |
18 | 19 |
19 typedef std::vector<SyncData> SyncDataList; | 20 typedef std::vector<SyncData> SyncDataList; |
20 | 21 |
21 class SyncableService : public SyncChangeProcessor { | 22 class SyncableService : public SyncChangeProcessor, |
23 public base::SupportsWeakPtr<SyncableService> { | |
akalin
2011/10/11 22:41:08
I don't like making this interface a non-interface
Nicolas Zea
2011/10/12 04:24:19
Done, and changed all implementations of SyncableS
| |
22 public: | 24 public: |
23 // Informs the service to begin syncing the specified synced datatype |type|. | 25 // Informs the service to begin syncing the specified synced datatype |type|. |
24 // The service should then merge |initial_sync_data| into it's local data, | 26 // The service should then merge |initial_sync_data| into it's local data, |
25 // calling |sync_processor|'s ProcessSyncChanges as necessary to reconcile the | 27 // calling |sync_processor|'s ProcessSyncChanges as necessary to reconcile the |
26 // two. After this, the SyncableService's local data should match the server | 28 // two. After this, the SyncableService's local data should match the server |
27 // data, and the service should be ready to receive and process any further | 29 // data, and the service should be ready to receive and process any further |
28 // SyncChange's as they occur. | 30 // SyncChange's as they occur. |
29 // Returns: A default SyncError (IsSet() == false) if no errors were | 31 // Returns: A default SyncError (IsSet() == false) if no errors were |
30 // encountered, and a filled SyncError (IsSet() == true) | 32 // encountered, and a filled SyncError (IsSet() == true) |
31 // otherwise. | 33 // otherwise. |
(...skipping 17 matching lines...) Expand all Loading... | |
49 // otherwise. | 51 // otherwise. |
50 virtual SyncError ProcessSyncChanges( | 52 virtual SyncError ProcessSyncChanges( |
51 const tracked_objects::Location& from_here, | 53 const tracked_objects::Location& from_here, |
52 const SyncChangeList& change_list) OVERRIDE = 0; | 54 const SyncChangeList& change_list) OVERRIDE = 0; |
53 | 55 |
54 protected: | 56 protected: |
55 virtual ~SyncableService(); | 57 virtual ~SyncableService(); |
56 }; | 58 }; |
57 | 59 |
58 #endif // CHROME_BROWSER_SYNC_API_SYNCABLE_SERVICE_H_ | 60 #endif // CHROME_BROWSER_SYNC_API_SYNCABLE_SERVICE_H_ |
OLD | NEW |