| 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 <errno.h> | 9 #include <errno.h> |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 bool IsHiddenLoginItem(LSSharedFileListItemRef item) { | 115 bool IsHiddenLoginItem(LSSharedFileListItemRef item) { |
| 116 ScopedCFTypeRef<CFBooleanRef> hidden(reinterpret_cast<CFBooleanRef>( | 116 ScopedCFTypeRef<CFBooleanRef> hidden(reinterpret_cast<CFBooleanRef>( |
| 117 LSSharedFileListItemCopyProperty(item, | 117 LSSharedFileListItemCopyProperty(item, |
| 118 reinterpret_cast<CFStringRef>(kLSSharedFileListLoginItemHidden)))); | 118 reinterpret_cast<CFStringRef>(kLSSharedFileListLoginItemHidden)))); |
| 119 | 119 |
| 120 return hidden && hidden == kCFBooleanTrue; | 120 return hidden && hidden == kCFBooleanTrue; |
| 121 } | 121 } |
| 122 | 122 |
| 123 } // namespace | 123 } // namespace |
| 124 | 124 |
| 125 std::string PathFromFSRef(const FSRef& ref) { | |
| 126 ScopedCFTypeRef<CFURLRef> url( | |
| 127 CFURLCreateFromFSRef(kCFAllocatorDefault, &ref)); | |
| 128 NSString *path_string = [(NSURL *)url.get() path]; | |
| 129 return [path_string fileSystemRepresentation]; | |
| 130 } | |
| 131 | |
| 132 bool FSRefFromPath(const std::string& path, FSRef* ref) { | |
| 133 OSStatus status = FSPathMakeRef((const UInt8*)path.c_str(), | |
| 134 ref, nil); | |
| 135 return status == noErr; | |
| 136 } | |
| 137 | |
| 138 CGColorSpaceRef GetGenericRGBColorSpace() { | 125 CGColorSpaceRef GetGenericRGBColorSpace() { |
| 139 // Leaked. That's OK, it's scoped to the lifetime of the application. | 126 // Leaked. That's OK, it's scoped to the lifetime of the application. |
| 140 static CGColorSpaceRef g_color_space_generic_rgb( | 127 static CGColorSpaceRef g_color_space_generic_rgb( |
| 141 CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB)); | 128 CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB)); |
| 142 DLOG_IF(ERROR, !g_color_space_generic_rgb) << | 129 DLOG_IF(ERROR, !g_color_space_generic_rgb) << |
| 143 "Couldn't get the generic RGB color space"; | 130 "Couldn't get the generic RGB color space"; |
| 144 return g_color_space_generic_rgb; | 131 return g_color_space_generic_rgb; |
| 145 } | 132 } |
| 146 | 133 |
| 147 CGColorSpaceRef GetSRGBColorSpace() { | 134 CGColorSpaceRef GetSRGBColorSpace() { |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 StringPiece(begin + comma_loc + 1, ident.end()), &minor_tmp)) | 462 StringPiece(begin + comma_loc + 1, ident.end()), &minor_tmp)) |
| 476 return false; | 463 return false; |
| 477 *type = ident.substr(0, number_loc); | 464 *type = ident.substr(0, number_loc); |
| 478 *major = major_tmp; | 465 *major = major_tmp; |
| 479 *minor = minor_tmp; | 466 *minor = minor_tmp; |
| 480 return true; | 467 return true; |
| 481 } | 468 } |
| 482 | 469 |
| 483 } // namespace mac | 470 } // namespace mac |
| 484 } // namespace base | 471 } // namespace base |
| OLD | NEW |