OLD | NEW |
(Empty) | |
| 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 CHROME_BROWSER_SYNC_GLUE_LOCAL_DEVICE_INFO_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_LOCAL_DEVICE_INFO_PROVIDER_H_ |
| 7 |
| 8 #include <string> |
| 9 #include "base/callback_list.h" |
| 10 |
| 11 namespace browser_sync { |
| 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(const std::string& cache_guid) = 0; |
| 37 |
| 38 // Registers a callback to be called when local device info becomes available. |
| 39 // The callback will remain registered until the |
| 40 // returned Subscription is destroyed, which must occur before the |
| 41 // CallbackList is destroyed. |
| 42 virtual scoped_ptr<Subscription> RegisterOnInitializedCallback( |
| 43 const base::Closure& callback) = 0; |
| 44 }; |
| 45 |
| 46 } // namespace browser_sync |
| 47 |
| 48 #endif // CHROME_BROWSER_SYNC_GLUE_LOCAL_DEVICE_INFO_PROVIDER_H_ |
OLD | NEW |