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 COMPONENTS_SYNC_DRIVER_LOCAL_DEVICE_INFO_PROVIDER_IMPL_H_ | |
6 #define COMPONENTS_SYNC_DRIVER_LOCAL_DEVICE_INFO_PROVIDER_IMPL_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/macros.h" | |
11 #include "base/memory/weak_ptr.h" | |
12 #include "base/threading/non_thread_safe.h" | |
13 #include "components/sync_driver/device_info.h" | |
14 #include "components/sync_driver/local_device_info_provider.h" | |
15 #include "components/version_info/version_info.h" | |
16 | |
17 namespace browser_sync { | |
18 | |
19 class LocalDeviceInfoProviderImpl | |
20 : public sync_driver::LocalDeviceInfoProvider, | |
21 public base::NonThreadSafe { | |
22 public: | |
23 LocalDeviceInfoProviderImpl(version_info::Channel channel, | |
24 const std::string& version, | |
25 bool is_tablet); | |
26 ~LocalDeviceInfoProviderImpl() override; | |
27 | |
28 // LocalDeviceInfoProvider implementation. | |
29 const sync_driver::DeviceInfo* GetLocalDeviceInfo() const override; | |
30 std::string GetSyncUserAgent() const override; | |
31 std::string GetLocalSyncCacheGUID() const override; | |
32 void Initialize( | |
33 const std::string& cache_guid, | |
34 const std::string& signin_scoped_device_id, | |
35 const scoped_refptr<base::TaskRunner>& blocking_task_runner) override; | |
36 std::unique_ptr<Subscription> RegisterOnInitializedCallback( | |
37 const base::Closure& callback) override; | |
38 void Clear() override; | |
39 | |
40 private: | |
41 void InitializeContinuation(const std::string& guid, | |
42 const std::string& signin_scoped_device_id, | |
43 const std::string& session_name); | |
44 | |
45 // The channel (CANARY, DEV, BETA, etc.) of the current client. | |
46 const version_info::Channel channel_; | |
47 | |
48 // The version string for the current client. | |
49 const std::string version_; | |
50 | |
51 // Whether this device has a tablet form factor (only used on Android | |
52 // devices). | |
53 const bool is_tablet_; | |
54 | |
55 std::string cache_guid_; | |
56 std::unique_ptr<sync_driver::DeviceInfo> local_device_info_; | |
57 base::CallbackList<void(void)> callback_list_; | |
58 base::WeakPtrFactory<LocalDeviceInfoProviderImpl> weak_factory_; | |
59 | |
60 DISALLOW_COPY_AND_ASSIGN(LocalDeviceInfoProviderImpl); | |
61 }; | |
62 | |
63 } // namespace browser_sync | |
64 | |
65 #endif // COMPONENTS_SYNC_DRIVER_LOCAL_DEVICE_INFO_PROVIDER_IMPL_H_ | |
OLD | NEW |