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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 } | 468 } |
469 | 469 |
470 bool WasLaunchedAsHiddenLoginItem() { | 470 bool WasLaunchedAsHiddenLoginItem() { |
471 if (!WasLaunchedAsLoginOrResumeItem()) | 471 if (!WasLaunchedAsLoginOrResumeItem()) |
472 return false; | 472 return false; |
473 | 473 |
474 ScopedCFTypeRef<LSSharedFileListItemRef> item(GetLoginItemForApp()); | 474 ScopedCFTypeRef<LSSharedFileListItemRef> item(GetLoginItemForApp()); |
475 if (!item.get()) { | 475 if (!item.get()) { |
476 // Lion can launch items for the resume feature. So log an error only for | 476 // Lion can launch items for the resume feature. So log an error only for |
477 // Snow Leopard or earlier. | 477 // Snow Leopard or earlier. |
478 if (IsOSSnowLeopardOrEarlier()) | 478 if (IsOSSnowLeopard()) |
479 DLOG(ERROR) << | 479 DLOG(ERROR) << |
480 "Process launched at Login but can't access Login Item List."; | 480 "Process launched at Login but can't access Login Item List."; |
481 | 481 |
482 return false; | 482 return false; |
483 } | 483 } |
484 return IsHiddenLoginItem(item); | 484 return IsHiddenLoginItem(item); |
485 } | 485 } |
486 | 486 |
487 namespace { | 487 namespace { |
488 | 488 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 }; | 566 }; |
567 | 567 |
568 } // namespace | 568 } // namespace |
569 | 569 |
570 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GE_10_7) | 570 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GE_10_7) |
571 bool IsOSSnowLeopard() { | 571 bool IsOSSnowLeopard() { |
572 return MacOSXMinorVersion() == SNOW_LEOPARD_MINOR_VERSION; | 572 return MacOSXMinorVersion() == SNOW_LEOPARD_MINOR_VERSION; |
573 } | 573 } |
574 #endif | 574 #endif |
575 | 575 |
576 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GE_10_7) | |
577 bool IsOSSnowLeopardOrEarlier() { | |
578 return MacOSXMinorVersion() <= SNOW_LEOPARD_MINOR_VERSION; | |
579 } | |
580 #endif | |
581 | |
582 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GE_10_6) | |
583 bool IsOSSnowLeopardOrLater() { | |
584 return MacOSXMinorVersion() >= SNOW_LEOPARD_MINOR_VERSION; | |
585 } | |
586 #endif | |
587 | |
588 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GT_10_7) | 576 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GT_10_7) |
589 bool IsOSLion() { | 577 bool IsOSLion() { |
590 return MacOSXMinorVersion() == LION_MINOR_VERSION; | 578 return MacOSXMinorVersion() == LION_MINOR_VERSION; |
591 } | 579 } |
592 #endif | 580 #endif |
593 | 581 |
594 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GT_10_7) | 582 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GT_10_7) |
595 bool IsOSLionOrEarlier() { | 583 bool IsOSLionOrEarlier() { |
596 return MacOSXMinorVersion() <= LION_MINOR_VERSION; | 584 return MacOSXMinorVersion() <= LION_MINOR_VERSION; |
597 } | 585 } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 StringPiece(begin + comma_loc + 1, ident.end()), &minor_tmp)) | 657 StringPiece(begin + comma_loc + 1, ident.end()), &minor_tmp)) |
670 return false; | 658 return false; |
671 *type = ident.substr(0, number_loc); | 659 *type = ident.substr(0, number_loc); |
672 *major = major_tmp; | 660 *major = major_tmp; |
673 *minor = minor_tmp; | 661 *minor = minor_tmp; |
674 return true; | 662 return true; |
675 } | 663 } |
676 | 664 |
677 } // namespace mac | 665 } // namespace mac |
678 } // namespace base | 666 } // namespace base |
OLD | NEW |