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

Side by Side Diff: base/mac/mac_util.mm

Issue 25286002: Update OS version functions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: verified Created 7 years, 2 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
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/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 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 // in 10.y or 10.y.z. 603 // in 10.y or 10.y.z.
604 int MacOSXMinorVersion() { 604 int MacOSXMinorVersion() {
605 static int mac_os_x_minor_version = MacOSXMinorVersionInternal(); 605 static int mac_os_x_minor_version = MacOSXMinorVersionInternal();
606 return mac_os_x_minor_version; 606 return mac_os_x_minor_version;
607 } 607 }
608 608
609 enum { 609 enum {
610 SNOW_LEOPARD_MINOR_VERSION = 6, 610 SNOW_LEOPARD_MINOR_VERSION = 6,
611 LION_MINOR_VERSION = 7, 611 LION_MINOR_VERSION = 7,
612 MOUNTAIN_LION_MINOR_VERSION = 8, 612 MOUNTAIN_LION_MINOR_VERSION = 8,
613 MAVERICKS_MINOR_VERSION = 9,
613 }; 614 };
614 615
615 } // namespace 616 } // namespace
616 617
617 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GE_10_7)
618 bool IsOSSnowLeopard() {
619 return MacOSXMinorVersion() == SNOW_LEOPARD_MINOR_VERSION;
620 }
621 #endif
622
623 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GT_10_7) 618 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GT_10_7)
624 bool IsOSLion() { 619 bool IsOSLion() {
625 return MacOSXMinorVersion() == LION_MINOR_VERSION; 620 return MacOSXMinorVersion() == LION_MINOR_VERSION;
626 } 621 }
627 #endif 622 #endif
628 623
629 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GT_10_7)
630 bool IsOSLionOrEarlier() {
631 return MacOSXMinorVersion() <= LION_MINOR_VERSION;
632 }
633 #endif
634
635 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GE_10_7) 624 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GE_10_7)
636 bool IsOSLionOrLater() { 625 bool IsOSLionOrLater() {
637 return MacOSXMinorVersion() >= LION_MINOR_VERSION; 626 return MacOSXMinorVersion() >= LION_MINOR_VERSION;
638 } 627 }
639 #endif 628 #endif
640 629
641 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GT_10_8) 630 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GT_10_8)
642 bool IsOSMountainLion() { 631 bool IsOSMountainLion() {
643 return MacOSXMinorVersion() == MOUNTAIN_LION_MINOR_VERSION; 632 return MacOSXMinorVersion() == MOUNTAIN_LION_MINOR_VERSION;
644 } 633 }
645 #endif 634 #endif
646 635
647 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GE_10_8) 636 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GE_10_8)
648 bool IsOSMountainLionOrLater() { 637 bool IsOSMountainLionOrLater() {
649 return MacOSXMinorVersion() >= MOUNTAIN_LION_MINOR_VERSION; 638 return MacOSXMinorVersion() >= MOUNTAIN_LION_MINOR_VERSION;
650 } 639 }
651 #endif 640 #endif
652 641
653 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GT_10_8) 642 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GT_10_9)
654 bool IsOSLaterThanMountainLion_DontCallThis() { 643 bool IsOSMavericks() {
655 return MacOSXMinorVersion() > MOUNTAIN_LION_MINOR_VERSION; 644 return MacOSXMinorVersion() == MAVERICKS_MINOR_VERSION;
656 } 645 }
657 #endif 646 #endif
658 647
648 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GE_10_9)
649 bool IsOSMavericksOrLater() {
650 return MacOSXMinorVersion() >= MAVERICKS_MINOR_VERSION;
651 }
652 #endif
653
654 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GT_10_9)
655 bool IsOSLaterThanMavericks_DontCallThis() {
656 return MacOSXMinorVersion() > MAVERICKS_MINOR_VERSION;
657 }
658 #endif
659
659 std::string GetModelIdentifier() { 660 std::string GetModelIdentifier() {
660 std::string return_string; 661 std::string return_string;
661 ScopedIOObject<io_service_t> platform_expert( 662 ScopedIOObject<io_service_t> platform_expert(
662 IOServiceGetMatchingService(kIOMasterPortDefault, 663 IOServiceGetMatchingService(kIOMasterPortDefault,
663 IOServiceMatching("IOPlatformExpertDevice"))); 664 IOServiceMatching("IOPlatformExpertDevice")));
664 if (platform_expert) { 665 if (platform_expert) {
665 ScopedCFTypeRef<CFDataRef> model_data( 666 ScopedCFTypeRef<CFDataRef> model_data(
666 static_cast<CFDataRef>(IORegistryEntryCreateCFProperty( 667 static_cast<CFDataRef>(IORegistryEntryCreateCFProperty(
667 platform_expert, 668 platform_expert,
668 CFSTR("model"), 669 CFSTR("model"),
(...skipping 25 matching lines...) Expand all
694 StringPiece(begin + comma_loc + 1, ident.end()), &minor_tmp)) 695 StringPiece(begin + comma_loc + 1, ident.end()), &minor_tmp))
695 return false; 696 return false;
696 *type = ident.substr(0, number_loc); 697 *type = ident.substr(0, number_loc);
697 *major = major_tmp; 698 *major = major_tmp;
698 *minor = minor_tmp; 699 *minor = minor_tmp;
699 return true; 700 return true;
700 } 701 }
701 702
702 } // namespace mac 703 } // namespace mac
703 } // namespace base 704 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698