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 "chrome/browser/sync/glue/change_processor.h" |
| 13 #include "sync/protocol/sync.pb.h" |
| 14 |
| 15 namespace browser_sync { |
| 16 |
| 17 class DeviceInfo; |
| 18 |
| 19 class SyncedDeviceTracker : public ChangeProcessor { |
| 20 public: |
| 21 SyncedDeviceTracker(); |
| 22 virtual ~SyncedDeviceTracker(); |
| 23 |
| 24 // ChangeProcessor methods |
| 25 virtual void StartImpl(Profile* profile) OVERRIDE; |
| 26 virtual void StopImpl() OVERRIDE; |
| 27 virtual void ApplyChangesFromSyncModel( |
| 28 const syncer::BaseTransaction* trans, |
| 29 const syncer::ImmutableChangeRecordList& changes) OVERRIDE; |
| 30 virtual void CommitChangesFromSyncModel() OVERRIDE; |
| 31 |
| 32 // Methods for accessing and updating the device_info list. |
| 33 // These are virtual for testing. |
| 34 virtual bool ReadLocalDeviceInfo(const syncer::BaseTransaction &trans, |
| 35 DeviceInfo* out); |
| 36 virtual bool ReadLocalDeviceInfo(DeviceInfo* out); |
| 37 virtual void InitLocalDeviceInfo(const base::Closure& callback); |
| 38 |
| 39 private: |
| 40 friend class SyncedDeviceTrackerTest; |
| 41 |
| 42 void InitLocalDeviceInfoContinuation(const base::Closure& callback, |
| 43 const DeviceInfo& local_info); |
| 44 |
| 45 // Helper to write specifics into our node. Also useful for testing. |
| 46 void WriteLocalDeviceInfo(const DeviceInfo& info); |
| 47 |
| 48 base::WeakPtrFactory<SyncedDeviceTracker> weak_factory_; |
| 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(SyncedDeviceTracker); |
| 51 }; |
| 52 |
| 53 } // namespace browser_sync |
| 54 |
| 55 #endif // CHROME_BROWSER_SYNC_GLUE_SYNCED_DEVICE_TRACKER_H_ |
OLD | NEW |