| 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 CHROME_BROWSER_SYNC_GLUE_LOCAL_DEVICE_INFO_PROVIDER_IMPL_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_LOCAL_DEVICE_INFO_PROVIDER_IMPL_H_ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_LOCAL_DEVICE_INFO_PROVIDER_IMPL_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_LOCAL_DEVICE_INFO_PROVIDER_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "components/sync_driver/device_info.h" | 9 #include "components/sync_driver/device_info.h" |
| 10 #include "components/sync_driver/local_device_info_provider.h" | 10 #include "components/sync_driver/local_device_info_provider.h" |
| 11 | 11 |
| 12 namespace chrome { | |
| 13 class VersionInfo; | |
| 14 } | |
| 15 | |
| 16 namespace browser_sync { | 12 namespace browser_sync { |
| 17 | 13 |
| 18 class LocalDeviceInfoProviderImpl | 14 class LocalDeviceInfoProviderImpl |
| 19 : public sync_driver::LocalDeviceInfoProvider { | 15 : public sync_driver::LocalDeviceInfoProvider { |
| 20 public: | 16 public: |
| 21 LocalDeviceInfoProviderImpl(); | 17 LocalDeviceInfoProviderImpl(); |
| 22 ~LocalDeviceInfoProviderImpl() override; | 18 ~LocalDeviceInfoProviderImpl() override; |
| 23 | 19 |
| 24 // LocalDeviceInfoProvider implementation. | 20 // LocalDeviceInfoProvider implementation. |
| 25 const sync_driver::DeviceInfo* GetLocalDeviceInfo() const override; | 21 const sync_driver::DeviceInfo* GetLocalDeviceInfo() const override; |
| 26 std::string GetLocalSyncCacheGUID() const override; | 22 std::string GetLocalSyncCacheGUID() const override; |
| 27 void Initialize(const std::string& cache_guid, | 23 void Initialize(const std::string& cache_guid, |
| 28 const std::string& signin_scoped_device_id) override; | 24 const std::string& signin_scoped_device_id) override; |
| 29 scoped_ptr<Subscription> RegisterOnInitializedCallback( | 25 scoped_ptr<Subscription> RegisterOnInitializedCallback( |
| 30 const base::Closure& callback) override; | 26 const base::Closure& callback) override; |
| 31 | 27 |
| 32 // Helper to construct a user agent string (ASCII) suitable for use by | 28 // Helper to construct a user agent string (ASCII) suitable for use by |
| 33 // the syncapi for any HTTP communication. This string is used by the sync | 29 // the syncapi for any HTTP communication. This string is used by the sync |
| 34 // backend for classifying client types when calculating statistics. | 30 // backend for classifying client types when calculating statistics. |
| 35 static std::string MakeUserAgentForSyncApi( | 31 static std::string MakeUserAgentForSyncApi(); |
| 36 const chrome::VersionInfo& version_info); | |
| 37 | 32 |
| 38 private: | 33 private: |
| 39 void InitializeContinuation(const std::string& guid, | 34 void InitializeContinuation(const std::string& guid, |
| 40 const std::string& signin_scoped_device_id, | 35 const std::string& signin_scoped_device_id, |
| 41 const std::string& session_name); | 36 const std::string& session_name); |
| 42 | 37 |
| 43 std::string cache_guid_; | 38 std::string cache_guid_; |
| 44 scoped_ptr<sync_driver::DeviceInfo> local_device_info_; | 39 scoped_ptr<sync_driver::DeviceInfo> local_device_info_; |
| 45 base::CallbackList<void(void)> callback_list_; | 40 base::CallbackList<void(void)> callback_list_; |
| 46 base::WeakPtrFactory<LocalDeviceInfoProviderImpl> weak_factory_; | 41 base::WeakPtrFactory<LocalDeviceInfoProviderImpl> weak_factory_; |
| 47 | 42 |
| 48 DISALLOW_COPY_AND_ASSIGN(LocalDeviceInfoProviderImpl); | 43 DISALLOW_COPY_AND_ASSIGN(LocalDeviceInfoProviderImpl); |
| 49 }; | 44 }; |
| 50 | 45 |
| 51 } // namespace browser_sync | 46 } // namespace browser_sync |
| 52 | 47 |
| 53 #endif // CHROME_BROWSER_SYNC_GLUE_LOCAL_DEVICE_INFO_PROVIDER_IMPL_H_ | 48 #endif // CHROME_BROWSER_SYNC_GLUE_LOCAL_DEVICE_INFO_PROVIDER_IMPL_H_ |
| OLD | NEW |