Commit 997ed997 authored by Robert Liao's avatar Robert Liao Committed by Commit Bot

Remove base::win::GetNonClientMetrics

There was only one caller in system_fonts_win.cc and it is better
served with a direct call to SystemParametersInfo.

BUG=

Change-Id: Icd3f4e6e27d50d8569e602cb0eeace2c6dd530a5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1861109
Auto-Submit: Robert Liao <robliao@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#706111}
parent 36812aed
// Copyright 2018 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.
// This file is separate from base/win/win_util.h to avoid pulling windows.h
// into too many translation units.
#ifndef BASE_WIN_WIN_CLIENT_METRICS_H_
#define BASE_WIN_WIN_CLIENT_METRICS_H_
#include <windows.h>
// This is the same as NONCLIENTMETRICS except that the
// unused member |iPaddedBorderWidth| has been removed.
struct NONCLIENTMETRICS_XP {
UINT cbSize;
int iBorderWidth;
int iScrollWidth;
int iScrollHeight;
int iCaptionWidth;
int iCaptionHeight;
LOGFONTW lfCaptionFont;
int iSmCaptionWidth;
int iSmCaptionHeight;
LOGFONTW lfSmCaptionFont;
int iMenuWidth;
int iMenuHeight;
LOGFONTW lfMenuFont;
LOGFONTW lfStatusFont;
LOGFONTW lfMessageFont;
};
namespace base {
namespace win {
BASE_EXPORT void GetNonClientMetrics(NONCLIENTMETRICS_XP* metrics);
} // namespace win
} // namespace base
#endif // BASE_WIN_WIN_CLIENT_METRICS_H_
...@@ -53,7 +53,6 @@ ...@@ -53,7 +53,6 @@
#include "base/win/scoped_hstring.h" #include "base/win/scoped_hstring.h"
#include "base/win/scoped_propvariant.h" #include "base/win/scoped_propvariant.h"
#include "base/win/shlwapi.h" #include "base/win/shlwapi.h"
#include "base/win/win_client_metrics.h"
#include "base/win/windows_version.h" #include "base/win/windows_version.h"
namespace base { namespace base {
...@@ -361,17 +360,6 @@ bool IsKeyboardPresentOnSlate(HWND hwnd, std::string* reason) { ...@@ -361,17 +360,6 @@ bool IsKeyboardPresentOnSlate(HWND hwnd, std::string* reason) {
static bool g_crash_on_process_detach = false; static bool g_crash_on_process_detach = false;
void GetNonClientMetrics(NONCLIENTMETRICS_XP* metrics) {
DCHECK(metrics);
metrics->cbSize = sizeof(*metrics);
const bool success = !!SystemParametersInfo(
SPI_GETNONCLIENTMETRICS,
metrics->cbSize,
reinterpret_cast<NONCLIENTMETRICS*>(metrics),
0);
DCHECK(success);
}
bool GetUserSidString(std::wstring* user_sid) { bool GetUserSidString(std::wstring* user_sid) {
// Get the current token. // Get the current token.
HANDLE token = NULL; HANDLE token = NULL;
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/win/scoped_co_mem.h" #include "base/win/scoped_co_mem.h"
#include "base/win/win_client_metrics.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
namespace base { namespace base {
...@@ -48,14 +47,6 @@ TEST(BaseWinUtilTest, TestGetUserSidString) { ...@@ -48,14 +47,6 @@ TEST(BaseWinUtilTest, TestGetUserSidString) {
EXPECT_TRUE(!user_sid.empty()); EXPECT_TRUE(!user_sid.empty());
} }
TEST(BaseWinUtilTest, TestGetNonClientMetrics) {
NONCLIENTMETRICS_XP metrics = {0};
GetNonClientMetrics(&metrics);
EXPECT_GT(metrics.cbSize, 0u);
EXPECT_GT(metrics.iScrollWidth, 0);
EXPECT_GT(metrics.iScrollHeight, 0);
}
TEST(BaseWinUtilTest, TestGetLoadedModulesSnapshot) { TEST(BaseWinUtilTest, TestGetLoadedModulesSnapshot) {
std::vector<HMODULE> snapshot; std::vector<HMODULE> snapshot;
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include "base/win/scoped_gdi_object.h" #include "base/win/scoped_gdi_object.h"
#include "base/win/scoped_hdc.h" #include "base/win/scoped_hdc.h"
#include "base/win/scoped_select_object.h" #include "base/win/scoped_select_object.h"
#include "base/win/win_client_metrics.h"
#include "third_party/skia/include/core/SkFontLCDConfig.h" #include "third_party/skia/include/core/SkFontLCDConfig.h"
#include "third_party/skia/include/core/SkFontMetrics.h" #include "third_party/skia/include/core/SkFontMetrics.h"
#include "third_party/skia/include/core/SkRefCnt.h" #include "third_party/skia/include/core/SkRefCnt.h"
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "ui/gfx/system_fonts_win.h" #include "ui/gfx/system_fonts_win.h"
#include <windows.h>
#include "base/containers/flat_map.h" #include "base/containers/flat_map.h"
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
...@@ -11,7 +13,6 @@ ...@@ -11,7 +13,6 @@
#include "base/win/scoped_gdi_object.h" #include "base/win/scoped_gdi_object.h"
#include "base/win/scoped_hdc.h" #include "base/win/scoped_hdc.h"
#include "base/win/scoped_select_object.h" #include "base/win/scoped_select_object.h"
#include "base/win/win_client_metrics.h"
#include "ui/gfx/platform_font.h" #include "ui/gfx/platform_font.h"
namespace gfx { namespace gfx {
...@@ -137,8 +138,11 @@ class SystemFonts { ...@@ -137,8 +138,11 @@ class SystemFonts {
void Initialize() { void Initialize() {
TRACE_EVENT0("fonts", "gfx::SystemFonts::Initialize"); TRACE_EVENT0("fonts", "gfx::SystemFonts::Initialize");
NONCLIENTMETRICS_XP metrics; NONCLIENTMETRICS metrics = {};
base::win::GetNonClientMetrics(&metrics); metrics.cbSize = sizeof(metrics);
const bool success = !!SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
metrics.cbSize, &metrics, 0);
DCHECK(success);
// NOTE(dfried): When rendering Chrome, we do all of our own font scaling // NOTE(dfried): When rendering Chrome, we do all of our own font scaling
// based on a number of factors, but what Windows reports to us has some // based on a number of factors, but what Windows reports to us has some
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment