| OLD | NEW |
| 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 // When dropping iOS7 support, also address issues listed in crbug.com/502968. | 31 // When dropping iOS7 support, also address issues listed in crbug.com/502968. |
| 32 bool IsRunningOnIOS8OrLater() { | 32 bool IsRunningOnIOS8OrLater() { |
| 33 return IsRunningOnOrLater(8, 0, 0); | 33 return IsRunningOnOrLater(8, 0, 0); |
| 34 } | 34 } |
| 35 | 35 |
| 36 bool IsRunningOnIOS9OrLater() { | 36 bool IsRunningOnIOS9OrLater() { |
| 37 return IsRunningOnOrLater(9, 0, 0); | 37 return IsRunningOnOrLater(9, 0, 0); |
| 38 } | 38 } |
| 39 | 39 |
| 40 bool IsRunningOnIOS10OrLater() { |
| 41 return IsRunningOnOrLater(10, 0, 0); |
| 42 } |
| 43 |
| 40 bool IsRunningOnOrLater(int32_t major, int32_t minor, int32_t bug_fix) { | 44 bool IsRunningOnOrLater(int32_t major, int32_t minor, int32_t bug_fix) { |
| 41 static const int32_t* current_version = OSVersionAsArray(); | 45 static const int32_t* current_version = OSVersionAsArray(); |
| 42 int32_t version[] = {major, minor, bug_fix}; | 46 int32_t version[] = {major, minor, bug_fix}; |
| 43 for (size_t i = 0; i < arraysize(version); i++) { | 47 for (size_t i = 0; i < arraysize(version); i++) { |
| 44 if (current_version[i] != version[i]) | 48 if (current_version[i] != version[i]) |
| 45 return current_version[i] > version[i]; | 49 return current_version[i] > version[i]; |
| 46 } | 50 } |
| 47 return true; | 51 return true; |
| 48 } | 52 } |
| 49 | 53 |
| 50 bool IsInForcedRTL() { | 54 bool IsInForcedRTL() { |
| 51 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; | 55 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; |
| 52 return [defaults boolForKey:@"NSForceRightToLeftWritingDirection"]; | 56 return [defaults boolForKey:@"NSForceRightToLeftWritingDirection"]; |
| 53 } | 57 } |
| 54 | 58 |
| 55 void OverridePathOfEmbeddedICU(const char* path) { | 59 void OverridePathOfEmbeddedICU(const char* path) { |
| 56 DCHECK(!g_icudtl_path_override); | 60 DCHECK(!g_icudtl_path_override); |
| 57 g_icudtl_path_override = new std::string(path); | 61 g_icudtl_path_override = new std::string(path); |
| 58 } | 62 } |
| 59 | 63 |
| 60 FilePath FilePathOfEmbeddedICU() { | 64 FilePath FilePathOfEmbeddedICU() { |
| 61 if (g_icudtl_path_override) { | 65 if (g_icudtl_path_override) { |
| 62 return FilePath(*g_icudtl_path_override); | 66 return FilePath(*g_icudtl_path_override); |
| 63 } | 67 } |
| 64 return FilePath(); | 68 return FilePath(); |
| 65 } | 69 } |
| 66 | 70 |
| 67 } // namespace ios | 71 } // namespace ios |
| 68 } // namespace base | 72 } // namespace base |
| OLD | NEW |