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/debug/trace_event.h" |
7 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.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" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 if (script >= 0 && script < USCRIPT_CODE_LIMIT) { | 108 if (script >= 0 && script < USCRIPT_CODE_LIMIT) { |
108 UScriptCode code = static_cast<UScriptCode>(script); | 109 UScriptCode code = static_cast<UScriptCode>(script); |
109 (*setter)(settings, it->second, GetScriptForWebSettings(code)); | 110 (*setter)(settings, it->second, GetScriptForWebSettings(code)); |
110 } | 111 } |
111 } | 112 } |
112 } | 113 } |
113 | 114 |
114 } // namespace | 115 } // namespace |
115 | 116 |
116 void ApplyWebPreferences(const WebPreferences& prefs, WebView* web_view) { | 117 void ApplyWebPreferences(const WebPreferences& prefs, WebView* web_view) { |
| 118 TRACE_EVENT0("renderer", "ApplyWebPreferences"); |
117 WebSettings* settings = web_view->settings(); | 119 WebSettings* settings = web_view->settings(); |
118 ApplyFontsFromMap(prefs.standard_font_family_map, | 120 ApplyFontsFromMap(prefs.standard_font_family_map, |
119 setStandardFontFamilyWrapper, settings); | 121 setStandardFontFamilyWrapper, settings); |
120 ApplyFontsFromMap(prefs.fixed_font_family_map, | 122 ApplyFontsFromMap(prefs.fixed_font_family_map, |
121 setFixedFontFamilyWrapper, settings); | 123 setFixedFontFamilyWrapper, settings); |
122 ApplyFontsFromMap(prefs.serif_font_family_map, | 124 ApplyFontsFromMap(prefs.serif_font_family_map, |
123 setSerifFontFamilyWrapper, settings); | 125 setSerifFontFamilyWrapper, settings); |
124 ApplyFontsFromMap(prefs.sans_serif_font_family_map, | 126 ApplyFontsFromMap(prefs.sans_serif_font_family_map, |
125 setSansSerifFontFamilyWrapper, settings); | 127 setSansSerifFontFamilyWrapper, settings); |
126 ApplyFontsFromMap(prefs.cursive_font_family_map, | 128 ApplyFontsFromMap(prefs.cursive_font_family_map, |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 settings->setPinchVirtualViewportEnabled( | 333 settings->setPinchVirtualViewportEnabled( |
332 prefs.pinch_virtual_viewport_enabled); | 334 prefs.pinch_virtual_viewport_enabled); |
333 | 335 |
334 settings->setPinchOverlayScrollbarThickness( | 336 settings->setPinchOverlayScrollbarThickness( |
335 prefs.pinch_overlay_scrollbar_thickness); | 337 prefs.pinch_overlay_scrollbar_thickness); |
336 settings->setUseSolidColorScrollbars(prefs.use_solid_color_scrollbars); | 338 settings->setUseSolidColorScrollbars(prefs.use_solid_color_scrollbars); |
337 settings->setCompositorTouchHitTesting(prefs.compositor_touch_hit_testing); | 339 settings->setCompositorTouchHitTesting(prefs.compositor_touch_hit_testing); |
338 } | 340 } |
339 | 341 |
340 } // namespace content | 342 } // namespace content |
OLD | NEW |