OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_SYNC_DEVICE_INFO_DEVICE_INFO_TRACKER_H_ | 5 #ifndef COMPONENTS_SYNC_DEVICE_INFO_DEVICE_INFO_TRACKER_H_ |
6 #define COMPONENTS_SYNC_DEVICE_INFO_DEVICE_INFO_TRACKER_H_ | 6 #define COMPONENTS_SYNC_DEVICE_INFO_DEVICE_INFO_TRACKER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
pavely
2016/09/07 17:03:59
Could you remove scoped_vector.h?
lazyboy
2016/09/07 19:45:02
Done.
| |
12 #include "components/sync/device_info/device_info.h" | 12 #include "components/sync/device_info/device_info.h" |
13 | 13 |
14 namespace sync_driver { | 14 namespace sync_driver { |
15 | 15 |
16 // Interface for tracking synced DeviceInfo. | 16 // Interface for tracking synced DeviceInfo. |
17 class DeviceInfoTracker { | 17 class DeviceInfoTracker { |
18 public: | 18 public: |
19 virtual ~DeviceInfoTracker() {} | 19 virtual ~DeviceInfoTracker() {} |
20 | 20 |
21 // Observer class for listening to device info changes. | 21 // Observer class for listening to device info changes. |
22 class Observer { | 22 class Observer { |
23 public: | 23 public: |
24 virtual void OnDeviceInfoChange() = 0; | 24 virtual void OnDeviceInfoChange() = 0; |
25 }; | 25 }; |
26 | 26 |
27 // Returns true when DeviceInfo datatype is enabled and syncing. | 27 // Returns true when DeviceInfo datatype is enabled and syncing. |
28 virtual bool IsSyncing() const = 0; | 28 virtual bool IsSyncing() const = 0; |
29 // Gets DeviceInfo the synced device with specified client ID. | 29 // Gets DeviceInfo the synced device with specified client ID. |
30 // Returns an empty unique_ptr if device with the given |client_id| hasn't | 30 // Returns an empty unique_ptr if device with the given |client_id| hasn't |
31 // been synced. | 31 // been synced. |
32 virtual std::unique_ptr<DeviceInfo> GetDeviceInfo( | 32 virtual std::unique_ptr<DeviceInfo> GetDeviceInfo( |
33 const std::string& client_id) const = 0; | 33 const std::string& client_id) const = 0; |
34 // Gets DeviceInfo for all synced devices (including the local one). | 34 // Gets DeviceInfo for all synced devices (including the local one). |
35 virtual ScopedVector<DeviceInfo> GetAllDeviceInfo() const = 0; | 35 virtual std::vector<std::unique_ptr<DeviceInfo>> GetAllDeviceInfo() const = 0; |
36 // Registers an observer to be called on syncing any updated DeviceInfo. | 36 // Registers an observer to be called on syncing any updated DeviceInfo. |
37 virtual void AddObserver(Observer* observer) = 0; | 37 virtual void AddObserver(Observer* observer) = 0; |
38 // Unregisters an observer. | 38 // Unregisters an observer. |
39 virtual void RemoveObserver(Observer* observer) = 0; | 39 virtual void RemoveObserver(Observer* observer) = 0; |
40 // Returns the count of active devices. | 40 // Returns the count of active devices. |
41 virtual int CountActiveDevices() const = 0; | 41 virtual int CountActiveDevices() const = 0; |
42 }; | 42 }; |
43 | 43 |
44 } // namespace sync_driver | 44 } // namespace sync_driver |
45 | 45 |
46 #endif // COMPONENTS_SYNC_DEVICE_INFO_DEVICE_INFO_TRACKER_H_ | 46 #endif // COMPONENTS_SYNC_DEVICE_INFO_DEVICE_INFO_TRACKER_H_ |
OLD | NEW |