Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / ios / web / web_view_util.mm
blob782a28cca7761f08e3ec18396ae268804661a824
1 // Copyright 2014 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 "ios/web/public/web_view_util.h"
7 #include <Foundation/Foundation.h>
8 #include <sys/sysctl.h>
10 #include "base/ios/ios_util.h"
12 namespace web {
14 bool IsWKWebViewSupported() {
15   // WKWebView is available starting from iOS8.
16   if (!base::ios::IsRunningOnIOS8OrLater())
17     return false;
19 // WKWebView does not work with 32-bit binaries running on 64-bit hardware.
20 // (rdar://18268087)
21 #if !defined(__LP64__)
22   NSString* simulator_model_id =
23       [[NSProcessInfo processInfo] environment][@"SIMULATOR_MODEL_IDENTIFIER"];
24   // For simulator it's not possible to query hw.cpu64bit_capable value as the
25   // function will return information for mac hardware rather than simulator.
26   if (simulator_model_id) {
27     // A set of known 32-bit simulators that are also iOS 8 compatible.
28     // (taken from iOS 8.1 SDK simulators list).
29     NSSet* known_32_bit_devices = [NSSet
30         setWithArray:@[ @"iPad2,1", @"iPad3,1", @"iPhone4,1", @"iPhone5,1" ]];
31     return [known_32_bit_devices containsObject:simulator_model_id];
32   }
33   uint32_t cpu64bit_capable = 0;
34   size_t sizes = sizeof(cpu64bit_capable);
35   sysctlbyname("hw.cpu64bit_capable", &cpu64bit_capable, &sizes, NULL, 0);
36   return !cpu64bit_capable;
37 #else
38   return true;
39 #endif
42 }  // namespace web