| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_SERVICE_H_ | 5 #ifndef COMPONENTS_SYNC_DRIVER_DEVICE_INFO_SERVICE_H_ |
| 6 #define COMPONENTS_SYNC_DRIVER_DEVICE_INFO_SERVICE_H_ | 6 #define COMPONENTS_SYNC_DRIVER_DEVICE_INFO_SERVICE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 scoped_ptr<sync_driver::DeviceInfo> GetDeviceInfo( | 69 scoped_ptr<sync_driver::DeviceInfo> GetDeviceInfo( |
| 70 const std::string& client_id) const override; | 70 const std::string& client_id) const override; |
| 71 ScopedVector<sync_driver::DeviceInfo> GetAllDeviceInfo() const override; | 71 ScopedVector<sync_driver::DeviceInfo> GetAllDeviceInfo() const override; |
| 72 void AddObserver(Observer* observer) override; | 72 void AddObserver(Observer* observer) override; |
| 73 void RemoveObserver(Observer* observer) override; | 73 void RemoveObserver(Observer* observer) override; |
| 74 int CountActiveDevices() const override; | 74 int CountActiveDevices() const override; |
| 75 | 75 |
| 76 private: | 76 private: |
| 77 friend class DeviceInfoServiceTest; | 77 friend class DeviceInfoServiceTest; |
| 78 | 78 |
| 79 // Formats ClientTag form DeviceInfoSpecifics. |
| 80 static std::string SpecificsToTag( |
| 81 const sync_pb::DeviceInfoSpecifics& specifics); |
| 82 |
| 83 // Extracts cache_guid from ClientTag. |
| 84 static std::string TagToCacheGuid(const std::string& tag); |
| 85 |
| 79 static scoped_ptr<sync_pb::DeviceInfoSpecifics> CopyToSpecifics( | 86 static scoped_ptr<sync_pb::DeviceInfoSpecifics> CopyToSpecifics( |
| 80 const sync_driver::DeviceInfo& info); | 87 const sync_driver::DeviceInfo& info); |
| 81 | 88 |
| 82 // Allocate new DeviceInfo from SyncData. | 89 // Allocate new DeviceInfo from SyncData. |
| 83 static scoped_ptr<sync_driver::DeviceInfo> CopyToModel( | 90 static scoped_ptr<sync_driver::DeviceInfo> CopyToModel( |
| 84 const sync_pb::DeviceInfoSpecifics& specifics); | 91 const sync_pb::DeviceInfoSpecifics& specifics); |
| 85 // Conversion as we prepare to hand data to the processor. | 92 // Conversion as we prepare to hand data to the processor. |
| 86 static scoped_ptr<syncer_v2::EntityData> CopyToEntityData( | 93 static scoped_ptr<syncer_v2::EntityData> CopyToEntityData( |
| 87 const sync_pb::DeviceInfoSpecifics& specifics); | 94 const sync_pb::DeviceInfoSpecifics& specifics); |
| 88 | 95 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 160 |
| 154 // Should always be last member. | 161 // Should always be last member. |
| 155 base::WeakPtrFactory<DeviceInfoService> weak_factory_; | 162 base::WeakPtrFactory<DeviceInfoService> weak_factory_; |
| 156 | 163 |
| 157 DISALLOW_COPY_AND_ASSIGN(DeviceInfoService); | 164 DISALLOW_COPY_AND_ASSIGN(DeviceInfoService); |
| 158 }; | 165 }; |
| 159 | 166 |
| 160 } // namespace sync_driver_v2 | 167 } // namespace sync_driver_v2 |
| 161 | 168 |
| 162 #endif // COMPONENTS_SYNC_DRIVER_DEVICE_INFO_SERVICE_H_ | 169 #endif // COMPONENTS_SYNC_DRIVER_DEVICE_INFO_SERVICE_H_ |
| OLD | NEW |