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_LOCAL_DEVICE_INFO_PROVIDER_H_
6 #define COMPONENTS_SYNC_DRIVER_LOCAL_DEVICE_INFO_PROVIDER_H_
9 #include "base/callback_list.h"
11 namespace sync_driver
{
15 // Interface for providing sync specific informaiton about the
17 class LocalDeviceInfoProvider
{
19 typedef base::CallbackList
<void(void)>::Subscription Subscription
;
21 virtual ~LocalDeviceInfoProvider() {}
23 // Returns sync's representation of the local device info;
24 // NULL if the device info is unavailable.
25 // The returned object is fully owned by LocalDeviceInfoProvider (must not
26 // be freed by the caller). It remains valid until LocalDeviceInfoProvider
28 virtual const DeviceInfo
* GetLocalDeviceInfo() const = 0;
30 // Constructs a user agent string (ASCII) suitable for use by the syncapi
31 // for any HTTP communication. This string is used by the sync backend for
32 // classifying client types when calculating statistics.
33 virtual std::string
GetSyncUserAgent() const = 0;
35 // Returns a GUID string used for creation of the machine tag for
36 // this local session; an empty sting if LocalDeviceInfoProvider hasn't been
38 virtual std::string
GetLocalSyncCacheGUID() const = 0;
40 // Starts initializing local device info.
41 virtual void Initialize(
42 const std::string
& cache_guid
,
43 const std::string
& signin_scoped_device_id
) = 0;
45 // Registers a callback to be called when local device info becomes available.
46 // The callback will remain registered until the
47 // returned Subscription is destroyed, which must occur before the
48 // CallbackList is destroyed.
49 virtual scoped_ptr
<Subscription
> RegisterOnInitializedCallback(
50 const base::Closure
& callback
) = 0;
53 } // namespace sync_driver
55 #endif // COMPONENTS_SYNC_DRIVER_LOCAL_DEVICE_INFO_PROVIDER_H_