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

Side by Side Diff: chrome/browser/renderer_preferences_util.cc

Issue 1054243002: Avoid calling the GetSystemMetrics API in the renderer process on Windows to get the scrollbar metr… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 (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 "chrome/browser/renderer_preferences_util.h" 5 #include "chrome/browser/renderer_preferences_util.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/common/pref_names.h" 10 #include "chrome/common/pref_names.h"
(...skipping 16 matching lines...) Expand all
27 27
28 #if defined(USE_AURA) && defined(OS_LINUX) && !defined(OS_CHROMEOS) 28 #if defined(USE_AURA) && defined(OS_LINUX) && !defined(OS_CHROMEOS)
29 #include "chrome/browser/themes/theme_service.h" 29 #include "chrome/browser/themes/theme_service.h"
30 #include "chrome/browser/themes/theme_service_factory.h" 30 #include "chrome/browser/themes/theme_service_factory.h"
31 #include "ui/views/linux_ui/linux_ui.h" 31 #include "ui/views/linux_ui/linux_ui.h"
32 #endif 32 #endif
33 33
34 #if defined(OS_WIN) 34 #if defined(OS_WIN)
35 #include "base/win/win_util.h" 35 #include "base/win/win_util.h"
36 #include "ui/gfx/platform_font_win.h" 36 #include "ui/gfx/platform_font_win.h"
37 #include "ui/gfx/win/dpi.h"
37 #endif 38 #endif
38 39
39 namespace renderer_preferences_util { 40 namespace renderer_preferences_util {
40 41
41 void UpdateFromSystemSettings(content::RendererPreferences* prefs, 42 void UpdateFromSystemSettings(content::RendererPreferences* prefs,
42 Profile* profile, 43 Profile* profile,
43 content::WebContents* web_contents) { 44 content::WebContents* web_contents) {
44 const PrefService* pref_service = profile->GetPrefs(); 45 const PrefService* pref_service = profile->GetPrefs();
45 prefs->accept_languages = pref_service->GetString(prefs::kAcceptLanguages); 46 prefs->accept_languages = pref_service->GetString(prefs::kAcceptLanguages);
46 prefs->enable_referrers = pref_service->GetBoolean(prefs::kEnableReferrers); 47 prefs->enable_referrers = pref_service->GetBoolean(prefs::kEnableReferrers);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 prefs->menu_font_height = gfx::PlatformFontWin::GetFontSize( 139 prefs->menu_font_height = gfx::PlatformFontWin::GetFontSize(
139 metrics.lfMenuFont); 140 metrics.lfMenuFont);
140 141
141 prefs->status_font_family_name = metrics.lfStatusFont.lfFaceName; 142 prefs->status_font_family_name = metrics.lfStatusFont.lfFaceName;
142 prefs->status_font_height = gfx::PlatformFontWin::GetFontSize( 143 prefs->status_font_height = gfx::PlatformFontWin::GetFontSize(
143 metrics.lfStatusFont); 144 metrics.lfStatusFont);
144 145
145 prefs->message_font_family_name = metrics.lfMessageFont.lfFaceName; 146 prefs->message_font_family_name = metrics.lfMessageFont.lfFaceName;
146 prefs->message_font_height = gfx::PlatformFontWin::GetFontSize( 147 prefs->message_font_height = gfx::PlatformFontWin::GetFontSize(
147 metrics.lfMessageFont); 148 metrics.lfMessageFont);
149
150 prefs->vertical_scroll_bar_width_in_dips =
151 gfx::win::GetSystemMetricsInDIP(SM_CXVSCROLL);
152 prefs->horizontal_scroll_bar_height_in_dips =
brucedawson 2015/04/03 17:00:24 When are SM_CYHSCROLL, SM_CYVSCROLL, and SM_CXHSCR
ananta 2015/04/03 19:17:03 They are not used as of now. I added those just in
153 gfx::win::GetSystemMetricsInDIP(SM_CYHSCROLL);
154 prefs->arrow_bitmap_height_vertical_scroll_bar_in_dips =
155 gfx::win::GetSystemMetricsInDIP(SM_CYVSCROLL);
156 prefs->arrow_bitmap_width_horizontal_scroll_bar_in_dips =
157 gfx::win::GetSystemMetricsInDIP(SM_CXHSCROLL);
jam 2015/04/03 15:08:19 seems this should be done in content layer instead
ananta 2015/04/03 19:17:03 Moved this as well as the font metrics code above
148 #endif 158 #endif
149 } 159 }
150 160
151 } // namespace renderer_preferences_util 161 } // namespace renderer_preferences_util
OLDNEW
« no previous file with comments | « no previous file | content/child/webthemeengine_impl_default.h » ('j') | content/child/webthemeengine_impl_default.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698