Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3806)

Unified Diff: chrome/browser/sync/glue/synced_device_tracker.h

Issue 10911073: NOT FOR COMMIT: Add DeviceInfo type and ChangeProcessor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix several issues Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..5fd034abab0fba23449b883008388c3997c40d6a
--- /dev/null
+++ b/chrome/browser/sync/glue/synced_device_tracker.h
@@ -0,0 +1,55 @@
+// 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_
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/memory/weak_ptr.h"
+#include "chrome/browser/sync/glue/change_processor.h"
+#include "sync/protocol/sync.pb.h"
+
+namespace browser_sync {
+
+class DeviceInfo;
+
+class SyncedDeviceTracker : public ChangeProcessor {
+ 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.
+ // These are virtual for testing.
+ virtual bool ReadLocalDeviceInfo(const syncer::BaseTransaction &trans,
+ DeviceInfo* out);
+ virtual bool ReadLocalDeviceInfo(DeviceInfo* out);
+ virtual void InitLocalDeviceInfo(const base::Closure& callback);
+
+ private:
+ friend class SyncedDeviceTrackerTest;
+
+ void InitLocalDeviceInfoContinuation(const base::Closure& callback,
+ const DeviceInfo& local_info);
+
+ // Helper to write specifics into our node. Also useful for testing.
+ void WriteLocalDeviceInfo(const DeviceInfo& info);
+
+ base::WeakPtrFactory<SyncedDeviceTracker> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(SyncedDeviceTracker);
+};
+
+} // namespace browser_sync
+
+#endif // CHROME_BROWSER_SYNC_GLUE_SYNCED_DEVICE_TRACKER_H_
« no previous file with comments | « chrome/browser/sync/glue/sync_backend_registrar.cc ('k') | chrome/browser/sync/glue/synced_device_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698