| 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 "chrome/browser/sync/glue/device_info.h" | 9 #include "chrome/browser/sync/glue/device_info.h" |
| 10 #include "chrome/browser/sync/glue/local_device_info_provider.h" | 10 #include "chrome/browser/sync/glue/local_device_info_provider.h" |
| 11 | 11 |
| 12 namespace chrome { |
| 13 class VersionInfo; |
| 14 } |
| 15 |
| 12 namespace browser_sync { | 16 namespace browser_sync { |
| 13 | 17 |
| 14 class LocalDeviceInfoProviderImpl : public LocalDeviceInfoProvider { | 18 class LocalDeviceInfoProviderImpl : public LocalDeviceInfoProvider { |
| 15 public: | 19 public: |
| 16 LocalDeviceInfoProviderImpl(); | 20 LocalDeviceInfoProviderImpl(); |
| 17 virtual ~LocalDeviceInfoProviderImpl(); | 21 virtual ~LocalDeviceInfoProviderImpl(); |
| 18 | 22 |
| 19 // LocalDeviceInfoProvider implementation. | 23 // LocalDeviceInfoProvider implementation. |
| 20 virtual const DeviceInfo* GetLocalDeviceInfo() const OVERRIDE; | 24 virtual const DeviceInfo* GetLocalDeviceInfo() const OVERRIDE; |
| 21 virtual std::string GetLocalSyncCacheGUID() const OVERRIDE; | 25 virtual std::string GetLocalSyncCacheGUID() const OVERRIDE; |
| 22 virtual void Initialize( | 26 virtual void Initialize( |
| 23 const std::string& cache_guid, | 27 const std::string& cache_guid, |
| 24 const std::string& signin_scoped_device_id) OVERRIDE; | 28 const std::string& signin_scoped_device_id) OVERRIDE; |
| 25 virtual scoped_ptr<Subscription> RegisterOnInitializedCallback( | 29 virtual scoped_ptr<Subscription> RegisterOnInitializedCallback( |
| 26 const base::Closure& callback) OVERRIDE; | 30 const base::Closure& callback) OVERRIDE; |
| 27 | 31 |
| 32 // 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 |
| 34 // backend for classifying client types when calculating statistics. |
| 35 static std::string MakeUserAgentForSyncApi( |
| 36 const chrome::VersionInfo& version_info); |
| 37 |
| 28 private: | 38 private: |
| 29 void InitializeContinuation(const DeviceInfo& local_info); | 39 void InitializeContinuation(const std::string& guid, |
| 40 const std::string& signin_scoped_device_id, |
| 41 const std::string& session_name); |
| 30 | 42 |
| 31 std::string cache_guid_; | 43 std::string cache_guid_; |
| 32 scoped_ptr<DeviceInfo> local_device_info_; | 44 scoped_ptr<DeviceInfo> local_device_info_; |
| 33 base::CallbackList<void(void)> callback_list_; | 45 base::CallbackList<void(void)> callback_list_; |
| 34 base::WeakPtrFactory<LocalDeviceInfoProviderImpl> weak_factory_; | 46 base::WeakPtrFactory<LocalDeviceInfoProviderImpl> weak_factory_; |
| 35 | 47 |
| 36 DISALLOW_COPY_AND_ASSIGN(LocalDeviceInfoProviderImpl); | 48 DISALLOW_COPY_AND_ASSIGN(LocalDeviceInfoProviderImpl); |
| 37 }; | 49 }; |
| 38 | 50 |
| 39 } // namespace browser_sync | 51 } // namespace browser_sync |
| 40 | 52 |
| 41 #endif // CHROME_BROWSER_SYNC_GLUE_LOCAL_DEVICE_INFO_PROVIDER_IMPL_H_ | 53 #endif // CHROME_BROWSER_SYNC_GLUE_LOCAL_DEVICE_INFO_PROVIDER_IMPL_H_ |
| OLD | NEW |