Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(403)

Side by Side Diff: ui/gfx/color_profile_win.cc

Issue 19579005: Move ReadFileToString to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/gn/input_file.cc ('k') | ui/gfx/icon_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/gfx/color_profile.h" 5 #include "ui/gfx/color_profile.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 10
11 namespace gfx { 11 namespace gfx {
12 12
13 void ReadColorProfile(std::vector<char>* profile) { 13 void ReadColorProfile(std::vector<char>* profile) {
14 // TODO: support multiple monitors. 14 // TODO: support multiple monitors.
15 HDC screen_dc = GetDC(NULL); 15 HDC screen_dc = GetDC(NULL);
16 DWORD path_len = MAX_PATH; 16 DWORD path_len = MAX_PATH;
17 WCHAR path[MAX_PATH + 1]; 17 WCHAR path[MAX_PATH + 1];
18 18
19 BOOL res = GetICMProfile(screen_dc, &path_len, path); 19 BOOL res = GetICMProfile(screen_dc, &path_len, path);
20 ReleaseDC(NULL, screen_dc); 20 ReleaseDC(NULL, screen_dc);
21 if (!res) 21 if (!res)
22 return; 22 return;
23 std::string profileData; 23 std::string profileData;
24 if (!file_util::ReadFileToString(base::FilePath(path), &profileData)) 24 if (!base::ReadFileToString(base::FilePath(path), &profileData))
25 return; 25 return;
26 size_t length = profileData.size(); 26 size_t length = profileData.size();
27 if (length > gfx::kMaxProfileLength) 27 if (length > gfx::kMaxProfileLength)
28 return; 28 return;
29 if (length < gfx::kMinProfileLength) 29 if (length < gfx::kMinProfileLength)
30 return; 30 return;
31 profile->assign(profileData.data(), profileData.data() + length); 31 profile->assign(profileData.data(), profileData.data() + length);
32 } 32 }
33 33
34 } // namespace gfx 34 } // namespace gfx
35 35
OLDNEW
« no previous file with comments | « tools/gn/input_file.cc ('k') | ui/gfx/icon_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698