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
3 // found in the LICENSE file.
5 #include "ui/gfx/color_profile.h"
10 #include "base/files/file_util.h"
11 #include "base/lazy_instance.h"
12 #include "base/synchronization/lock.h"
16 void ReadColorProfile(std::vector
<char>* profile
) {
17 // TODO: support multiple monitors.
18 HDC screen_dc
= GetDC(NULL
);
19 DWORD path_len
= MAX_PATH
;
20 WCHAR path
[MAX_PATH
+ 1];
22 BOOL result
= GetICMProfile(screen_dc
, &path_len
, path
);
23 ReleaseDC(NULL
, screen_dc
);
26 std::string profileData
;
27 if (!base::ReadFileToString(base::FilePath(path
), &profileData
))
29 size_t length
= profileData
.size();
30 if (gfx::InvalidColorProfileLength(length
))
32 profile
->assign(profileData
.data(), profileData
.data() + length
);