blob: e9007d304362fb7014b7923068850447d6abe704 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
// 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/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/sync/glue/change_processor.h"
namespace syncer {
struct UserShare;
}
namespace browser_sync {
class DeviceInfo;
class SyncedDeviceTracker : public ChangeProcessor {
public:
SyncedDeviceTracker(syncer::UserShare* user_share,
const std::string& cache_guid);
virtual ~SyncedDeviceTracker();
// ChangeProcessor methods
virtual void StartImpl(Profile* profile) OVERRIDE;
virtual void ApplyChangesFromSyncModel(
const syncer::BaseTransaction* trans,
int64 model_version,
const syncer::ImmutableChangeRecordList& changes) OVERRIDE;
virtual void CommitChangesFromSyncModel() OVERRIDE;
// Methods for accessing and updating the device_info list.
// These are virtual for testing.
virtual scoped_ptr<DeviceInfo> ReadLocalDeviceInfo(
const syncer::BaseTransaction &trans) const;
virtual scoped_ptr<DeviceInfo> ReadLocalDeviceInfo() const;
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_;
syncer::UserShare* user_share_;
const std::string cache_guid_;
const std::string local_device_info_tag_;
DISALLOW_COPY_AND_ASSIGN(SyncedDeviceTracker);
};
} // namespace browser_sync
#endif // CHROME_BROWSER_SYNC_GLUE_SYNCED_DEVICE_TRACKER_H_
|