OLD | NEW |
---|---|
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 "webkit/glue/webpreferences.h" | 5 #include "webkit/glue/webpreferences.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNetworkStateNotifi er.h" | 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNetworkStateNotifi er.h" |
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
126 fixed_font_family_map[kCommonScript] = | 126 fixed_font_family_map[kCommonScript] = |
127 ASCIIToUTF16("Courier New"); | 127 ASCIIToUTF16("Courier New"); |
128 serif_font_family_map[kCommonScript] = | 128 serif_font_family_map[kCommonScript] = |
129 ASCIIToUTF16("Times New Roman"); | 129 ASCIIToUTF16("Times New Roman"); |
130 sans_serif_font_family_map[kCommonScript] = | 130 sans_serif_font_family_map[kCommonScript] = |
131 ASCIIToUTF16("Arial"); | 131 ASCIIToUTF16("Arial"); |
132 cursive_font_family_map[kCommonScript] = | 132 cursive_font_family_map[kCommonScript] = |
133 ASCIIToUTF16("Script"); | 133 ASCIIToUTF16("Script"); |
134 fantasy_font_family_map[kCommonScript] = | 134 fantasy_font_family_map[kCommonScript] = |
135 ASCIIToUTF16("Impact"); | 135 ASCIIToUTF16("Impact"); |
136 pictograph_font_family_map[kCommonScript] = | |
137 #if !defined(OS_MACOSX) | |
138 ASCIIToUTF16("Times New Roman"); | |
tony
2012/10/05 17:35:22
Do we ever end up using the default value? Do we
| |
139 #else | |
140 ASCIIToUTF16("Apple Color Emoji"); | |
141 #endif | |
136 } | 142 } |
137 | 143 |
138 WebPreferences::~WebPreferences() { | 144 WebPreferences::~WebPreferences() { |
139 } | 145 } |
140 | 146 |
141 namespace { | 147 namespace { |
142 | 148 |
143 void setStandardFontFamilyWrapper(WebSettings* settings, | 149 void setStandardFontFamilyWrapper(WebSettings* settings, |
144 const string16& font, | 150 const string16& font, |
145 UScriptCode script) { | 151 UScriptCode script) { |
(...skipping 23 matching lines...) Expand all Loading... | |
169 UScriptCode script) { | 175 UScriptCode script) { |
170 settings->setCursiveFontFamily(font, script); | 176 settings->setCursiveFontFamily(font, script); |
171 } | 177 } |
172 | 178 |
173 void setFantasyFontFamilyWrapper(WebSettings* settings, | 179 void setFantasyFontFamilyWrapper(WebSettings* settings, |
174 const string16& font, | 180 const string16& font, |
175 UScriptCode script) { | 181 UScriptCode script) { |
176 settings->setFantasyFontFamily(font, script); | 182 settings->setFantasyFontFamily(font, script); |
177 } | 183 } |
178 | 184 |
185 void setPictographFontFamilyWrapper(WebSettings* settings, | |
186 const string16& font, | |
187 UScriptCode script) { | |
188 settings->setPictographFontFamily(font, script); | |
189 } | |
190 | |
179 typedef void (*SetFontFamilyWrapper)( | 191 typedef void (*SetFontFamilyWrapper)( |
180 WebKit::WebSettings*, const string16&, UScriptCode); | 192 WebKit::WebSettings*, const string16&, UScriptCode); |
181 | 193 |
182 // If |scriptCode| is a member of a family of "similar" script codes, returns | 194 // If |scriptCode| is a member of a family of "similar" script codes, returns |
183 // the script code in that family that is used by WebKit for font selection | 195 // the script code in that family that is used by WebKit for font selection |
184 // purposes. For example, USCRIPT_KATAKANA_OR_HIRAGANA and USCRIPT_JAPANESE are | 196 // purposes. For example, USCRIPT_KATAKANA_OR_HIRAGANA and USCRIPT_JAPANESE are |
185 // considered equivalent for the purposes of font selection. WebKit uses the | 197 // considered equivalent for the purposes of font selection. WebKit uses the |
186 // script code USCRIPT_KATAKANA_OR_HIRAGANA. So, if |scriptCode| is | 198 // script code USCRIPT_KATAKANA_OR_HIRAGANA. So, if |scriptCode| is |
187 // USCRIPT_JAPANESE, the function returns USCRIPT_KATAKANA_OR_HIRAGANA. WebKit | 199 // USCRIPT_JAPANESE, the function returns USCRIPT_KATAKANA_OR_HIRAGANA. WebKit |
188 // uses different scripts than the ones in Chrome pref names because the version | 200 // uses different scripts than the ones in Chrome pref names because the version |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
221 ApplyFontsFromMap(standard_font_family_map, setStandardFontFamilyWrapper, | 233 ApplyFontsFromMap(standard_font_family_map, setStandardFontFamilyWrapper, |
222 settings); | 234 settings); |
223 ApplyFontsFromMap(fixed_font_family_map, setFixedFontFamilyWrapper, settings); | 235 ApplyFontsFromMap(fixed_font_family_map, setFixedFontFamilyWrapper, settings); |
224 ApplyFontsFromMap(serif_font_family_map, setSerifFontFamilyWrapper, settings); | 236 ApplyFontsFromMap(serif_font_family_map, setSerifFontFamilyWrapper, settings); |
225 ApplyFontsFromMap(sans_serif_font_family_map, setSansSerifFontFamilyWrapper, | 237 ApplyFontsFromMap(sans_serif_font_family_map, setSansSerifFontFamilyWrapper, |
226 settings); | 238 settings); |
227 ApplyFontsFromMap(cursive_font_family_map, setCursiveFontFamilyWrapper, | 239 ApplyFontsFromMap(cursive_font_family_map, setCursiveFontFamilyWrapper, |
228 settings); | 240 settings); |
229 ApplyFontsFromMap(fantasy_font_family_map, setFantasyFontFamilyWrapper, | 241 ApplyFontsFromMap(fantasy_font_family_map, setFantasyFontFamilyWrapper, |
230 settings); | 242 settings); |
243 ApplyFontsFromMap(pictograph_font_family_map, setPictographFontFamilyWrapper, | |
244 settings); | |
231 settings->setDefaultFontSize(default_font_size); | 245 settings->setDefaultFontSize(default_font_size); |
232 settings->setDefaultFixedFontSize(default_fixed_font_size); | 246 settings->setDefaultFixedFontSize(default_fixed_font_size); |
233 settings->setMinimumFontSize(minimum_font_size); | 247 settings->setMinimumFontSize(minimum_font_size); |
234 settings->setMinimumLogicalFontSize(minimum_logical_font_size); | 248 settings->setMinimumLogicalFontSize(minimum_logical_font_size); |
235 settings->setDefaultTextEncodingName(ASCIIToUTF16(default_encoding)); | 249 settings->setDefaultTextEncodingName(ASCIIToUTF16(default_encoding)); |
236 settings->setApplyDefaultDeviceScaleFactorInCompositor( | 250 settings->setApplyDefaultDeviceScaleFactorInCompositor( |
237 apply_default_device_scale_factor_in_compositor); | 251 apply_default_device_scale_factor_in_compositor); |
238 settings->setJavaScriptEnabled(javascript_enabled); | 252 settings->setJavaScriptEnabled(javascript_enabled); |
239 settings->setWebSecurityEnabled(web_security_enabled); | 253 settings->setWebSecurityEnabled(web_security_enabled); |
240 settings->setJavaScriptCanOpenWindowsAutomatically( | 254 settings->setJavaScriptCanOpenWindowsAutomatically( |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
416 settings->setMaxUntiledLayerSize( | 430 settings->setMaxUntiledLayerSize( |
417 WebSize(max_untiled_layer_width, max_untiled_layer_height)); | 431 WebSize(max_untiled_layer_width, max_untiled_layer_height)); |
418 | 432 |
419 settings->setFixedPositionCreatesStackingContext( | 433 settings->setFixedPositionCreatesStackingContext( |
420 fixed_position_creates_stacking_context); | 434 fixed_position_creates_stacking_context); |
421 | 435 |
422 WebNetworkStateNotifier::setOnLine(is_online); | 436 WebNetworkStateNotifier::setOnLine(is_online); |
423 } | 437 } |
424 | 438 |
425 } // namespace webkit_glue | 439 } // namespace webkit_glue |
OLD | NEW |