| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_DRIVER_DEVICE_INFO_SYNC_SERVICE_H_ | 5 #ifndef COMPONENTS_SYNC_DRIVER_DEVICE_INFO_SYNC_SERVICE_H_ |
| 6 #define COMPONENTS_SYNC_DRIVER_DEVICE_INFO_SYNC_SERVICE_H_ | 6 #define COMPONENTS_SYNC_DRIVER_DEVICE_INFO_SYNC_SERVICE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/scoped_vector.h" |
| 11 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
| 12 #include "components/sync_driver/device_info_tracker.h" | 14 #include "components/sync_driver/device_info_tracker.h" |
| 13 #include "sync/api/sync_change_processor.h" | 15 #include "sync/api/sync_change_processor.h" |
| 14 #include "sync/api/sync_data.h" | 16 #include "sync/api/sync_data.h" |
| 15 #include "sync/api/sync_error_factory.h" | 17 #include "sync/api/sync_error_factory.h" |
| 16 #include "sync/api/syncable_service.h" | 18 #include "sync/api/syncable_service.h" |
| 17 | 19 |
| 18 namespace sync_driver { | 20 namespace sync_driver { |
| 19 | 21 |
| 20 class LocalDeviceInfoProvider; | 22 class LocalDeviceInfoProvider; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 base::Time GetLocalDeviceBackupTime() const; | 55 base::Time GetLocalDeviceBackupTime() const; |
| 54 | 56 |
| 55 private: | 57 private: |
| 56 // Create SyncData from local DeviceInfo and |local_device_backup_time_|. | 58 // Create SyncData from local DeviceInfo and |local_device_backup_time_|. |
| 57 syncer::SyncData CreateLocalData(const DeviceInfo* info); | 59 syncer::SyncData CreateLocalData(const DeviceInfo* info); |
| 58 // Create SyncData from EntitySpecifics. | 60 // Create SyncData from EntitySpecifics. |
| 59 static syncer::SyncData CreateLocalData( | 61 static syncer::SyncData CreateLocalData( |
| 60 const sync_pb::EntitySpecifics& entity); | 62 const sync_pb::EntitySpecifics& entity); |
| 61 | 63 |
| 62 // Allocate new DeviceInfo from SyncData. | 64 // Allocate new DeviceInfo from SyncData. |
| 63 static DeviceInfo* CreateDeviceInfo(const syncer::SyncData sync_data); | 65 static DeviceInfo* CreateDeviceInfo(const syncer::SyncData& sync_data); |
| 64 // Store SyncData in the cache. | 66 // Store SyncData in the cache. |
| 65 void StoreSyncData(const std::string& client_id, | 67 void StoreSyncData(const std::string& client_id, |
| 66 const syncer::SyncData& sync_data); | 68 const syncer::SyncData& sync_data); |
| 67 // Delete SyncData from the cache. | 69 // Delete SyncData from the cache. |
| 68 void DeleteSyncData(const std::string& client_id); | 70 void DeleteSyncData(const std::string& client_id); |
| 69 // Notify all registered observers. | 71 // Notify all registered observers. |
| 70 void NotifyObservers(); | 72 void NotifyObservers(); |
| 71 | 73 |
| 72 // Updates backup time in place in |sync_data| if it is different than | 74 // Updates backup time in place in |sync_data| if it is different than |
| 73 // the one stored in |local_device_backup_time_|. | 75 // the one stored in |local_device_backup_time_|. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 102 | 104 |
| 103 // Registered observers, not owned. | 105 // Registered observers, not owned. |
| 104 base::ObserverList<Observer, true> observers_; | 106 base::ObserverList<Observer, true> observers_; |
| 105 | 107 |
| 106 DISALLOW_COPY_AND_ASSIGN(DeviceInfoSyncService); | 108 DISALLOW_COPY_AND_ASSIGN(DeviceInfoSyncService); |
| 107 }; | 109 }; |
| 108 | 110 |
| 109 } // namespace sync_driver | 111 } // namespace sync_driver |
| 110 | 112 |
| 111 #endif // COMPONENTS_SYNC_DRIVER_DEVICE_INFO_SYNC_SERVICE_H_ | 113 #endif // COMPONENTS_SYNC_DRIVER_DEVICE_INFO_SYNC_SERVICE_H_ |
| OLD | NEW |