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 "third_party/WebKit/public/platform/WebString.h" | 9 #include "third_party/WebKit/public/platform/WebString.h" |
9 #include "third_party/WebKit/public/platform/WebURL.h" | 10 #include "third_party/WebKit/public/platform/WebURL.h" |
10 #include "third_party/WebKit/public/web/WebKit.h" | 11 #include "third_party/WebKit/public/web/WebKit.h" |
11 #include "third_party/WebKit/public/web/WebNetworkStateNotifier.h" | 12 #include "third_party/WebKit/public/web/WebNetworkStateNotifier.h" |
12 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 13 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
13 #include "third_party/WebKit/public/web/WebSettings.h" | 14 #include "third_party/WebKit/public/web/WebSettings.h" |
14 #include "third_party/WebKit/public/web/WebView.h" | 15 #include "third_party/WebKit/public/web/WebView.h" |
15 #include "third_party/icu/source/common/unicode/uchar.h" | 16 #include "third_party/icu/source/common/unicode/uchar.h" |
16 #include "third_party/icu/source/common/unicode/uscript.h" | 17 #include "third_party/icu/source/common/unicode/uscript.h" |
17 #include "webkit/common/webpreferences.h" | |
18 | 18 |
19 using blink::WebNetworkStateNotifier; | 19 using blink::WebNetworkStateNotifier; |
20 using blink::WebRuntimeFeatures; | 20 using blink::WebRuntimeFeatures; |
21 using blink::WebSettings; | 21 using blink::WebSettings; |
22 using blink::WebString; | 22 using blink::WebString; |
23 using blink::WebURL; | 23 using blink::WebURL; |
24 using blink::WebView; | 24 using blink::WebView; |
25 | 25 |
26 namespace content { | 26 namespace content { |
27 | 27 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 case USCRIPT_KATAKANA: | 88 case USCRIPT_KATAKANA: |
89 case USCRIPT_JAPANESE: | 89 case USCRIPT_JAPANESE: |
90 return USCRIPT_KATAKANA_OR_HIRAGANA; | 90 return USCRIPT_KATAKANA_OR_HIRAGANA; |
91 case USCRIPT_KOREAN: | 91 case USCRIPT_KOREAN: |
92 return USCRIPT_HANGUL; | 92 return USCRIPT_HANGUL; |
93 default: | 93 default: |
94 return scriptCode; | 94 return scriptCode; |
95 } | 95 } |
96 } | 96 } |
97 | 97 |
98 void ApplyFontsFromMap(const webkit_glue::ScriptFontFamilyMap& map, | 98 void ApplyFontsFromMap(const content::ScriptFontFamilyMap& map, |
99 SetFontFamilyWrapper setter, | 99 SetFontFamilyWrapper setter, |
100 WebSettings* settings) { | 100 WebSettings* settings) { |
101 for (webkit_glue::ScriptFontFamilyMap::const_iterator it = map.begin(); | 101 for (content::ScriptFontFamilyMap::const_iterator it = map.begin(); |
102 it != map.end(); | 102 it != map.end(); |
103 ++it) { | 103 ++it) { |
104 int32 script = u_getPropertyValueEnum(UCHAR_SCRIPT, (it->first).c_str()); | 104 int32 script = u_getPropertyValueEnum(UCHAR_SCRIPT, (it->first).c_str()); |
105 if (script >= 0 && script < USCRIPT_CODE_LIMIT) { | 105 if (script >= 0 && script < USCRIPT_CODE_LIMIT) { |
106 UScriptCode code = static_cast<UScriptCode>(script); | 106 UScriptCode code = static_cast<UScriptCode>(script); |
107 (*setter)(settings, it->second, GetScriptForWebSettings(code)); | 107 (*setter)(settings, it->second, GetScriptForWebSettings(code)); |
108 } | 108 } |
109 } | 109 } |
110 } | 110 } |
111 | 111 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 settings->setAcceleratedCompositingForCanvasEnabled( | 266 settings->setAcceleratedCompositingForCanvasEnabled( |
267 prefs.experimental_webgl_enabled || prefs.accelerated_2d_canvas_enabled); | 267 prefs.experimental_webgl_enabled || prefs.accelerated_2d_canvas_enabled); |
268 | 268 |
269 // Enable memory info reporting to page if requested on the command line. | 269 // Enable memory info reporting to page if requested on the command line. |
270 settings->setMemoryInfoEnabled(prefs.memory_info_enabled); | 270 settings->setMemoryInfoEnabled(prefs.memory_info_enabled); |
271 | 271 |
272 settings->setAsynchronousSpellCheckingEnabled( | 272 settings->setAsynchronousSpellCheckingEnabled( |
273 prefs.asynchronous_spell_checking_enabled); | 273 prefs.asynchronous_spell_checking_enabled); |
274 settings->setUnifiedTextCheckerEnabled(prefs.unified_textchecker_enabled); | 274 settings->setUnifiedTextCheckerEnabled(prefs.unified_textchecker_enabled); |
275 | 275 |
276 for (webkit_glue::WebInspectorPreferences::const_iterator it = | 276 for (content::WebInspectorPreferences::const_iterator it = |
277 prefs.inspector_settings.begin(); | 277 prefs.inspector_settings.begin(); |
278 it != prefs.inspector_settings.end(); | 278 it != prefs.inspector_settings.end(); |
279 ++it) { | 279 ++it) { |
280 web_view->setInspectorSetting(WebString::fromUTF8(it->first), | 280 web_view->setInspectorSetting(WebString::fromUTF8(it->first), |
281 WebString::fromUTF8(it->second)); | 281 WebString::fromUTF8(it->second)); |
282 } | 282 } |
283 | 283 |
284 // Tabs to link is not part of the settings. WebCore calls | 284 // Tabs to link is not part of the settings. WebCore calls |
285 // ChromeClient::tabsToLinks which is part of the glue code. | 285 // ChromeClient::tabsToLinks which is part of the glue code. |
286 web_view->setTabsToLinks(prefs.tabs_to_links); | 286 web_view->setTabsToLinks(prefs.tabs_to_links); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 settings->setPinchVirtualViewportEnabled( | 376 settings->setPinchVirtualViewportEnabled( |
377 prefs.pinch_virtual_viewport_enabled); | 377 prefs.pinch_virtual_viewport_enabled); |
378 | 378 |
379 settings->setPinchOverlayScrollbarThickness( | 379 settings->setPinchOverlayScrollbarThickness( |
380 prefs.pinch_overlay_scrollbar_thickness); | 380 prefs.pinch_overlay_scrollbar_thickness); |
381 settings->setUseSolidColorScrollbars(prefs.use_solid_color_scrollbars); | 381 settings->setUseSolidColorScrollbars(prefs.use_solid_color_scrollbars); |
382 settings->setCompositorTouchHitTesting(prefs.compositor_touch_hit_testing); | 382 settings->setCompositorTouchHitTesting(prefs.compositor_touch_hit_testing); |
383 } | 383 } |
384 | 384 |
385 } // namespace content | 385 } // namespace content |
OLD | NEW |