OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/public/renderer/web_preferences.h" | 5 #include "content/public/renderer/web_preferences.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "content/public/common/webpreferences.h" |
8 #include "content/renderer/net_info_helper.h" | 9 #include "content/renderer/net_info_helper.h" |
9 #include "third_party/WebKit/public/platform/WebConnectionType.h" | 10 #include "third_party/WebKit/public/platform/WebConnectionType.h" |
10 #include "third_party/WebKit/public/platform/WebString.h" | 11 #include "third_party/WebKit/public/platform/WebString.h" |
11 #include "third_party/WebKit/public/platform/WebURL.h" | 12 #include "third_party/WebKit/public/platform/WebURL.h" |
12 #include "third_party/WebKit/public/web/WebKit.h" | 13 #include "third_party/WebKit/public/web/WebKit.h" |
13 #include "third_party/WebKit/public/web/WebNetworkStateNotifier.h" | 14 #include "third_party/WebKit/public/web/WebNetworkStateNotifier.h" |
14 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 15 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
15 #include "third_party/WebKit/public/web/WebSettings.h" | 16 #include "third_party/WebKit/public/web/WebSettings.h" |
16 #include "third_party/WebKit/public/web/WebView.h" | 17 #include "third_party/WebKit/public/web/WebView.h" |
17 #include "third_party/icu/source/common/unicode/uchar.h" | 18 #include "third_party/icu/source/common/unicode/uchar.h" |
18 #include "third_party/icu/source/common/unicode/uscript.h" | 19 #include "third_party/icu/source/common/unicode/uscript.h" |
19 #include "webkit/common/webpreferences.h" | |
20 | 20 |
21 using blink::WebNetworkStateNotifier; | 21 using blink::WebNetworkStateNotifier; |
22 using blink::WebRuntimeFeatures; | 22 using blink::WebRuntimeFeatures; |
23 using blink::WebSettings; | 23 using blink::WebSettings; |
24 using blink::WebString; | 24 using blink::WebString; |
25 using blink::WebURL; | 25 using blink::WebURL; |
26 using blink::WebView; | 26 using blink::WebView; |
27 | 27 |
28 namespace content { | 28 namespace content { |
29 | 29 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 case USCRIPT_KATAKANA: | 90 case USCRIPT_KATAKANA: |
91 case USCRIPT_JAPANESE: | 91 case USCRIPT_JAPANESE: |
92 return USCRIPT_KATAKANA_OR_HIRAGANA; | 92 return USCRIPT_KATAKANA_OR_HIRAGANA; |
93 case USCRIPT_KOREAN: | 93 case USCRIPT_KOREAN: |
94 return USCRIPT_HANGUL; | 94 return USCRIPT_HANGUL; |
95 default: | 95 default: |
96 return scriptCode; | 96 return scriptCode; |
97 } | 97 } |
98 } | 98 } |
99 | 99 |
100 void ApplyFontsFromMap(const webkit_glue::ScriptFontFamilyMap& map, | 100 void ApplyFontsFromMap(const ScriptFontFamilyMap& map, |
101 SetFontFamilyWrapper setter, | 101 SetFontFamilyWrapper setter, |
102 WebSettings* settings) { | 102 WebSettings* settings) { |
103 for (webkit_glue::ScriptFontFamilyMap::const_iterator it = map.begin(); | 103 for (ScriptFontFamilyMap::const_iterator it = map.begin(); it != map.end(); |
104 it != map.end(); | |
105 ++it) { | 104 ++it) { |
106 int32 script = u_getPropertyValueEnum(UCHAR_SCRIPT, (it->first).c_str()); | 105 int32 script = u_getPropertyValueEnum(UCHAR_SCRIPT, (it->first).c_str()); |
107 if (script >= 0 && script < USCRIPT_CODE_LIMIT) { | 106 if (script >= 0 && script < USCRIPT_CODE_LIMIT) { |
108 UScriptCode code = static_cast<UScriptCode>(script); | 107 UScriptCode code = static_cast<UScriptCode>(script); |
109 (*setter)(settings, it->second, GetScriptForWebSettings(code)); | 108 (*setter)(settings, it->second, GetScriptForWebSettings(code)); |
110 } | 109 } |
111 } | 110 } |
112 } | 111 } |
113 | 112 |
114 } // namespace | 113 } // namespace |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 prefs.accelerated_compositing_for_video_enabled); | 226 prefs.accelerated_compositing_for_video_enabled); |
228 | 227 |
229 // WebGL and accelerated 2D canvas are always gpu composited. | 228 // WebGL and accelerated 2D canvas are always gpu composited. |
230 settings->setAcceleratedCompositingForCanvasEnabled( | 229 settings->setAcceleratedCompositingForCanvasEnabled( |
231 prefs.experimental_webgl_enabled || prefs.accelerated_2d_canvas_enabled); | 230 prefs.experimental_webgl_enabled || prefs.accelerated_2d_canvas_enabled); |
232 | 231 |
233 settings->setAsynchronousSpellCheckingEnabled( | 232 settings->setAsynchronousSpellCheckingEnabled( |
234 prefs.asynchronous_spell_checking_enabled); | 233 prefs.asynchronous_spell_checking_enabled); |
235 settings->setUnifiedTextCheckerEnabled(prefs.unified_textchecker_enabled); | 234 settings->setUnifiedTextCheckerEnabled(prefs.unified_textchecker_enabled); |
236 | 235 |
237 for (webkit_glue::WebInspectorPreferences::const_iterator it = | 236 for (WebInspectorPreferences::const_iterator it = |
238 prefs.inspector_settings.begin(); | 237 prefs.inspector_settings.begin(); |
239 it != prefs.inspector_settings.end(); | 238 it != prefs.inspector_settings.end(); |
240 ++it) { | 239 ++it) { |
241 web_view->setInspectorSetting(WebString::fromUTF8(it->first), | 240 web_view->setInspectorSetting(WebString::fromUTF8(it->first), |
242 WebString::fromUTF8(it->second)); | 241 WebString::fromUTF8(it->second)); |
243 } | 242 } |
244 | 243 |
245 // Tabs to link is not part of the settings. WebCore calls | 244 // Tabs to link is not part of the settings. WebCore calls |
246 // ChromeClient::tabsToLinks which is part of the glue code. | 245 // ChromeClient::tabsToLinks which is part of the glue code. |
247 web_view->setTabsToLinks(prefs.tabs_to_links); | 246 web_view->setTabsToLinks(prefs.tabs_to_links); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 settings->setPinchVirtualViewportEnabled( | 330 settings->setPinchVirtualViewportEnabled( |
332 prefs.pinch_virtual_viewport_enabled); | 331 prefs.pinch_virtual_viewport_enabled); |
333 | 332 |
334 settings->setPinchOverlayScrollbarThickness( | 333 settings->setPinchOverlayScrollbarThickness( |
335 prefs.pinch_overlay_scrollbar_thickness); | 334 prefs.pinch_overlay_scrollbar_thickness); |
336 settings->setUseSolidColorScrollbars(prefs.use_solid_color_scrollbars); | 335 settings->setUseSolidColorScrollbars(prefs.use_solid_color_scrollbars); |
337 settings->setCompositorTouchHitTesting(prefs.compositor_touch_hit_testing); | 336 settings->setCompositorTouchHitTesting(prefs.compositor_touch_hit_testing); |
338 } | 337 } |
339 | 338 |
340 } // namespace content | 339 } // namespace content |
OLD | NEW |