| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 if (CFEqual(item_url, url)) { | 88 if (CFEqual(item_url, url)) { |
| 89 CFRetain(item); | 89 CFRetain(item); |
| 90 return item; | 90 return item; |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 | 94 |
| 95 return NULL; | 95 return NULL; |
| 96 } | 96 } |
| 97 | 97 |
| 98 #if !defined(MAC_OS_X_VERSION_10_6) || \ | |
| 99 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 | |
| 100 // kLSSharedFileListLoginItemHidden is supported on | |
| 101 // 10.5, but missing from the 10.5 headers. | |
| 102 // http://openradar.appspot.com/6482251 | |
| 103 static NSString* kLSSharedFileListLoginItemHidden = | |
| 104 @"com.apple.loginitem.HideOnLaunch"; | |
| 105 #endif | |
| 106 | |
| 107 bool IsHiddenLoginItem(LSSharedFileListItemRef item) { | 98 bool IsHiddenLoginItem(LSSharedFileListItemRef item) { |
| 108 ScopedCFTypeRef<CFBooleanRef> hidden(reinterpret_cast<CFBooleanRef>( | 99 ScopedCFTypeRef<CFBooleanRef> hidden(reinterpret_cast<CFBooleanRef>( |
| 109 LSSharedFileListItemCopyProperty(item, | 100 LSSharedFileListItemCopyProperty(item, |
| 110 reinterpret_cast<CFStringRef>(kLSSharedFileListLoginItemHidden)))); | 101 reinterpret_cast<CFStringRef>(kLSSharedFileListLoginItemHidden)))); |
| 111 | 102 |
| 112 return hidden && hidden == kCFBooleanTrue; | 103 return hidden && hidden == kCFBooleanTrue; |
| 113 } | 104 } |
| 114 | 105 |
| 115 } // namespace | 106 } // namespace |
| 116 | 107 |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 StringPiece(begin + comma_loc + 1, ident.end()), &minor_tmp)) | 682 StringPiece(begin + comma_loc + 1, ident.end()), &minor_tmp)) |
| 692 return false; | 683 return false; |
| 693 *type = ident.substr(0, number_loc); | 684 *type = ident.substr(0, number_loc); |
| 694 *major = major_tmp; | 685 *major = major_tmp; |
| 695 *minor = minor_tmp; | 686 *minor = minor_tmp; |
| 696 return true; | 687 return true; |
| 697 } | 688 } |
| 698 | 689 |
| 699 } // namespace mac | 690 } // namespace mac |
| 700 } // namespace base | 691 } // namespace base |
| OLD | NEW |