1 // Copyright 2012 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef BASE_IOS_DEVICE_UTIL_H_ 6 #define BASE_IOS_DEVICE_UTIL_H_ 7 8 #include <stdint.h> 9 10 #include <string> 11 12 namespace ios { 13 namespace device_util { 14 15 // Returns true if the application is running on a device with 512MB or more 16 // RAM. 17 bool RamIsAtLeast512Mb(); 18 19 // Returns true if the application is running on a device with 1024MB or more 20 // RAM. 21 bool RamIsAtLeast1024Mb(); 22 23 // Returns true if the application is running on a device with |ram_in_mb| MB or 24 // more RAM. 25 // Use with caution! Actual RAM reported by devices is less than the commonly 26 // used powers-of-two values. For example, a 512MB device may report only 502MB 27 // RAM. The convenience methods above should be used in most cases because they 28 // correctly handle this issue. 29 bool RamIsAtLeast(uint64_t ram_in_mb); 30 31 // Returns true if the device has only one core. 32 bool IsSingleCoreDevice(); 33 34 // Returns the MAC address of the interface with name |interface_name|. 35 std::string GetMacAddress(const std::string& interface_name); 36 37 // Returns a random UUID. 38 std::string GetRandomId(); 39 40 // Returns an identifier for the device, using the given |salt|. A global 41 // identifier is generated the first time this method is called, and the salt 42 // is used to be able to generate distinct identifiers for the same device. If 43 // |salt| is NULL, a default value is used. Unless you are using this value for 44 // something that should be anonymous, you should probably pass NULL. 45 std::string GetDeviceIdentifier(const char* salt); 46 47 // Returns the iOS Vendor ID for this device. Using this value can have privacy 48 // implications. 49 std::string GetVendorId(); 50 51 // Returns a hashed version of |in_string| using |salt| (which must not be 52 // zero-length). Different salt values should result in differently hashed 53 // strings. 54 std::string GetSaltedString(const std::string& in_string, 55 const std::string& salt); 56 57 } // namespace device_util 58 } // namespace ios 59 60 #endif // BASE_IOS_DEVICE_UTIL_H_ 61