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 <stdint.h> |
| 9 |
8 #include <map> | 10 #include <map> |
9 #include <string> | 11 #include <string> |
10 | 12 |
| 13 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
13 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
14 #include "components/sync_driver/device_info_tracker.h" | 17 #include "components/sync_driver/device_info_tracker.h" |
15 #include "sync/api/sync_change_processor.h" | 18 #include "sync/api/sync_change_processor.h" |
16 #include "sync/api/sync_data.h" | 19 #include "sync/api/sync_data.h" |
17 #include "sync/api/sync_error_factory.h" | 20 #include "sync/api/sync_error_factory.h" |
18 #include "sync/api/syncable_service.h" | 21 #include "sync/api/syncable_service.h" |
19 | 22 |
20 namespace sync_driver { | 23 namespace sync_driver { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 void DeleteSyncData(const std::string& client_id); | 73 void DeleteSyncData(const std::string& client_id); |
71 // Notify all registered observers. | 74 // Notify all registered observers. |
72 void NotifyObservers(); | 75 void NotifyObservers(); |
73 | 76 |
74 // Updates backup time in place in |sync_data| if it is different than | 77 // Updates backup time in place in |sync_data| if it is different than |
75 // the one stored in |local_device_backup_time_|. | 78 // the one stored in |local_device_backup_time_|. |
76 // Returns true if backup time was updated. | 79 // Returns true if backup time was updated. |
77 bool UpdateBackupTime(syncer::SyncData* sync_data); | 80 bool UpdateBackupTime(syncer::SyncData* sync_data); |
78 | 81 |
79 // |local_device_backup_time_| accessors. | 82 // |local_device_backup_time_| accessors. |
80 int64 local_device_backup_time() const { return local_device_backup_time_; } | 83 int64_t local_device_backup_time() const { return local_device_backup_time_; } |
81 bool has_local_device_backup_time() const { | 84 bool has_local_device_backup_time() const { |
82 return local_device_backup_time_ >= 0; | 85 return local_device_backup_time_ >= 0; |
83 } | 86 } |
84 void set_local_device_backup_time(int64 value) { | 87 void set_local_device_backup_time(int64_t value) { |
85 local_device_backup_time_ = value; | 88 local_device_backup_time_ = value; |
86 } | 89 } |
87 void clear_local_device_backup_time() { local_device_backup_time_ = -1; } | 90 void clear_local_device_backup_time() { local_device_backup_time_ = -1; } |
88 | 91 |
89 // Local device last set backup time (in proto format). | 92 // Local device last set backup time (in proto format). |
90 // -1 if the value hasn't been specified | 93 // -1 if the value hasn't been specified |
91 int64 local_device_backup_time_; | 94 int64_t local_device_backup_time_; |
92 | 95 |
93 // |local_device_info_provider_| isn't owned. | 96 // |local_device_info_provider_| isn't owned. |
94 const LocalDeviceInfoProvider* const local_device_info_provider_; | 97 const LocalDeviceInfoProvider* const local_device_info_provider_; |
95 | 98 |
96 // Receives ownership of |sync_processor_| and |error_handler_| in | 99 // Receives ownership of |sync_processor_| and |error_handler_| in |
97 // MergeDataAndStartSyncing() and destroy them in StopSyncing(). | 100 // MergeDataAndStartSyncing() and destroy them in StopSyncing(). |
98 scoped_ptr<syncer::SyncChangeProcessor> sync_processor_; | 101 scoped_ptr<syncer::SyncChangeProcessor> sync_processor_; |
99 scoped_ptr<syncer::SyncErrorFactory> error_handler_; | 102 scoped_ptr<syncer::SyncErrorFactory> error_handler_; |
100 | 103 |
101 // Cache of all syncable and local data. | 104 // Cache of all syncable and local data. |
102 typedef std::map<std::string, syncer::SyncData> SyncDataMap; | 105 typedef std::map<std::string, syncer::SyncData> SyncDataMap; |
103 SyncDataMap all_data_; | 106 SyncDataMap all_data_; |
104 | 107 |
105 // Registered observers, not owned. | 108 // Registered observers, not owned. |
106 base::ObserverList<Observer, true> observers_; | 109 base::ObserverList<Observer, true> observers_; |
107 | 110 |
108 DISALLOW_COPY_AND_ASSIGN(DeviceInfoSyncService); | 111 DISALLOW_COPY_AND_ASSIGN(DeviceInfoSyncService); |
109 }; | 112 }; |
110 | 113 |
111 } // namespace sync_driver | 114 } // namespace sync_driver |
112 | 115 |
113 #endif // COMPONENTS_SYNC_DRIVER_DEVICE_INFO_SYNC_SERVICE_H_ | 116 #endif // COMPONENTS_SYNC_DRIVER_DEVICE_INFO_SYNC_SERVICE_H_ |
OLD | NEW |