Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: base/ios/device_util.mm

Issue 349453002: Remove IsRunningOnIOS6OrLater (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | base/ios/device_util_unittest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/ios/device_util.h" 5 #include "base/ios/device_util.h"
6 6
7 #include <CommonCrypto/CommonDigest.h> 7 #include <CommonCrypto/CommonDigest.h>
8 #import <UIKit/UIKit.h> 8 #import <UIKit/UIKit.h>
9 9
10 #include <ifaddrs.h> 10 #include <ifaddrs.h>
(...skipping 26 matching lines...) Expand all
37 NSString* GenerateClientId() { 37 NSString* GenerateClientId() {
38 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; 38 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
39 39
40 // Try to migrate from legacy client id. 40 // Try to migrate from legacy client id.
41 NSString* client_id = [defaults stringForKey:kLegacyClientIdPreferenceKey]; 41 NSString* client_id = [defaults stringForKey:kLegacyClientIdPreferenceKey];
42 42
43 // Some iOS6 devices return a buggy identifierForVendor: 43 // Some iOS6 devices return a buggy identifierForVendor:
44 // http://openradar.appspot.com/12377282. If this is the case, revert to 44 // http://openradar.appspot.com/12377282. If this is the case, revert to
45 // generating a new one. 45 // generating a new one.
46 if (!client_id || [client_id isEqualToString:kZeroUUID]) { 46 if (!client_id || [client_id isEqualToString:kZeroUUID]) {
47 if (base::ios::IsRunningOnIOS6OrLater()) { 47 client_id = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
48 client_id = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; 48 if ([client_id isEqualToString:kZeroUUID])
49 if ([client_id isEqualToString:kZeroUUID])
50 client_id = base::SysUTF8ToNSString(ios::device_util::GetRandomId());
51 } else {
52 client_id = base::SysUTF8ToNSString(ios::device_util::GetRandomId()); 49 client_id = base::SysUTF8ToNSString(ios::device_util::GetRandomId());
53 }
54 } 50 }
55 return client_id; 51 return client_id;
56 } 52 }
57 53
58 } // namespace 54 } // namespace
59 55
60 namespace ios { 56 namespace ios {
61 namespace device_util { 57 namespace device_util {
62 58
63 std::string GetPlatform() { 59 std::string GetPlatform() {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 169
174 base::ScopedCFTypeRef<CFUUIDRef> uuid_object( 170 base::ScopedCFTypeRef<CFUUIDRef> uuid_object(
175 CFUUIDCreateFromUUIDBytes(kCFAllocatorDefault, *uuid_bytes)); 171 CFUUIDCreateFromUUIDBytes(kCFAllocatorDefault, *uuid_bytes));
176 base::ScopedCFTypeRef<CFStringRef> device_id( 172 base::ScopedCFTypeRef<CFStringRef> device_id(
177 CFUUIDCreateString(kCFAllocatorDefault, uuid_object)); 173 CFUUIDCreateString(kCFAllocatorDefault, uuid_object));
178 return base::SysCFStringRefToUTF8(device_id); 174 return base::SysCFStringRefToUTF8(device_id);
179 } 175 }
180 176
181 } // namespace device_util 177 } // namespace device_util
182 } // namespace ios 178 } // namespace ios
OLDNEW
« no previous file with comments | « no previous file | base/ios/device_util_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698