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

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

Issue 2942633002: [ios] Adds IsRunningOnIOS11OrLater(). (Closed)
Patch Set: Created 3 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
« no previous file with comments | « base/ios/ios_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/ios_util.h" 5 #include "base/ios/ios_util.h"
6 6
7 #import <Foundation/Foundation.h> 7 #import <Foundation/Foundation.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 14 matching lines...) Expand all
25 25
26 } // namespace 26 } // namespace
27 27
28 namespace base { 28 namespace base {
29 namespace ios { 29 namespace ios {
30 30
31 bool IsRunningOnIOS10OrLater() { 31 bool IsRunningOnIOS10OrLater() {
32 return IsRunningOnOrLater(10, 0, 0); 32 return IsRunningOnOrLater(10, 0, 0);
33 } 33 }
34 34
35 bool IsRunningOnIOS11OrLater() {
36 return IsRunningOnOrLater(11, 0, 0);
37 }
38
35 bool IsRunningOnOrLater(int32_t major, int32_t minor, int32_t bug_fix) { 39 bool IsRunningOnOrLater(int32_t major, int32_t minor, int32_t bug_fix) {
36 static const int32_t* current_version = OSVersionAsArray(); 40 static const int32_t* current_version = OSVersionAsArray();
37 int32_t version[] = {major, minor, bug_fix}; 41 int32_t version[] = {major, minor, bug_fix};
38 for (size_t i = 0; i < arraysize(version); i++) { 42 for (size_t i = 0; i < arraysize(version); i++) {
39 if (current_version[i] != version[i]) 43 if (current_version[i] != version[i])
40 return current_version[i] > version[i]; 44 return current_version[i] > version[i];
41 } 45 }
42 return true; 46 return true;
43 } 47 }
44 48
45 bool IsInForcedRTL() { 49 bool IsInForcedRTL() {
46 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; 50 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
47 return [defaults boolForKey:@"NSForceRightToLeftWritingDirection"]; 51 return [defaults boolForKey:@"NSForceRightToLeftWritingDirection"];
48 } 52 }
49 53
50 void OverridePathOfEmbeddedICU(const char* path) { 54 void OverridePathOfEmbeddedICU(const char* path) {
51 DCHECK(!g_icudtl_path_override); 55 DCHECK(!g_icudtl_path_override);
52 g_icudtl_path_override = new std::string(path); 56 g_icudtl_path_override = new std::string(path);
53 } 57 }
54 58
55 FilePath FilePathOfEmbeddedICU() { 59 FilePath FilePathOfEmbeddedICU() {
56 if (g_icudtl_path_override) { 60 if (g_icudtl_path_override) {
57 return FilePath(*g_icudtl_path_override); 61 return FilePath(*g_icudtl_path_override);
58 } 62 }
59 return FilePath(); 63 return FilePath();
60 } 64 }
61 65
62 } // namespace ios 66 } // namespace ios
63 } // namespace base 67 } // namespace base
OLDNEW
« no previous file with comments | « base/ios/ios_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698