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

Side by Side Diff: chrome/browser/ui/prefs/prefs_tab_helper.cc

Issue 2909943003: Removing useless Win7 checks + standardize its use (Closed)
Patch Set: Fix reversed conditionnal Created 3 years, 6 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/ui/prefs/prefs_tab_helper.h" 5 #include "chrome/browser/ui/prefs/prefs_tab_helper.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 #if !defined(OS_ANDROID) 52 #if !defined(OS_ANDROID)
53 #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h" 53 #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h"
54 #endif 54 #endif
55 55
56 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) 56 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
57 #include "chrome/browser/themes/theme_service.h" 57 #include "chrome/browser/themes/theme_service.h"
58 #include "chrome/browser/themes/theme_service_factory.h" 58 #include "chrome/browser/themes/theme_service_factory.h"
59 #endif 59 #endif
60 60
61 #if defined(OS_WIN)
62 #include "base/win/windows_version.h"
63 #endif
64
65 using content::WebContents; 61 using content::WebContents;
66 using content::WebPreferences; 62 using content::WebPreferences;
67 63
68 DEFINE_WEB_CONTENTS_USER_DATA_KEY(PrefsTabHelper); 64 DEFINE_WEB_CONTENTS_USER_DATA_KEY(PrefsTabHelper);
69 65
70 namespace { 66 namespace {
71 67
72 // The list of prefs we want to observe. 68 // The list of prefs we want to observe.
73 const char* const kPrefsToObserve[] = { 69 const char* const kPrefsToObserve[] = {
74 #if BUILDFLAG(ENABLE_EXTENSIONS) 70 #if BUILDFLAG(ENABLE_EXTENSIONS)
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 155
160 #if defined(OS_WIN) 156 #if defined(OS_WIN)
161 // On Windows with antialising we want to use an alternate fixed font like 157 // On Windows with antialising we want to use an alternate fixed font like
162 // Consolas, which looks much better than Courier New. 158 // Consolas, which looks much better than Courier New.
163 bool ShouldUseAlternateDefaultFixedFont(const std::string& script) { 159 bool ShouldUseAlternateDefaultFixedFont(const std::string& script) {
164 if (!base::StartsWith(script, "courier", 160 if (!base::StartsWith(script, "courier",
165 base::CompareCase::INSENSITIVE_ASCII)) 161 base::CompareCase::INSENSITIVE_ASCII))
166 return false; 162 return false;
167 UINT smooth_type = 0; 163 UINT smooth_type = 0;
168 SystemParametersInfo(SPI_GETFONTSMOOTHINGTYPE, 0, &smooth_type, 0); 164 SystemParametersInfo(SPI_GETFONTSMOOTHINGTYPE, 0, &smooth_type, 0);
169 return (base::win::GetVersion() >= base::win::VERSION_WIN7) && 165 return smooth_type == FE_FONTSMOOTHINGCLEARTYPE;
170 (smooth_type == FE_FONTSMOOTHINGCLEARTYPE);
171 } 166 }
172 #endif 167 #endif
173 168
174 struct FontDefault { 169 struct FontDefault {
175 const char* pref_name; 170 const char* pref_name;
176 int resource_id; 171 int resource_id;
177 }; 172 };
178 173
179 // Font pref defaults. The prefs that have defaults vary by platform, since not 174 // Font pref defaults. The prefs that have defaults vary by platform, since not
180 // all platforms have fonts for all scripts for all generic families. 175 // all platforms have fonts for all scripts for all generic families.
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 } 677 }
683 678
684 void PrefsTabHelper::NotifyWebkitPreferencesChanged( 679 void PrefsTabHelper::NotifyWebkitPreferencesChanged(
685 const std::string& pref_name) { 680 const std::string& pref_name) {
686 #if !defined(OS_ANDROID) 681 #if !defined(OS_ANDROID)
687 OnFontFamilyPrefChanged(pref_name); 682 OnFontFamilyPrefChanged(pref_name);
688 #endif 683 #endif
689 684
690 web_contents_->GetRenderViewHost()->OnWebkitPreferencesChanged(); 685 web_contents_->GetRenderViewHost()->OnWebkitPreferencesChanged();
691 } 686 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698