Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1437)

Side by Side Diff: chrome/browser/sync/glue/device_info.h

Issue 597423002: Device info datatype should be moved to components/sync_driver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor CR feedback addressed. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_SYNC_GLUE_DEVICE_INFO_H_
6 #define CHROME_BROWSER_SYNC_GLUE_DEVICE_INFO_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/callback.h"
12 #include "sync/protocol/sync.pb.h"
13
14 namespace base {
15 class DictionaryValue;
16 }
17
18 namespace browser_sync {
19
20 // A class that holds information regarding the properties of a device.
21 class DeviceInfo {
22 public:
23 typedef base::Callback<void(const std::string&)> GetClientNameCallback;
24
25 DeviceInfo(const std::string& guid,
26 const std::string& client_name,
27 const std::string& chrome_version,
28 const std::string& sync_user_agent,
29 const sync_pb::SyncEnums::DeviceType device_type,
30 const std::string& signin_scoped_device_id);
31 ~DeviceInfo();
32
33 // 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.
35 // The same device might have more than 1 guid if the device has multiple
36 // accounts syncing.
37 const std::string& guid() const;
38
39 // The host name for the client.
40 const std::string& client_name() const;
41
42 // Chrome version string.
43 const std::string& chrome_version() const;
44
45 // The user agent is the combination of OS type, chrome version and which
46 // channel of chrome(stable or beta). For more information see
47 // |LocalDeviceInfoProviderImpl::MakeUserAgentForSyncApi|.
48 const std::string& sync_user_agent() const;
49
50 // Third party visible id for the device. See |public_id_| for more details.
51 const std::string& public_id() const;
52
53 // Device Type.
54 sync_pb::SyncEnums::DeviceType device_type() const;
55
56 // Device_id that is stable until user signs out. This device_id is used for
57 // annotating login scoped refresh token.
58 const std::string& signin_scoped_device_id() const;
59
60 // Gets the OS in string form.
61 std::string GetOSString() const;
62
63 // Gets the device type in string form.
64 std::string GetDeviceTypeString() const;
65
66 // Compares this object's fields with another's.
67 bool Equals(const DeviceInfo& other) const;
68
69 // 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|
71 // would lead to a stable unique id for a device which can potentially
72 // be used for tracking.
73 void set_public_id(std::string id);
74
75 // Converts the |DeviceInfo| values to a JS friendly DictionaryValue,
76 // which extension APIs can expose to third party apps.
77 base::DictionaryValue* ToValue();
78
79 // Gets the local device name and passes it as a parameter to callback.
80 static void GetClientName(const GetClientNameCallback& callback);
81
82 private:
83 const std::string guid_;
84
85 const std::string client_name_;
86
87 const std::string chrome_version_;
88
89 const std::string sync_user_agent_;
90
91 const sync_pb::SyncEnums::DeviceType device_type_;
92
93 std::string signin_scoped_device_id_;
94
95 // 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
97 // ids in that the same device will have different id for different apps
98 // and they are also reset when app/extension is uninstalled.
99 std::string public_id_;
100
101 DISALLOW_COPY_AND_ASSIGN(DeviceInfo);
102 };
103
104 } // namespace browser_sync
105
106 #endif // CHROME_BROWSER_SYNC_GLUE_DEVICE_INFO_H_
OLDNEW
« no previous file with comments | « chrome/browser/supervised_user/supervised_user_registration_utility.cc ('k') | chrome/browser/sync/glue/device_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698