local_device_info_util.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Copyright 2019 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. #ifndef COMPONENTS_SYNC_DEVICE_INFO_LOCAL_DEVICE_INFO_UTIL_H_
  5. #define COMPONENTS_SYNC_DEVICE_INFO_LOCAL_DEVICE_INFO_UTIL_H_
  6. #include <string>
  7. #include "base/callback_forward.h"
  8. #include "components/sync/protocol/sync_enums.pb.h"
  9. namespace syncer {
  10. // Contains device specific names to be used by DeviceInfo. These are specific
  11. // to the local device only. DeviceInfoSyncBridge uses either |model_name| or
  12. // |personalizable_name| for the |client_name| depending on the current
  13. // SyncMode. Only fully synced clients will use the personalizable name.
  14. struct LocalDeviceNameInfo {
  15. LocalDeviceNameInfo();
  16. LocalDeviceNameInfo(const LocalDeviceNameInfo& other);
  17. ~LocalDeviceNameInfo();
  18. // Manufacturer name retrieved from SysInfo::GetHardwareInfo() - e.g. LENOVO.
  19. std::string manufacturer_name;
  20. // Model name retrieved from SysInfo::GetHardwareInfo() on non CrOS platforms.
  21. // On CrOS this will be set to GetChromeOSDeviceNameFromType() instead.
  22. std::string model_name;
  23. // Personalizable device name from GetPersonalizableDeviceNameBlocking(). See
  24. // documentation below for more information.
  25. std::string personalizable_name;
  26. // Unique hardware class string which details the
  27. // HW combination of a CrOS device. Empty on non-CrOS devices.
  28. std::string full_hardware_class;
  29. };
  30. sync_pb::SyncEnums::DeviceType GetLocalDeviceType();
  31. // Returns the personalizable device name. This may contain
  32. // personally-identifiable information - e.g. Alex's MacbookPro.
  33. std::string GetPersonalizableDeviceNameBlocking();
  34. void GetLocalDeviceNameInfo(
  35. base::OnceCallback<void(LocalDeviceNameInfo)> callback);
  36. } // namespace syncer
  37. #endif // COMPONENTS_SYNC_DEVICE_INFO_LOCAL_DEVICE_INFO_UTIL_H_