OLD | NEW |
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/mac/mac_util.h" | 5 #include "base/mac/mac_util.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 #import <IOKit/IOKitLib.h> | 8 #import <IOKit/IOKitLib.h> |
9 | 9 |
10 #include <errno.h> | 10 #include <errno.h> |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 static int mac_os_x_minor_version = MacOSXMinorVersionInternal(); | 476 static int mac_os_x_minor_version = MacOSXMinorVersionInternal(); |
477 return mac_os_x_minor_version; | 477 return mac_os_x_minor_version; |
478 } | 478 } |
479 | 479 |
480 enum { | 480 enum { |
481 SNOW_LEOPARD_MINOR_VERSION = 6, | 481 SNOW_LEOPARD_MINOR_VERSION = 6, |
482 LION_MINOR_VERSION = 7, | 482 LION_MINOR_VERSION = 7, |
483 MOUNTAIN_LION_MINOR_VERSION = 8, | 483 MOUNTAIN_LION_MINOR_VERSION = 8, |
484 MAVERICKS_MINOR_VERSION = 9, | 484 MAVERICKS_MINOR_VERSION = 9, |
485 YOSEMITE_MINOR_VERSION = 10, | 485 YOSEMITE_MINOR_VERSION = 10, |
| 486 EL_CAPITAN_MINOR_VERSION = 11, |
486 }; | 487 }; |
487 | 488 |
488 } // namespace | 489 } // namespace |
489 | 490 |
490 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GE_10_7) | 491 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GE_10_7) |
491 bool IsOSSnowLeopard() { | 492 bool IsOSSnowLeopard() { |
492 return MacOSXMinorVersion() == SNOW_LEOPARD_MINOR_VERSION; | 493 return MacOSXMinorVersion() == SNOW_LEOPARD_MINOR_VERSION; |
493 } | 494 } |
494 #endif | 495 #endif |
495 | 496 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 return MacOSXMinorVersion() >= YOSEMITE_MINOR_VERSION; | 541 return MacOSXMinorVersion() >= YOSEMITE_MINOR_VERSION; |
541 } | 542 } |
542 #endif | 543 #endif |
543 | 544 |
544 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GT_10_10) | 545 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GT_10_10) |
545 bool IsOSLaterThanYosemite_DontCallThis() { | 546 bool IsOSLaterThanYosemite_DontCallThis() { |
546 return MacOSXMinorVersion() > YOSEMITE_MINOR_VERSION; | 547 return MacOSXMinorVersion() > YOSEMITE_MINOR_VERSION; |
547 } | 548 } |
548 #endif | 549 #endif |
549 | 550 |
| 551 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GT_10_11) |
| 552 bool IsOSElCapitan() { |
| 553 return MacOSXMinorVersion() == EL_CAPITAN_MINOR_VERSION; |
| 554 } |
| 555 #endif |
| 556 |
| 557 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GE_10_11) |
| 558 bool IsOSElCapitanOrLater() { |
| 559 return MacOSXMinorVersion() >= EL_CAPITAN_MINOR_VERSION; |
| 560 } |
| 561 #endif |
| 562 |
550 std::string GetModelIdentifier() { | 563 std::string GetModelIdentifier() { |
551 std::string return_string; | 564 std::string return_string; |
552 ScopedIOObject<io_service_t> platform_expert( | 565 ScopedIOObject<io_service_t> platform_expert( |
553 IOServiceGetMatchingService(kIOMasterPortDefault, | 566 IOServiceGetMatchingService(kIOMasterPortDefault, |
554 IOServiceMatching("IOPlatformExpertDevice"))); | 567 IOServiceMatching("IOPlatformExpertDevice"))); |
555 if (platform_expert) { | 568 if (platform_expert) { |
556 ScopedCFTypeRef<CFDataRef> model_data( | 569 ScopedCFTypeRef<CFDataRef> model_data( |
557 static_cast<CFDataRef>(IORegistryEntryCreateCFProperty( | 570 static_cast<CFDataRef>(IORegistryEntryCreateCFProperty( |
558 platform_expert, | 571 platform_expert, |
559 CFSTR("model"), | 572 CFSTR("model"), |
(...skipping 25 matching lines...) Expand all Loading... |
585 StringPiece(begin + comma_loc + 1, ident.end()), &minor_tmp)) | 598 StringPiece(begin + comma_loc + 1, ident.end()), &minor_tmp)) |
586 return false; | 599 return false; |
587 *type = ident.substr(0, number_loc); | 600 *type = ident.substr(0, number_loc); |
588 *major = major_tmp; | 601 *major = major_tmp; |
589 *minor = minor_tmp; | 602 *minor = minor_tmp; |
590 return true; | 603 return true; |
591 } | 604 } |
592 | 605 |
593 } // namespace mac | 606 } // namespace mac |
594 } // namespace base | 607 } // namespace base |
OLD | NEW |