OLD | NEW |
(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 #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; |
| 28 sync_pb::SyncEnums::DeviceType device_type() const; |
| 29 |
| 30 // Compares this objects fields with another. |
| 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_; |
| 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_ |
OLD | NEW |