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 | 9 |
10 #include <errno.h> | 10 #include <errno.h> |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 NSString *path_string = [(NSURL *)url.get() path]; | 137 NSString *path_string = [(NSURL *)url.get() path]; |
138 return [path_string fileSystemRepresentation]; | 138 return [path_string fileSystemRepresentation]; |
139 } | 139 } |
140 | 140 |
141 bool FSRefFromPath(const std::string& path, FSRef* ref) { | 141 bool FSRefFromPath(const std::string& path, FSRef* ref) { |
142 OSStatus status = FSPathMakeRef((const UInt8*)path.c_str(), | 142 OSStatus status = FSPathMakeRef((const UInt8*)path.c_str(), |
143 ref, nil); | 143 ref, nil); |
144 return status == noErr; | 144 return status == noErr; |
145 } | 145 } |
146 | 146 |
| 147 CGColorSpaceRef GetGenericRGBColorSpace() { |
| 148 // Leaked. That's OK, it's scoped to the lifetime of the application. |
| 149 static CGColorSpaceRef g_color_space_generic_rgb( |
| 150 CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB)); |
| 151 DLOG_IF(ERROR, !g_color_space_generic_rgb) << |
| 152 "Couldn't get the generic RGB color space"; |
| 153 return g_color_space_generic_rgb; |
| 154 } |
| 155 |
147 CGColorSpaceRef GetSRGBColorSpace() { | 156 CGColorSpaceRef GetSRGBColorSpace() { |
148 // Leaked. That's OK, it's scoped to the lifetime of the application. | 157 // Leaked. That's OK, it's scoped to the lifetime of the application. |
149 static CGColorSpaceRef g_color_space_sRGB = | 158 static CGColorSpaceRef g_color_space_sRGB = |
150 CGColorSpaceCreateWithName(kCGColorSpaceSRGB); | 159 CGColorSpaceCreateWithName(kCGColorSpaceSRGB); |
151 DLOG_IF(ERROR, !g_color_space_sRGB) << "Couldn't get the sRGB color space"; | 160 DLOG_IF(ERROR, !g_color_space_sRGB) << "Couldn't get the sRGB color space"; |
152 return g_color_space_sRGB; | 161 return g_color_space_sRGB; |
153 } | 162 } |
154 | 163 |
155 CGColorSpaceRef GetSystemColorSpace() { | 164 CGColorSpaceRef GetSystemColorSpace() { |
156 // Leaked. That's OK, it's scoped to the lifetime of the application. | 165 // Leaked. That's OK, it's scoped to the lifetime of the application. |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 StringPiece(begin + comma_loc + 1, ident.end()), &minor_tmp)) | 694 StringPiece(begin + comma_loc + 1, ident.end()), &minor_tmp)) |
686 return false; | 695 return false; |
687 *type = ident.substr(0, number_loc); | 696 *type = ident.substr(0, number_loc); |
688 *major = major_tmp; | 697 *major = major_tmp; |
689 *minor = minor_tmp; | 698 *minor = minor_tmp; |
690 return true; | 699 return true; |
691 } | 700 } |
692 | 701 |
693 } // namespace mac | 702 } // namespace mac |
694 } // namespace base | 703 } // namespace base |
OLD | NEW |