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 #include <string.h> | 9 #include <string.h> |
10 #include <sys/utsname.h> | 10 #include <sys/utsname.h> |
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 } | 553 } |
554 | 554 |
555 // Returns the running system's Mac OS X minor version. This is the |y| value | 555 // Returns the running system's Mac OS X minor version. This is the |y| value |
556 // in 10.y or 10.y.z. | 556 // in 10.y or 10.y.z. |
557 int MacOSXMinorVersion() { | 557 int MacOSXMinorVersion() { |
558 static int mac_os_x_minor_version = MacOSXMinorVersionInternal(); | 558 static int mac_os_x_minor_version = MacOSXMinorVersionInternal(); |
559 return mac_os_x_minor_version; | 559 return mac_os_x_minor_version; |
560 } | 560 } |
561 | 561 |
562 enum { | 562 enum { |
563 LEOPARD_MINOR_VERSION = 5, | |
564 SNOW_LEOPARD_MINOR_VERSION = 6, | 563 SNOW_LEOPARD_MINOR_VERSION = 6, |
565 LION_MINOR_VERSION = 7, | 564 LION_MINOR_VERSION = 7, |
566 MOUNTAIN_LION_MINOR_VERSION = 8, | 565 MOUNTAIN_LION_MINOR_VERSION = 8, |
567 }; | 566 }; |
568 | 567 |
569 } // namespace | 568 } // namespace |
570 | 569 |
571 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GE_10_6) | |
572 bool IsOSLeopard() { | |
573 return MacOSXMinorVersion() == LEOPARD_MINOR_VERSION; | |
574 } | |
575 #endif | |
576 | |
577 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GE_10_6) | |
578 bool IsOSLeopardOrEarlier() { | |
579 return MacOSXMinorVersion() <= LEOPARD_MINOR_VERSION; | |
580 } | |
581 #endif | |
582 | |
583 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GE_10_7) | 570 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GE_10_7) |
584 bool IsOSSnowLeopard() { | 571 bool IsOSSnowLeopard() { |
585 return MacOSXMinorVersion() == SNOW_LEOPARD_MINOR_VERSION; | 572 return MacOSXMinorVersion() == SNOW_LEOPARD_MINOR_VERSION; |
586 } | 573 } |
587 #endif | 574 #endif |
588 | 575 |
589 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GE_10_7) | 576 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GE_10_7) |
590 bool IsOSSnowLeopardOrEarlier() { | 577 bool IsOSSnowLeopardOrEarlier() { |
591 return MacOSXMinorVersion() <= SNOW_LEOPARD_MINOR_VERSION; | 578 return MacOSXMinorVersion() <= SNOW_LEOPARD_MINOR_VERSION; |
592 } | 579 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 StringPiece(begin + comma_loc + 1, ident.end()), &minor_tmp)) | 669 StringPiece(begin + comma_loc + 1, ident.end()), &minor_tmp)) |
683 return false; | 670 return false; |
684 *type = ident.substr(0, number_loc); | 671 *type = ident.substr(0, number_loc); |
685 *major = major_tmp; | 672 *major = major_tmp; |
686 *minor = minor_tmp; | 673 *minor = minor_tmp; |
687 return true; | 674 return true; |
688 } | 675 } |
689 | 676 |
690 } // namespace mac | 677 } // namespace mac |
691 } // namespace base | 678 } // namespace base |
OLD | NEW |