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

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

Issue 2963783002: Remove unsafe registry APIs from base::win::RegKey
Patch Set: half-fix remoting Created 3 years, 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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/font_render_params.h" 5 #include "ui/gfx/font_render_params.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 13 matching lines...) Expand all
24 for (int i = 0; EnumDisplayDevices(nullptr, i, &display_device, 0); ++i) { 24 for (int i = 0; EnumDisplayDevices(nullptr, i, &display_device, 0); ++i) {
25 // TODO(scottmg): We only support the primary device currently. 25 // TODO(scottmg): We only support the primary device currently.
26 if (display_device.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) { 26 if (display_device.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) {
27 base::FilePath trimmed = 27 base::FilePath trimmed =
28 base::FilePath(display_device.DeviceName).BaseName(); 28 base::FilePath(display_device.DeviceName).BaseName();
29 base::win::RegKey key( 29 base::win::RegKey key(
30 HKEY_LOCAL_MACHINE, 30 HKEY_LOCAL_MACHINE,
31 (L"SOFTWARE\\Microsoft\\Avalon.Graphics\\" + trimmed.value()).c_str(), 31 (L"SOFTWARE\\Microsoft\\Avalon.Graphics\\" + trimmed.value()).c_str(),
32 KEY_READ); 32 KEY_READ);
33 DWORD pixel_structure; 33 DWORD pixel_structure;
34 if (key.ReadValueDW(L"PixelStructure", &pixel_structure) == 34 if (key.Valid() && key.ReadValueDW(L"PixelStructure", &pixel_structure) ==
35 ERROR_SUCCESS) { 35 ERROR_SUCCESS) {
36 if (pixel_structure == 1) 36 if (pixel_structure == 1)
37 return FontRenderParams::SUBPIXEL_RENDERING_RGB; 37 return FontRenderParams::SUBPIXEL_RENDERING_RGB;
38 if (pixel_structure == 2) 38 if (pixel_structure == 2)
39 return FontRenderParams::SUBPIXEL_RENDERING_BGR; 39 return FontRenderParams::SUBPIXEL_RENDERING_BGR;
40 } 40 }
41 break; 41 break;
42 } 42 }
43 } 43 }
44 44
45 // No explicit ClearType settings, default to RGB. 45 // No explicit ClearType settings, default to RGB.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 105
106 FontRenderParams GetFontRenderParams(const FontRenderParamsQuery& query, 106 FontRenderParams GetFontRenderParams(const FontRenderParamsQuery& query,
107 std::string* family_out) { 107 std::string* family_out) {
108 if (family_out) 108 if (family_out)
109 NOTIMPLEMENTED(); 109 NOTIMPLEMENTED();
110 // Customized font rendering settings are not supported, only defaults. 110 // Customized font rendering settings are not supported, only defaults.
111 return CachedFontRenderParams::GetInstance()->GetParams(); 111 return CachedFontRenderParams::GetInstance()->GetParams();
112 } 112 }
113 113
114 } // namespace gfx 114 } // namespace gfx
OLDNEW
« chrome/common/chrome_paths.cc ('K') | « remoting/host/daemon_process_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698