OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_API_LOCAL_CHANGE_OBSERVER_H_ | 5 #ifndef COMPONENTS_SYNC_MODEL_LOCAL_CHANGE_OBSERVER_H_ |
6 #define COMPONENTS_SYNC_API_LOCAL_CHANGE_OBSERVER_H_ | 6 #define COMPONENTS_SYNC_MODEL_LOCAL_CHANGE_OBSERVER_H_ |
7 | 7 |
8 namespace syncer { | 8 namespace syncer { |
9 | 9 |
10 class SyncChange; | 10 class SyncChange; |
11 namespace syncable { | 11 namespace syncable { |
12 class Entry; | 12 class Entry; |
13 } // namespace syncable | 13 } // namespace syncable |
14 | 14 |
15 // Interface for observers that want to be notified of local sync changes. | 15 // Interface for observers that want to be notified of local sync changes. |
16 // The OnLocalChange function will be called when a local change made through | 16 // The OnLocalChange function will be called when a local change made through |
17 // ProcessSyncChanges is about to be applied to the directory. This is useful | 17 // ProcessSyncChanges is about to be applied to the directory. This is useful |
18 // for inspecting the specifics of sync data being written locally and comparing | 18 // for inspecting the specifics of sync data being written locally and comparing |
19 // it against the current state of the directory. Registering a local change | 19 // it against the current state of the directory. Registering a local change |
20 // observer is done by calling the AddLocalChangeObserver function on an | 20 // observer is done by calling the AddLocalChangeObserver function on an |
21 // instance of SyncChangeProcessor. | 21 // instance of SyncChangeProcessor. |
22 class LocalChangeObserver { | 22 class LocalChangeObserver { |
23 public: | 23 public: |
24 virtual ~LocalChangeObserver() {} | 24 virtual ~LocalChangeObserver() {} |
25 // Function called to notify observer of the local change. current_entry | 25 // Function called to notify observer of the local change. current_entry |
26 // should reflect the state of the entry *before* change is applied. | 26 // should reflect the state of the entry *before* change is applied. |
27 virtual void OnLocalChange(const syncable::Entry* current_entry, | 27 virtual void OnLocalChange(const syncable::Entry* current_entry, |
28 const SyncChange& change) = 0; | 28 const SyncChange& change) = 0; |
29 }; | 29 }; |
30 } // namespace syncer | 30 } // namespace syncer |
31 | 31 |
32 #endif // COMPONENTS_SYNC_API_LOCAL_CHANGE_OBSERVER_H_ | 32 #endif // COMPONENTS_SYNC_MODEL_LOCAL_CHANGE_OBSERVER_H_ |
OLD | NEW |