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