Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / components / sync_driver / local_device_info_provider.h
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.
4
5 #ifndef COMPONENTS_SYNC_DRIVER_LOCAL_DEVICE_INFO_PROVIDER_H_
6 #define COMPONENTS_SYNC_DRIVER_LOCAL_DEVICE_INFO_PROVIDER_H_
7
8 #include <string>
9 #include "base/callback_list.h"
10
11 namespace sync_driver {
12
13 class DeviceInfo;
14
15 // Interface for providing sync specific informaiton about the
16 // local device.
17 class LocalDeviceInfoProvider {
18  public:
19   typedef base::CallbackList<void(void)>::Subscription Subscription;
20
21   virtual ~LocalDeviceInfoProvider() {}
22
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
27   // is destroyed.
28   virtual const DeviceInfo* GetLocalDeviceInfo() const = 0;
29
30   // Returns a GUID string used for creation of the machine tag for
31   // this local session; an empty sting if LocalDeviceInfoProvider hasn't been
32   // initialized yet.
33   virtual std::string GetLocalSyncCacheGUID() const = 0;
34
35   // Starts initializing local device info.
36   virtual void Initialize(
37       const std::string& cache_guid,
38       const std::string& signin_scoped_device_id) = 0;
39
40   // Registers a callback to be called when local device info becomes available.
41   // The callback will remain registered until the
42   // returned Subscription is destroyed, which must occur before the
43   // CallbackList is destroyed.
44   virtual scoped_ptr<Subscription> RegisterOnInitializedCallback(
45       const base::Closure& callback) = 0;
46 };
47
48 }  // namespace sync_driver
49
50 #endif  // COMPONENTS_SYNC_DRIVER_LOCAL_DEVICE_INFO_PROVIDER_H_