ftl_host_device_id_provider.cc 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. #include "remoting/signaling/ftl_host_device_id_provider.h"
  5. #include "build/build_config.h"
  6. #include "build/chromeos_buildflags.h"
  7. namespace remoting {
  8. namespace {
  9. #if BUILDFLAG(IS_WIN)
  10. constexpr char kDeviceIdPrefix[] = "crd-win-host-";
  11. #elif BUILDFLAG(IS_APPLE)
  12. constexpr char kDeviceIdPrefix[] = "crd-mac-host-";
  13. #elif BUILDFLAG(IS_CHROMEOS_ASH)
  14. constexpr char kDeviceIdPrefix[] = "crd-cros-host-";
  15. #elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
  16. constexpr char kDeviceIdPrefix[] = "crd-linux-host-";
  17. #else
  18. constexpr char kDeviceIdPrefix[] = "crd-unknown-host-";
  19. #endif
  20. } // namespace
  21. FtlHostDeviceIdProvider::FtlHostDeviceIdProvider(const std::string& host_id) {
  22. device_id_.set_type(ftl::DeviceIdType_Type_CHROMOTING_HOST_ID);
  23. device_id_.set_id(kDeviceIdPrefix + host_id);
  24. }
  25. FtlHostDeviceIdProvider::~FtlHostDeviceIdProvider() = default;
  26. ftl::DeviceId FtlHostDeviceIdProvider::GetDeviceId() {
  27. return device_id_;
  28. }
  29. } // namespace remoting