cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / components / user_prefs / tracked / device_id_mac.cc
blobbd5ce80564772d80077a5b68f1bfc47da6d513d6
1 // Copyright 2015 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.
5 #include "components/user_prefs/tracked/device_id.h"
7 #include <IOKit/IOKitLib.h>
9 #include "base/mac/foundation_util.h"
10 #include "base/mac/scoped_cftyperef.h"
11 #include "base/mac/scoped_ioobject.h"
12 #include "base/strings/sys_string_conversions.h"
14 MachineIdStatus GetDeterministicMachineSpecificId(std::string* machine_id) {
15 base::mac::ScopedIOObject<io_service_t> platform_expert(
16 IOServiceGetMatchingService(kIOMasterPortDefault,
17 IOServiceMatching("IOPlatformExpertDevice")));
18 if (!platform_expert.get())
19 return MachineIdStatus::FAILURE;
21 base::ScopedCFTypeRef<CFTypeRef> uuid(IORegistryEntryCreateCFProperty(
22 platform_expert, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0));
23 if (!uuid.get())
24 return MachineIdStatus::FAILURE;
26 CFStringRef uuid_string = base::mac::CFCast<CFStringRef>(uuid);
27 if (!uuid_string)
28 return MachineIdStatus::FAILURE;
30 *machine_id = base::SysCFStringRefToUTF8(uuid_string);
31 return MachineIdStatus::SUCCESS;