Commit 3f0459f6 authored by Yuwei Huang's avatar Yuwei Huang Committed by Commit Bot

[remoting][FTL] Implement FtlDeviceIdProviderIos

This CL provides an FtlDeviceIdProvider implementation for the iOS
client, which generates the device ID from identifierForVendor:

https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor?language=objc

Bug: 954594
Change-Id: Ieb5c373d66d17751294754c1674e86b8c7cb4ed3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1575116
Commit-Queue: Yuwei Huang <yuweih@chromium.org>
Reviewed-by: default avatarJoe Downing <joedow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#652671}
parent 690a479e
......@@ -8,6 +8,8 @@ import("//remoting/build/config/remoting_build.gni")
source_set("facade") {
sources = [
"ftl_device_id_provider_ios.h",
"ftl_device_id_provider_ios.mm",
"host_info.cc",
"host_info.h",
"host_list_fetcher.cc",
......@@ -33,6 +35,7 @@ source_set("facade") {
"//remoting/ios/domain",
"//remoting/ios/persistence",
"//remoting/resources",
"//remoting/signaling",
"//ui/base",
]
......
// Copyright 2019 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 REMOTING_IOS_FACADE_FTL_DEVICE_ID_PROVIDER_IOS_H_
#define REMOTING_IOS_FACADE_FTL_DEVICE_ID_PROVIDER_IOS_H_
#include <string>
#include "base/macros.h"
#include "remoting/signaling/ftl_device_id_provider.h"
namespace remoting {
class FtlDeviceIdProviderIos final : public FtlDeviceIdProvider {
public:
FtlDeviceIdProviderIos();
~FtlDeviceIdProviderIos() override;
ftl::DeviceId GetDeviceId() override;
private:
ftl::DeviceId device_id_;
DISALLOW_COPY_AND_ASSIGN(FtlDeviceIdProviderIos);
};
} // namespace remoting
#endif // REMOTING_IOS_FACADE_FTL_DEVICE_ID_PROVIDER_IOS_H_
// Copyright 2019 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.
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
#include "remoting/ios/facade/ftl_device_id_provider_ios.h"
#import <UIKit/UIKit.h>
#include "base/strings/sys_string_conversions.h"
namespace remoting {
FtlDeviceIdProviderIos::FtlDeviceIdProviderIos() {
std::string vendor_id = base::SysNSStringToUTF8(
UIDevice.currentDevice.identifierForVendor.UUIDString);
device_id_.set_type(ftl::DeviceIdType_Type_IOS_VENDOR_ID);
device_id_.set_id(vendor_id);
}
FtlDeviceIdProviderIos::~FtlDeviceIdProviderIos() = default;
ftl::DeviceId FtlDeviceIdProviderIos::GetDeviceId() {
return device_id_;
}
} // namespace remoting
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment