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

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

Issue 10985008: sync: Add DeviceInfo protobuf and supporting code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
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>
Nicolas Zea 2012/09/26 01:50:59 newline after
rlarocque 2012/09/26 20:44:36 Done.
9 #include "base/bind.h"
10 #include "sync/protocol/sync.pb.h"
11
12 namespace browser_sync {
13
14 // A class that holds information regarding the properties of a device.
15 //
16 // These objects do not contain enough information to uniquely identify devices.
17 // Two different devices may end up generating identical DeviceInfos.
18 class DeviceInfo {
19 public:
20 DeviceInfo();
21 DeviceInfo(const std::string& client_name,
22 const std::string& sync_user_agent,
23 const sync_pb::SyncEnums::DeviceType device_type);
24 ~DeviceInfo();
25
26 const std::string& client_name() const;
27 const std::string& sync_user_agent() const;
Nicolas Zea 2012/09/26 01:50:59 Does anything care about this? It seems odd to exp
rlarocque 2012/09/26 20:44:36 I added this at Raz's suggestion. It's meant to m
28 sync_pb::SyncEnums::DeviceType device_type() const;
29
30 // Compares this object's fields with another's.
31 bool Equals(const DeviceInfo& other) const;
32
33 static sync_pb::SyncEnums::DeviceType GetLocalDeviceType();
34 static void CreateLocalDeviceInfo(
35 base::Callback<void(const DeviceInfo& local_info)> callback);
36
37 // Helper to construct a user agent string (ASCII) suitable for use by
38 // the syncapi for any HTTP communication. This string is used by the sync
39 // backend for classifying client types when calculating statistics.
40 static std::string MakeUserAgentForSyncApi();
41
42 private:
43 static void CreateLocalDeviceInfoContinuation(
44 base::Callback<void(const DeviceInfo& local_info)> callback,
45 const std::string& session_name);
46
47 std::string client_name_;
Nicolas Zea 2012/09/26 01:50:59 can these be const?
rlarocque 2012/09/26 20:44:36 Sure, let's do that.
48 std::string sync_user_agent_;
49 sync_pb::SyncEnums::DeviceType device_type_;
50 };
51
52 }
53
54 #endif // CHROME_BROWSER_SYNC_GLUE_DEVICE_INFO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698