OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_DEVICE_INFO_H_ | 5 #ifndef COMPONENTS_SYNC_DRIVER_DEVICE_INFO_H_ |
6 #define CHROME_BROWSER_SYNC_GLUE_DEVICE_INFO_H_ | 6 #define COMPONENTS_SYNC_DRIVER_DEVICE_INFO_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "sync/protocol/sync.pb.h" | 12 #include "sync/protocol/sync.pb.h" |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 class DictionaryValue; | 15 class DictionaryValue; |
16 } | 16 } |
17 | 17 |
18 namespace browser_sync { | 18 namespace sync_driver { |
19 | 19 |
20 // A class that holds information regarding the properties of a device. | 20 // A class that holds information regarding the properties of a device. |
21 class DeviceInfo { | 21 class DeviceInfo { |
22 public: | 22 public: |
23 typedef base::Callback<void(const std::string&)> GetClientNameCallback; | |
24 | |
25 DeviceInfo(const std::string& guid, | 23 DeviceInfo(const std::string& guid, |
26 const std::string& client_name, | 24 const std::string& client_name, |
27 const std::string& chrome_version, | 25 const std::string& chrome_version, |
28 const std::string& sync_user_agent, | 26 const std::string& sync_user_agent, |
29 const sync_pb::SyncEnums::DeviceType device_type, | 27 const sync_pb::SyncEnums::DeviceType device_type, |
30 const std::string& signin_scoped_device_id); | 28 const std::string& signin_scoped_device_id); |
31 ~DeviceInfo(); | 29 ~DeviceInfo(); |
32 | 30 |
33 // Sync specific unique identifier for the device. Note if a device | 31 // Sync specific unique identifier for the device. Note if a device |
34 // is wiped and sync is set up again this id WILL be different. | 32 // is wiped and sync is set up again this id WILL be different. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 // Apps can set ids for a device that is meaningful to them but | 67 // Apps can set ids for a device that is meaningful to them but |
70 // not unique enough so the user can be tracked. Exposing |guid| | 68 // not unique enough so the user can be tracked. Exposing |guid| |
71 // would lead to a stable unique id for a device which can potentially | 69 // would lead to a stable unique id for a device which can potentially |
72 // be used for tracking. | 70 // be used for tracking. |
73 void set_public_id(std::string id); | 71 void set_public_id(std::string id); |
74 | 72 |
75 // Converts the |DeviceInfo| values to a JS friendly DictionaryValue, | 73 // Converts the |DeviceInfo| values to a JS friendly DictionaryValue, |
76 // which extension APIs can expose to third party apps. | 74 // which extension APIs can expose to third party apps. |
77 base::DictionaryValue* ToValue(); | 75 base::DictionaryValue* ToValue(); |
78 | 76 |
79 // Gets the local device name and passes it as a parameter to callback. | |
80 static void GetClientName(const GetClientNameCallback& callback); | |
81 | |
82 private: | 77 private: |
83 const std::string guid_; | 78 const std::string guid_; |
84 | 79 |
85 const std::string client_name_; | 80 const std::string client_name_; |
86 | 81 |
87 const std::string chrome_version_; | 82 const std::string chrome_version_; |
88 | 83 |
89 const std::string sync_user_agent_; | 84 const std::string sync_user_agent_; |
90 | 85 |
91 const sync_pb::SyncEnums::DeviceType device_type_; | 86 const sync_pb::SyncEnums::DeviceType device_type_; |
92 | 87 |
93 std::string signin_scoped_device_id_; | 88 std::string signin_scoped_device_id_; |
94 | 89 |
95 // Exposing |guid| would lead to a stable unique id for a device which | 90 // Exposing |guid| would lead to a stable unique id for a device which |
96 // can potentially be used for tracking. Public ids are privacy safe | 91 // can potentially be used for tracking. Public ids are privacy safe |
97 // ids in that the same device will have different id for different apps | 92 // ids in that the same device will have different id for different apps |
98 // and they are also reset when app/extension is uninstalled. | 93 // and they are also reset when app/extension is uninstalled. |
99 std::string public_id_; | 94 std::string public_id_; |
100 | 95 |
101 DISALLOW_COPY_AND_ASSIGN(DeviceInfo); | 96 DISALLOW_COPY_AND_ASSIGN(DeviceInfo); |
102 }; | 97 }; |
103 | 98 |
104 } // namespace browser_sync | 99 } // namespace sync_driver |
105 | 100 |
106 #endif // CHROME_BROWSER_SYNC_GLUE_DEVICE_INFO_H_ | 101 #endif // COMPONENTS_SYNC_DRIVER_DEVICE_INFO_H_ |
OLD | NEW |