Index: chrome/browser/sync/glue/synced_device_tracker.h |
diff --git a/chrome/browser/sync/glue/synced_device_tracker.h b/chrome/browser/sync/glue/synced_device_tracker.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e454e194774f483bfbd89806c5cb4f59b1e303a6 |
--- /dev/null |
+++ b/chrome/browser/sync/glue/synced_device_tracker.h |
@@ -0,0 +1,56 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_SYNC_GLUE_SYNCED_DEVICE_TRACKER_H_ |
+#define CHROME_BROWSER_SYNC_GLUE_SYNCED_DEVICE_TRACKER_H_ |
+ |
Nicolas Zea
2012/09/13 00:45:55
include string
rlarocque
2012/09/14 01:03:07
Done.
|
+#include "base/memory/weak_ptr.h" |
+#include "chrome/browser/sync/glue/change_processor.h" |
+ |
+namespace browser_sync { |
+ |
+// 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.
|
+// TODO: Create a class to manage a list of these. |
+struct DeviceInfo { |
+ std::string session_name; |
+ std::string platform; |
+ std::string chrome_version; |
+}; |
+ |
+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.
|
+ public ChangeProcessor { |
+ 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.
|
+ |
+ public: |
+ SyncedDeviceTracker(); |
+ virtual ~SyncedDeviceTracker(); |
+ |
+ // ChangeProcessor methods |
+ virtual void StartImpl(Profile* profile) OVERRIDE; |
+ virtual void StopImpl() OVERRIDE; |
+ |
+ virtual void ApplyChangesFromSyncModel( |
+ const syncer::BaseTransaction* trans, |
+ const syncer::ImmutableChangeRecordList& changes) OVERRIDE; |
+ virtual void CommitChangesFromSyncModel() OVERRIDE; |
+ |
+ // Methods for accessing and updating the device_info list. |
+ 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.
|
+ DeviceInfo* out); |
+ bool GetLocalDeviceInfo(DeviceInfo* out); |
+ void InitLocalDeviceInfo(const base::Closure& callback); |
+ |
+ private: |
+ void InitLocalDeviceInfoContinuation(const base::Closure& callback, |
+ const std::string& session_name); |
+ |
+ // Helper to write specifics into our node. Also useful for testing. |
+ void WriteLocalDeviceInfo(const DeviceInfo& info); |
+ |
+ DISALLOW_COPY_AND_ASSIGN(SyncedDeviceTracker); |
+}; |
+ |
+} // namespace browser_sync |
+ |
+#endif // CHROME_BROWSER_SYNC_GLUE_SYNCED_DEVICE_TRACKER_H_ |