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 | |
|
Nicolas Zea
2012/09/13 00:45:55
include string
rlarocque
2012/09/14 01:03:07
Done.
| |
| 8 #include "base/memory/weak_ptr.h" | |
| 9 #include "chrome/browser/sync/glue/change_processor.h" | |
| 10 | |
| 11 namespace browser_sync { | |
| 12 | |
| 13 // TODO: Move this into its own class. | |
|
Nicolas Zea
2012/09/13 00:45:55
nit: TODO(rlarocque)
rlarocque
2012/09/14 01:03:07
Done.
| |
| 14 // TODO: Create a class to manage a list of these. | |
| 15 struct DeviceInfo { | |
| 16 std::string session_name; | |
| 17 std::string platform; | |
| 18 std::string chrome_version; | |
| 19 }; | |
| 20 | |
| 21 class SyncedDeviceTracker : public base::SupportsWeakPtr<SyncedDeviceTracker>, | |
|
Nicolas Zea
2012/09/13 00:45:55
Does this need to inherit from SupportsWeakPtr? Un
rlarocque
2012/09/14 01:03:07
Done.
| |
| 22 public ChangeProcessor { | |
| 23 friend class SyncedDeviceTrackerTest; | |
|
Nicolas Zea
2012/09/13 00:45:55
nit: move this to the private section below
rlarocque
2012/09/14 01:03:07
Done.
rlarocque
2012/09/14 01:03:07
Done.
| |
| 24 | |
| 25 public: | |
| 26 SyncedDeviceTracker(); | |
| 27 virtual ~SyncedDeviceTracker(); | |
| 28 | |
| 29 // ChangeProcessor methods | |
| 30 virtual void StartImpl(Profile* profile) OVERRIDE; | |
| 31 virtual void StopImpl() OVERRIDE; | |
| 32 | |
| 33 virtual void ApplyChangesFromSyncModel( | |
| 34 const syncer::BaseTransaction* trans, | |
| 35 const syncer::ImmutableChangeRecordList& changes) OVERRIDE; | |
| 36 virtual void CommitChangesFromSyncModel() OVERRIDE; | |
| 37 | |
| 38 // Methods for accessing and updating the device_info list. | |
| 39 bool GetLocalDeviceInfo(syncer::BaseTransaction &trans, | |
|
Nicolas Zea
2012/09/13 00:45:55
const syncer::BaseTransaction& trans
rlarocque
2012/09/14 01:03:07
Done.
| |
| 40 DeviceInfo* out); | |
| 41 bool GetLocalDeviceInfo(DeviceInfo* out); | |
| 42 void InitLocalDeviceInfo(const base::Closure& callback); | |
| 43 | |
| 44 private: | |
| 45 void InitLocalDeviceInfoContinuation(const base::Closure& callback, | |
| 46 const std::string& session_name); | |
| 47 | |
| 48 // Helper to write specifics into our node. Also useful for testing. | |
| 49 void WriteLocalDeviceInfo(const DeviceInfo& info); | |
| 50 | |
| 51 DISALLOW_COPY_AND_ASSIGN(SyncedDeviceTracker); | |
| 52 }; | |
| 53 | |
| 54 } // namespace browser_sync | |
| 55 | |
| 56 #endif // CHROME_BROWSER_SYNC_GLUE_SYNCED_DEVICE_TRACKER_H_ | |
| OLD | NEW |