1// Copyright 2014 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "ui/gfx/color_profile.h"
6
7#include "base/mac/mac_util.h"
8
9namespace gfx {
10
11bool GetDisplayColorProfile(const gfx::Rect& bounds,
12                            std::vector<char>* profile) {
13  if (bounds.IsEmpty())
14    return false;
15  // TODO(noel): implement.
16  return false;
17}
18
19void ReadColorProfile(std::vector<char>* profile) {
20  CGColorSpaceRef monitor_color_space(base::mac::GetSystemColorSpace());
21  base::ScopedCFTypeRef<CFDataRef> icc_profile(
22      CGColorSpaceCopyICCProfile(monitor_color_space));
23  if (!icc_profile)
24    return;
25  size_t length = CFDataGetLength(icc_profile);
26  if (gfx::InvalidColorProfileLength(length))
27    return;
28  const unsigned char* data = CFDataGetBytePtr(icc_profile);
29  profile->assign(data, data + length);
30}
31
32}  // namespace gfx
33