Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNCED_DEVICE_TRACKER_H_ | |
| 6 #define CHROME_BROWSER_SYNC_GLUE_SYNCED_DEVICE_TRACKER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/memory/weak_ptr.h" | |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "chrome/browser/sync/glue/change_processor.h" | |
| 14 #include "sync/protocol/sync.pb.h" | |
|
Nicolas Zea
2012/11/16 19:42:27
is this necessary?
rlarocque
2012/11/17 00:07:21
Not anymore. Good catch.
| |
| 15 | |
| 16 namespace browser_sync { | |
| 17 | |
| 18 class DeviceInfo; | |
| 19 | |
| 20 class SyncedDeviceTracker : public ChangeProcessor { | |
| 21 public: | |
| 22 explicit SyncedDeviceTracker(const std::string& cache_guid); | |
| 23 virtual ~SyncedDeviceTracker(); | |
| 24 | |
| 25 // ChangeProcessor methods | |
| 26 virtual void StartImpl(Profile* profile) OVERRIDE; | |
| 27 virtual void ApplyChangesFromSyncModel( | |
| 28 const syncer::BaseTransaction* trans, | |
| 29 int64 model_version, | |
| 30 const syncer::ImmutableChangeRecordList& changes) OVERRIDE; | |
| 31 virtual void CommitChangesFromSyncModel() OVERRIDE; | |
| 32 | |
| 33 // Methods for accessing and updating the device_info list. | |
| 34 // These are virtual for testing. | |
| 35 virtual scoped_ptr<DeviceInfo> ReadLocalDeviceInfo( | |
| 36 const syncer::BaseTransaction &trans); | |
| 37 virtual scoped_ptr<DeviceInfo> ReadLocalDeviceInfo(); | |
| 38 virtual void InitLocalDeviceInfo(const base::Closure& callback); | |
| 39 | |
| 40 private: | |
| 41 friend class SyncedDeviceTrackerTest; | |
| 42 | |
| 43 void InitLocalDeviceInfoContinuation(const base::Closure& callback, | |
| 44 const DeviceInfo& local_info); | |
| 45 | |
| 46 // Helper to write specifics into our node. Also useful for testing. | |
| 47 void WriteLocalDeviceInfo(const DeviceInfo& info); | |
| 48 | |
| 49 base::WeakPtrFactory<SyncedDeviceTracker> weak_factory_; | |
| 50 | |
| 51 const std::string cache_guid_; | |
| 52 const std::string local_device_info_tag_; | |
| 53 | |
| 54 DISALLOW_COPY_AND_ASSIGN(SyncedDeviceTracker); | |
| 55 }; | |
| 56 | |
| 57 } // namespace browser_sync | |
| 58 | |
| 59 #endif // CHROME_BROWSER_SYNC_GLUE_SYNCED_DEVICE_TRACKER_H_ | |
| OLD | NEW |