Index: ui/gfx/color_profile_mac.cc |
diff --git a/ui/gfx/color_profile_mac.cc b/ui/gfx/color_profile_mac.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4ad1c5788c42f0303f12f405dc7a30f383f73f0b |
--- /dev/null |
+++ b/ui/gfx/color_profile_mac.cc |
@@ -0,0 +1,26 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "ui/gfx/color_profile.h" |
+ |
+#include "base/mac/mac_util.h" |
+ |
+namespace gfx { |
+ |
+void ReadColorProfile(std::vector<char>* profile) { |
+ CGColorSpaceRef monitor_color_space(base::mac::GetSystemColorSpace()); |
+ CFDataRef icc_profile(CGColorSpaceCopyICCProfile(monitor_color_space)); |
Nico
2013/03/04 14:10:53
This is leaked, right? (Fix at https://codereview.
|
+ if (icc_profile) { |
+ size_t length = CFDataGetLength(icc_profile); |
+ if (length > gfx::kMaxProfileLength) |
+ return; |
+ if (length < gfx::kMinProfileLength) |
+ return; |
+ const unsigned char* sys_profile = CFDataGetBytePtr(icc_profile); |
+ profile->assign(sys_profile, sys_profile + length); |
+ } |
+} |
+ |
+} // namespace gfx |
+ |