Chromium Code Reviews| Index: chrome/browser/sync/glue/device_info.h |
| diff --git a/chrome/browser/sync/glue/device_info.h b/chrome/browser/sync/glue/device_info.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..dc9198e144a3bac7159e04d27da7f91f8adcfa82 |
| --- /dev/null |
| +++ b/chrome/browser/sync/glue/device_info.h |
| @@ -0,0 +1,54 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_SYNC_GLUE_DEVICE_INFO_H_ |
| +#define CHROME_BROWSER_SYNC_GLUE_DEVICE_INFO_H_ |
| + |
| +#include <string> |
|
Nicolas Zea
2012/09/26 01:50:59
newline after
rlarocque
2012/09/26 20:44:36
Done.
|
| +#include "base/bind.h" |
| +#include "sync/protocol/sync.pb.h" |
| + |
| +namespace browser_sync { |
| + |
| +// A class that holds information regarding the properties of a device. |
| +// |
| +// These objects do not contain enough information to uniquely identify devices. |
| +// Two different devices may end up generating identical DeviceInfos. |
| +class DeviceInfo { |
| + public: |
| + DeviceInfo(); |
| + DeviceInfo(const std::string& client_name, |
| + const std::string& sync_user_agent, |
| + const sync_pb::SyncEnums::DeviceType device_type); |
| + ~DeviceInfo(); |
| + |
| + const std::string& client_name() const; |
| + 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
|
| + sync_pb::SyncEnums::DeviceType device_type() const; |
| + |
| + // Compares this object's fields with another's. |
| + bool Equals(const DeviceInfo& other) const; |
| + |
| + static sync_pb::SyncEnums::DeviceType GetLocalDeviceType(); |
| + static void CreateLocalDeviceInfo( |
| + base::Callback<void(const DeviceInfo& local_info)> callback); |
| + |
| + // Helper to construct a user agent string (ASCII) suitable for use by |
| + // the syncapi for any HTTP communication. This string is used by the sync |
| + // backend for classifying client types when calculating statistics. |
| + static std::string MakeUserAgentForSyncApi(); |
| + |
| + private: |
| + static void CreateLocalDeviceInfoContinuation( |
| + base::Callback<void(const DeviceInfo& local_info)> callback, |
| + const std::string& session_name); |
| + |
| + 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.
|
| + std::string sync_user_agent_; |
| + sync_pb::SyncEnums::DeviceType device_type_; |
| +}; |
| + |
| +} |
| + |
| +#endif // CHROME_BROWSER_SYNC_GLUE_DEVICE_INFO_H_ |