1 // Copyright 2014 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.
5 #ifndef COMPONENTS_SYNC_DRIVER_DEVICE_INFO_TRACKER_H_
6 #define COMPONENTS_SYNC_DRIVER_DEVICE_INFO_TRACKER_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/scoped_vector.h"
10 #include "components/sync_driver/device_info.h"
12 namespace sync_driver
{
14 // Interface for tracking synced DeviceInfo.
15 class DeviceInfoTracker
{
17 virtual ~DeviceInfoTracker() {}
19 // Observer class for listening to device info changes.
22 virtual void OnDeviceInfoChange() = 0;
25 // Returns true when DeviceInfo datatype is enabled and syncing.
26 virtual bool IsSyncing() const = 0;
27 // Gets DeviceInfo the synced device with specified client ID.
28 // Returns an empty scoped_ptr if device with the given |client_id| hasn't
30 virtual scoped_ptr
<DeviceInfo
> GetDeviceInfo(
31 const std::string
& client_id
) const = 0;
32 // Gets DeviceInfo for all synced devices (including the local one).
33 virtual ScopedVector
<DeviceInfo
> GetAllDeviceInfo() const = 0;
34 // Registers an observer to be called on syncing any updated DeviceInfo.
35 virtual void AddObserver(Observer
* observer
) = 0;
36 // Unregisters an observer.
37 virtual void RemoveObserver(Observer
* observer
) = 0;
40 } // namespace sync_driver
42 #endif // COMPONENTS_SYNC_DRIVER_DEVICE_INFO_TRACKER_H_