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

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 357203003: Move webpreferences.* from webkit/ to content/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: RenderView::FromWebView Created 6 years, 5 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 | Annotate | Revision Log
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 "content/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 #include "content/public/common/content_constants.h" 55 #include "content/public/common/content_constants.h"
56 #include "content/public/common/content_switches.h" 56 #include "content/public/common/content_switches.h"
57 #include "content/public/common/drop_data.h" 57 #include "content/public/common/drop_data.h"
58 #include "content/public/common/favicon_url.h" 58 #include "content/public/common/favicon_url.h"
59 #include "content/public/common/file_chooser_params.h" 59 #include "content/public/common/file_chooser_params.h"
60 #include "content/public/common/page_zoom.h" 60 #include "content/public/common/page_zoom.h"
61 #include "content/public/common/ssl_status.h" 61 #include "content/public/common/ssl_status.h"
62 #include "content/public/common/three_d_api_types.h" 62 #include "content/public/common/three_d_api_types.h"
63 #include "content/public/common/url_constants.h" 63 #include "content/public/common/url_constants.h"
64 #include "content/public/common/url_utils.h" 64 #include "content/public/common/url_utils.h"
65 #include "content/public/common/web_preferences.h"
65 #include "content/public/renderer/content_renderer_client.h" 66 #include "content/public/renderer/content_renderer_client.h"
66 #include "content/public/renderer/document_state.h" 67 #include "content/public/renderer/document_state.h"
67 #include "content/public/renderer/navigation_state.h" 68 #include "content/public/renderer/navigation_state.h"
68 #include "content/public/renderer/render_view_observer.h" 69 #include "content/public/renderer/render_view_observer.h"
69 #include "content/public/renderer/render_view_visitor.h" 70 #include "content/public/renderer/render_view_visitor.h"
70 #include "content/public/renderer/web_preferences.h"
71 #include "content/renderer/accessibility/renderer_accessibility.h" 71 #include "content/renderer/accessibility/renderer_accessibility.h"
72 #include "content/renderer/accessibility/renderer_accessibility_complete.h" 72 #include "content/renderer/accessibility/renderer_accessibility_complete.h"
73 #include "content/renderer/accessibility/renderer_accessibility_focus_only.h" 73 #include "content/renderer/accessibility/renderer_accessibility_focus_only.h"
74 #include "content/renderer/browser_plugin/browser_plugin.h" 74 #include "content/renderer/browser_plugin/browser_plugin.h"
75 #include "content/renderer/browser_plugin/browser_plugin_manager.h" 75 #include "content/renderer/browser_plugin/browser_plugin_manager.h"
76 #include "content/renderer/browser_plugin/browser_plugin_manager_impl.h" 76 #include "content/renderer/browser_plugin/browser_plugin_manager_impl.h"
77 #include "content/renderer/devtools/devtools_agent.h" 77 #include "content/renderer/devtools/devtools_agent.h"
78 #include "content/renderer/disambiguation_popup_helper.h" 78 #include "content/renderer/disambiguation_popup_helper.h"
79 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" 79 #include "content/renderer/dom_storage/webstoragenamespace_impl.h"
80 #include "content/renderer/drop_data_builder.h" 80 #include "content/renderer/drop_data_builder.h"
81 #include "content/renderer/external_popup_menu.h" 81 #include "content/renderer/external_popup_menu.h"
82 #include "content/renderer/gpu/render_widget_compositor.h" 82 #include "content/renderer/gpu/render_widget_compositor.h"
83 #include "content/renderer/history_controller.h" 83 #include "content/renderer/history_controller.h"
84 #include "content/renderer/history_serialization.h" 84 #include "content/renderer/history_serialization.h"
85 #include "content/renderer/idle_user_detector.h" 85 #include "content/renderer/idle_user_detector.h"
86 #include "content/renderer/ime_event_guard.h" 86 #include "content/renderer/ime_event_guard.h"
87 #include "content/renderer/input/input_handler_manager.h" 87 #include "content/renderer/input/input_handler_manager.h"
88 #include "content/renderer/internal_document_state_data.h" 88 #include "content/renderer/internal_document_state_data.h"
89 #include "content/renderer/media/audio_device_factory.h" 89 #include "content/renderer/media/audio_device_factory.h"
90 #include "content/renderer/media/media_stream_dispatcher.h" 90 #include "content/renderer/media/media_stream_dispatcher.h"
91 #include "content/renderer/media/video_capture_impl_manager.h" 91 #include "content/renderer/media/video_capture_impl_manager.h"
92 #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h" 92 #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h"
93 #include "content/renderer/memory_benchmarking_extension.h" 93 #include "content/renderer/memory_benchmarking_extension.h"
94 #include "content/renderer/mhtml_generator.h" 94 #include "content/renderer/mhtml_generator.h"
95 #include "content/renderer/net_info_helper.h"
95 #include "content/renderer/render_frame_impl.h" 96 #include "content/renderer/render_frame_impl.h"
96 #include "content/renderer/render_frame_proxy.h" 97 #include "content/renderer/render_frame_proxy.h"
97 #include "content/renderer/render_process.h" 98 #include "content/renderer/render_process.h"
98 #include "content/renderer/render_thread_impl.h" 99 #include "content/renderer/render_thread_impl.h"
99 #include "content/renderer/render_view_impl_params.h" 100 #include "content/renderer/render_view_impl_params.h"
100 #include "content/renderer/render_view_mouse_lock_dispatcher.h" 101 #include "content/renderer/render_view_mouse_lock_dispatcher.h"
101 #include "content/renderer/render_widget_fullscreen_pepper.h" 102 #include "content/renderer/render_widget_fullscreen_pepper.h"
102 #include "content/renderer/renderer_webapplicationcachehost_impl.h" 103 #include "content/renderer/renderer_webapplicationcachehost_impl.h"
103 #include "content/renderer/resizing_mode_selector.h" 104 #include "content/renderer/resizing_mode_selector.h"
104 #include "content/renderer/savable_resources.h" 105 #include "content/renderer/savable_resources.h"
(...skipping 11 matching lines...) Expand all
116 #include "media/base/filter_collection.h" 117 #include "media/base/filter_collection.h"
117 #include "media/base/media_switches.h" 118 #include "media/base/media_switches.h"
118 #include "media/filters/audio_renderer_impl.h" 119 #include "media/filters/audio_renderer_impl.h"
119 #include "media/filters/gpu_video_accelerator_factories.h" 120 #include "media/filters/gpu_video_accelerator_factories.h"
120 #include "net/base/data_url.h" 121 #include "net/base/data_url.h"
121 #include "net/base/escape.h" 122 #include "net/base/escape.h"
122 #include "net/base/net_errors.h" 123 #include "net/base/net_errors.h"
123 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 124 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
124 #include "net/http/http_util.h" 125 #include "net/http/http_util.h"
125 #include "third_party/WebKit/public/platform/WebCString.h" 126 #include "third_party/WebKit/public/platform/WebCString.h"
127 #include "third_party/WebKit/public/platform/WebConnectionType.h"
126 #include "third_party/WebKit/public/platform/WebDragData.h" 128 #include "third_party/WebKit/public/platform/WebDragData.h"
127 #include "third_party/WebKit/public/platform/WebHTTPBody.h" 129 #include "third_party/WebKit/public/platform/WebHTTPBody.h"
128 #include "third_party/WebKit/public/platform/WebImage.h" 130 #include "third_party/WebKit/public/platform/WebImage.h"
129 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h" 131 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h"
130 #include "third_party/WebKit/public/platform/WebPoint.h" 132 #include "third_party/WebKit/public/platform/WebPoint.h"
131 #include "third_party/WebKit/public/platform/WebRect.h" 133 #include "third_party/WebKit/public/platform/WebRect.h"
132 #include "third_party/WebKit/public/platform/WebSize.h" 134 #include "third_party/WebKit/public/platform/WebSize.h"
133 #include "third_party/WebKit/public/platform/WebSocketStreamHandle.h" 135 #include "third_party/WebKit/public/platform/WebSocketStreamHandle.h"
134 #include "third_party/WebKit/public/platform/WebStorageQuotaCallbacks.h" 136 #include "third_party/WebKit/public/platform/WebStorageQuotaCallbacks.h"
135 #include "third_party/WebKit/public/platform/WebString.h" 137 #include "third_party/WebKit/public/platform/WebString.h"
(...skipping 18 matching lines...) Expand all
154 #include "third_party/WebKit/public/web/WebFormControlElement.h" 156 #include "third_party/WebKit/public/web/WebFormControlElement.h"
155 #include "third_party/WebKit/public/web/WebFormElement.h" 157 #include "third_party/WebKit/public/web/WebFormElement.h"
156 #include "third_party/WebKit/public/web/WebFrame.h" 158 #include "third_party/WebKit/public/web/WebFrame.h"
157 #include "third_party/WebKit/public/web/WebGlyphCache.h" 159 #include "third_party/WebKit/public/web/WebGlyphCache.h"
158 #include "third_party/WebKit/public/web/WebHistoryItem.h" 160 #include "third_party/WebKit/public/web/WebHistoryItem.h"
159 #include "third_party/WebKit/public/web/WebInputElement.h" 161 #include "third_party/WebKit/public/web/WebInputElement.h"
160 #include "third_party/WebKit/public/web/WebInputEvent.h" 162 #include "third_party/WebKit/public/web/WebInputEvent.h"
161 #include "third_party/WebKit/public/web/WebLocalFrame.h" 163 #include "third_party/WebKit/public/web/WebLocalFrame.h"
162 #include "third_party/WebKit/public/web/WebMediaPlayerAction.h" 164 #include "third_party/WebKit/public/web/WebMediaPlayerAction.h"
163 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" 165 #include "third_party/WebKit/public/web/WebNavigationPolicy.h"
166 #include "third_party/WebKit/public/web/WebNetworkStateNotifier.h"
164 #include "third_party/WebKit/public/web/WebNodeList.h" 167 #include "third_party/WebKit/public/web/WebNodeList.h"
165 #include "third_party/WebKit/public/web/WebPageSerializer.h" 168 #include "third_party/WebKit/public/web/WebPageSerializer.h"
166 #include "third_party/WebKit/public/web/WebPlugin.h" 169 #include "third_party/WebKit/public/web/WebPlugin.h"
167 #include "third_party/WebKit/public/web/WebPluginAction.h" 170 #include "third_party/WebKit/public/web/WebPluginAction.h"
168 #include "third_party/WebKit/public/web/WebPluginContainer.h" 171 #include "third_party/WebKit/public/web/WebPluginContainer.h"
169 #include "third_party/WebKit/public/web/WebPluginDocument.h" 172 #include "third_party/WebKit/public/web/WebPluginDocument.h"
170 #include "third_party/WebKit/public/web/WebRange.h" 173 #include "third_party/WebKit/public/web/WebRange.h"
174 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
171 #include "third_party/WebKit/public/web/WebScriptSource.h" 175 #include "third_party/WebKit/public/web/WebScriptSource.h"
172 #include "third_party/WebKit/public/web/WebSearchableFormData.h" 176 #include "third_party/WebKit/public/web/WebSearchableFormData.h"
173 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" 177 #include "third_party/WebKit/public/web/WebSecurityOrigin.h"
174 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" 178 #include "third_party/WebKit/public/web/WebSecurityPolicy.h"
175 #include "third_party/WebKit/public/web/WebSerializedScriptValue.h" 179 #include "third_party/WebKit/public/web/WebSerializedScriptValue.h"
176 #include "third_party/WebKit/public/web/WebSettings.h" 180 #include "third_party/WebKit/public/web/WebSettings.h"
177 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" 181 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h"
178 #include "third_party/WebKit/public/web/WebView.h" 182 #include "third_party/WebKit/public/web/WebView.h"
179 #include "third_party/WebKit/public/web/WebWindowFeatures.h" 183 #include "third_party/WebKit/public/web/WebWindowFeatures.h"
180 #include "third_party/WebKit/public/web/default/WebRenderTheme.h" 184 #include "third_party/WebKit/public/web/default/WebRenderTheme.h"
185 #include "third_party/icu/source/common/unicode/uchar.h"
186 #include "third_party/icu/source/common/unicode/uscript.h"
181 #include "ui/base/clipboard/clipboard.h" 187 #include "ui/base/clipboard/clipboard.h"
182 #include "ui/base/ui_base_switches_util.h" 188 #include "ui/base/ui_base_switches_util.h"
183 #include "ui/events/latency_info.h" 189 #include "ui/events/latency_info.h"
184 #include "ui/gfx/native_widget_types.h" 190 #include "ui/gfx/native_widget_types.h"
185 #include "ui/gfx/point.h" 191 #include "ui/gfx/point.h"
186 #include "ui/gfx/rect.h" 192 #include "ui/gfx/rect.h"
187 #include "ui/gfx/rect_conversions.h" 193 #include "ui/gfx/rect_conversions.h"
188 #include "ui/gfx/size_conversions.h" 194 #include "ui/gfx/size_conversions.h"
189 #include "ui/shell_dialogs/selected_file_info.h" 195 #include "ui/shell_dialogs/selected_file_info.h"
190 #include "v8/include/v8.h" 196 #include "v8/include/v8.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 using blink::WebTouchEvent; 298 using blink::WebTouchEvent;
293 using blink::WebURL; 299 using blink::WebURL;
294 using blink::WebURLError; 300 using blink::WebURLError;
295 using blink::WebURLRequest; 301 using blink::WebURLRequest;
296 using blink::WebURLResponse; 302 using blink::WebURLResponse;
297 using blink::WebUserGestureIndicator; 303 using blink::WebUserGestureIndicator;
298 using blink::WebVector; 304 using blink::WebVector;
299 using blink::WebView; 305 using blink::WebView;
300 using blink::WebWidget; 306 using blink::WebWidget;
301 using blink::WebWindowFeatures; 307 using blink::WebWindowFeatures;
308 using blink::WebNetworkStateNotifier;
309 using blink::WebRuntimeFeatures;
302 using base::Time; 310 using base::Time;
303 using base::TimeDelta; 311 using base::TimeDelta;
304 using webkit_glue::WebURLResponseExtraDataImpl; 312 using webkit_glue::WebURLResponseExtraDataImpl;
305 313
306 #if defined(OS_ANDROID) 314 #if defined(OS_ANDROID)
307 using blink::WebContentDetectionResult; 315 using blink::WebContentDetectionResult;
308 using blink::WebFloatPoint; 316 using blink::WebFloatPoint;
309 using blink::WebFloatRect; 317 using blink::WebFloatRect;
310 using blink::WebHitTestResult; 318 using blink::WebHitTestResult;
311 #endif 319 #endif
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 item_list.push_back(item); 609 item_list.push_back(item);
602 } 610 }
603 611
604 WebDragData result; 612 WebDragData result;
605 result.initialize(); 613 result.initialize();
606 result.setItems(item_list); 614 result.setItems(item_list);
607 result.setFilesystemId(drop_data.filesystem_id); 615 result.setFilesystemId(drop_data.filesystem_id);
608 return result; 616 return result;
609 } 617 }
610 618
619 typedef void (*SetFontFamilyWrapper)(blink::WebSettings*,
620 const base::string16&,
621 UScriptCode);
622
623 void SetStandardFontFamilyWrapper(WebSettings* settings,
624 const base::string16& font,
625 UScriptCode script) {
626 settings->setStandardFontFamily(font, script);
627 }
628
629 void SetFixedFontFamilyWrapper(WebSettings* settings,
630 const base::string16& font,
631 UScriptCode script) {
632 settings->setFixedFontFamily(font, script);
633 }
634
635 void SetSerifFontFamilyWrapper(WebSettings* settings,
636 const base::string16& font,
637 UScriptCode script) {
638 settings->setSerifFontFamily(font, script);
639 }
640
641 void SetSansSerifFontFamilyWrapper(WebSettings* settings,
642 const base::string16& font,
643 UScriptCode script) {
644 settings->setSansSerifFontFamily(font, script);
645 }
646
647 void SetCursiveFontFamilyWrapper(WebSettings* settings,
648 const base::string16& font,
649 UScriptCode script) {
650 settings->setCursiveFontFamily(font, script);
651 }
652
653 void SetFantasyFontFamilyWrapper(WebSettings* settings,
654 const base::string16& font,
655 UScriptCode script) {
656 settings->setFantasyFontFamily(font, script);
657 }
658
659 void SetPictographFontFamilyWrapper(WebSettings* settings,
660 const base::string16& font,
661 UScriptCode script) {
662 settings->setPictographFontFamily(font, script);
663 }
664
665 // If |scriptCode| is a member of a family of "similar" script codes, returns
666 // the script code in that family that is used by WebKit for font selection
667 // purposes. For example, USCRIPT_KATAKANA_OR_HIRAGANA and USCRIPT_JAPANESE are
668 // considered equivalent for the purposes of font selection. WebKit uses the
669 // script code USCRIPT_KATAKANA_OR_HIRAGANA. So, if |scriptCode| is
670 // USCRIPT_JAPANESE, the function returns USCRIPT_KATAKANA_OR_HIRAGANA. WebKit
671 // uses different scripts than the ones in Chrome pref names because the version
672 // of ICU included on certain ports does not have some of the newer scripts. If
673 // |scriptCode| is not a member of such a family, returns |scriptCode|.
674 UScriptCode GetScriptForWebSettings(UScriptCode scriptCode) {
675 switch (scriptCode) {
676 case USCRIPT_HIRAGANA:
677 case USCRIPT_KATAKANA:
678 case USCRIPT_JAPANESE:
679 return USCRIPT_KATAKANA_OR_HIRAGANA;
680 case USCRIPT_KOREAN:
681 return USCRIPT_HANGUL;
682 default:
683 return scriptCode;
684 }
685 }
686
687 void ApplyFontsFromMap(const ScriptFontFamilyMap& map,
688 SetFontFamilyWrapper setter,
689 WebSettings* settings) {
690 for (ScriptFontFamilyMap::const_iterator it = map.begin(); it != map.end();
691 ++it) {
692 int32 script = u_getPropertyValueEnum(UCHAR_SCRIPT, (it->first).c_str());
693 if (script >= 0 && script < USCRIPT_CODE_LIMIT) {
694 UScriptCode code = static_cast<UScriptCode>(script);
695 (*setter)(settings, it->second, GetScriptForWebSettings(code));
696 }
697 }
698 }
699
611 } // namespace 700 } // namespace
612 701
613 RenderViewImpl::RenderViewImpl(RenderViewImplParams* params) 702 RenderViewImpl::RenderViewImpl(RenderViewImplParams* params)
614 : RenderWidget(blink::WebPopupTypeNone, 703 : RenderWidget(blink::WebPopupTypeNone,
615 params->screen_info, 704 params->screen_info,
616 params->swapped_out, 705 params->swapped_out,
617 params->hidden, 706 params->hidden,
618 params->never_visible), 707 params->never_visible),
619 webkit_preferences_(params->webkit_prefs), 708 webkit_preferences_(params->webkit_prefs),
620 send_content_state_immediately_(false), 709 send_content_state_immediately_(false),
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 ShouldUseAcceleratedCompositingForOverflowScroll(device_scale_factor_)); 819 ShouldUseAcceleratedCompositingForOverflowScroll(device_scale_factor_));
731 webview()->settings()->setAcceleratedCompositingForTransitionEnabled( 820 webview()->settings()->setAcceleratedCompositingForTransitionEnabled(
732 ShouldUseTransitionCompositing(device_scale_factor_)); 821 ShouldUseTransitionCompositing(device_scale_factor_));
733 webview()->settings()->setAcceleratedCompositingForFixedRootBackgroundEnabled( 822 webview()->settings()->setAcceleratedCompositingForFixedRootBackgroundEnabled(
734 ShouldUseAcceleratedFixedRootBackground(device_scale_factor_)); 823 ShouldUseAcceleratedFixedRootBackground(device_scale_factor_));
735 webview()->settings()->setCompositedScrollingForFramesEnabled( 824 webview()->settings()->setCompositedScrollingForFramesEnabled(
736 ShouldUseCompositedScrollingForFrames(device_scale_factor_)); 825 ShouldUseCompositedScrollingForFrames(device_scale_factor_));
737 webview()->settings()->setUseExpandedHeuristicsForGpuRasterization( 826 webview()->settings()->setUseExpandedHeuristicsForGpuRasterization(
738 ShouldUseExpandedHeuristicsForGpuRasterization()); 827 ShouldUseExpandedHeuristicsForGpuRasterization());
739 828
740 ApplyWebPreferences(webkit_preferences_, webview()); 829 ApplyWebPreferences(webkit_preferences_);
741 830
742 webview()->settings()->setAllowConnectingInsecureWebSocket( 831 webview()->settings()->setAllowConnectingInsecureWebSocket(
743 command_line.HasSwitch(switches::kAllowInsecureWebSocketFromHttpsOrigin)); 832 command_line.HasSwitch(switches::kAllowInsecureWebSocketFromHttpsOrigin));
744 833
745 webview()->setMainFrame(main_render_frame_->GetWebFrame()); 834 webview()->setMainFrame(main_render_frame_->GetWebFrame());
746 main_render_frame_->Initialize(); 835 main_render_frame_->Initialize();
747 836
748 if (switches::IsTouchDragDropEnabled()) 837 if (switches::IsTouchDragDropEnabled())
749 webview()->settings()->setTouchDragDropEnabled(true); 838 webview()->settings()->setTouchDragDropEnabled(true);
750 839
(...skipping 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after
2271 } 2360 }
2272 2361
2273 WebPreferences& RenderViewImpl::GetWebkitPreferences() { 2362 WebPreferences& RenderViewImpl::GetWebkitPreferences() {
2274 return webkit_preferences_; 2363 return webkit_preferences_;
2275 } 2364 }
2276 2365
2277 void RenderViewImpl::SetWebkitPreferences(const WebPreferences& preferences) { 2366 void RenderViewImpl::SetWebkitPreferences(const WebPreferences& preferences) {
2278 OnUpdateWebPreferences(preferences); 2367 OnUpdateWebPreferences(preferences);
2279 } 2368 }
2280 2369
2370 void RenderViewImpl::ApplyWebPreferences(const WebPreferences& prefs) {
2371 WebSettings* settings = webview()->settings();
2372 ApplyFontsFromMap(prefs.standard_font_family_map,
2373 SetStandardFontFamilyWrapper, settings);
2374 ApplyFontsFromMap(prefs.fixed_font_family_map,
2375 SetFixedFontFamilyWrapper, settings);
2376 ApplyFontsFromMap(prefs.serif_font_family_map,
2377 SetSerifFontFamilyWrapper, settings);
2378 ApplyFontsFromMap(prefs.sans_serif_font_family_map,
2379 SetSansSerifFontFamilyWrapper, settings);
2380 ApplyFontsFromMap(prefs.cursive_font_family_map,
2381 SetCursiveFontFamilyWrapper, settings);
2382 ApplyFontsFromMap(prefs.fantasy_font_family_map,
2383 SetFantasyFontFamilyWrapper, settings);
2384 ApplyFontsFromMap(prefs.pictograph_font_family_map,
2385 SetPictographFontFamilyWrapper, settings);
2386 settings->setDefaultFontSize(prefs.default_font_size);
2387 settings->setDefaultFixedFontSize(prefs.default_fixed_font_size);
2388 settings->setMinimumFontSize(prefs.minimum_font_size);
2389 settings->setMinimumLogicalFontSize(prefs.minimum_logical_font_size);
2390 settings->setDefaultTextEncodingName(
2391 base::ASCIIToUTF16(prefs.default_encoding));
2392 settings->setJavaScriptEnabled(prefs.javascript_enabled);
2393 settings->setWebSecurityEnabled(prefs.web_security_enabled);
2394 settings->setJavaScriptCanOpenWindowsAutomatically(
2395 prefs.javascript_can_open_windows_automatically);
2396 settings->setLoadsImagesAutomatically(prefs.loads_images_automatically);
2397 settings->setImagesEnabled(prefs.images_enabled);
2398 settings->setPluginsEnabled(prefs.plugins_enabled);
2399 settings->setDOMPasteAllowed(prefs.dom_paste_enabled);
2400 settings->setNeedsSiteSpecificQuirks(prefs.site_specific_quirks_enabled);
2401 settings->setShrinksStandaloneImagesToFit(
2402 prefs.shrinks_standalone_images_to_fit);
2403 settings->setUsesEncodingDetector(prefs.uses_universal_detector);
2404 settings->setTextAreasAreResizable(prefs.text_areas_are_resizable);
2405 settings->setAllowScriptsToCloseWindows(prefs.allow_scripts_to_close_windows);
2406 settings->setDownloadableBinaryFontsEnabled(prefs.remote_fonts_enabled);
2407 settings->setJavaScriptCanAccessClipboard(
2408 prefs.javascript_can_access_clipboard);
2409 WebRuntimeFeatures::enableXSLT(prefs.xslt_enabled);
2410 settings->setXSSAuditorEnabled(prefs.xss_auditor_enabled);
2411 settings->setDNSPrefetchingEnabled(prefs.dns_prefetching_enabled);
2412 settings->setLocalStorageEnabled(prefs.local_storage_enabled);
2413 settings->setSyncXHRInDocumentsEnabled(prefs.sync_xhr_in_documents_enabled);
2414 WebRuntimeFeatures::enableDatabase(prefs.databases_enabled);
2415 settings->setOfflineWebApplicationCacheEnabled(
2416 prefs.application_cache_enabled);
2417 settings->setCaretBrowsingEnabled(prefs.caret_browsing_enabled);
2418 settings->setHyperlinkAuditingEnabled(prefs.hyperlink_auditing_enabled);
2419 settings->setCookieEnabled(prefs.cookie_enabled);
2420 settings->setNavigateOnDragDrop(prefs.navigate_on_drag_drop);
2421
2422 settings->setJavaEnabled(prefs.java_enabled);
2423
2424 // By default, allow_universal_access_from_file_urls is set to false and thus
2425 // we mitigate attacks from local HTML files by not granting file:// URLs
2426 // universal access. Only test shell will enable this.
2427 settings->setAllowUniversalAccessFromFileURLs(
2428 prefs.allow_universal_access_from_file_urls);
2429 settings->setAllowFileAccessFromFileURLs(
2430 prefs.allow_file_access_from_file_urls);
2431
2432 // Enable the web audio API if requested on the command line.
2433 settings->setWebAudioEnabled(prefs.webaudio_enabled);
2434
2435 // Enable experimental WebGL support if requested on command line
2436 // and support is compiled in.
2437 settings->setExperimentalWebGLEnabled(prefs.experimental_webgl_enabled);
2438
2439 // Disable GL multisampling if requested on command line.
2440 settings->setOpenGLMultisamplingEnabled(prefs.gl_multisampling_enabled);
2441
2442 // Enable WebGL errors to the JS console if requested.
2443 settings->setWebGLErrorsToConsoleEnabled(
2444 prefs.webgl_errors_to_console_enabled);
2445
2446 // Uses the mock theme engine for scrollbars.
2447 settings->setMockScrollbarsEnabled(prefs.mock_scrollbars_enabled);
2448
2449 settings->setLayerSquashingEnabled(prefs.layer_squashing_enabled);
2450
2451 // Enable gpu-accelerated compositing always.
2452 settings->setAcceleratedCompositingEnabled(true);
2453
2454 // Enable gpu-accelerated 2d canvas if requested on the command line.
2455 settings->setAccelerated2dCanvasEnabled(prefs.accelerated_2d_canvas_enabled);
2456
2457 settings->setMinimumAccelerated2dCanvasSize(
2458 prefs.minimum_accelerated_2d_canvas_size);
2459
2460 // Disable antialiasing for 2d canvas if requested on the command line.
2461 settings->setAntialiased2dCanvasEnabled(
2462 !prefs.antialiased_2d_canvas_disabled);
2463
2464 // Set MSAA sample count for 2d canvas if requested on the command line (or
2465 // default value if not).
2466 settings->setAccelerated2dCanvasMSAASampleCount(
2467 prefs.accelerated_2d_canvas_msaa_sample_count);
2468
2469 // Enable deferred filter rendering if requested on the command line.
2470 settings->setDeferredFiltersEnabled(prefs.deferred_filters_enabled);
2471
2472 // Enable container culling if requested on the command line.
2473 settings->setContainerCullingEnabled(prefs.container_culling_enabled);
2474
2475 // Enable gesture tap highlight if requested on the command line.
2476 settings->setGestureTapHighlightEnabled(prefs.gesture_tap_highlight_enabled);
2477
2478 // Enabling accelerated layers from the command line enabled accelerated
2479 // Video.
2480 settings->setAcceleratedCompositingForVideoEnabled(
2481 prefs.accelerated_compositing_for_video_enabled);
2482
2483 // WebGL and accelerated 2D canvas are always gpu composited.
2484 settings->setAcceleratedCompositingForCanvasEnabled(
2485 prefs.experimental_webgl_enabled || prefs.accelerated_2d_canvas_enabled);
2486
2487 settings->setAsynchronousSpellCheckingEnabled(
2488 prefs.asynchronous_spell_checking_enabled);
2489 settings->setUnifiedTextCheckerEnabled(prefs.unified_textchecker_enabled);
2490
2491 for (WebInspectorPreferences::const_iterator it =
2492 prefs.inspector_settings.begin();
2493 it != prefs.inspector_settings.end();
2494 ++it) {
2495 webview()->setInspectorSetting(WebString::fromUTF8(it->first),
2496 WebString::fromUTF8(it->second));
2497 }
2498
2499 // Tabs to link is not part of the settings. WebCore calls
2500 // ChromeClient::tabsToLinks which is part of the glue code.
2501 webview()->setTabsToLinks(prefs.tabs_to_links);
2502
2503 settings->setAllowDisplayOfInsecureContent(
2504 prefs.allow_displaying_insecure_content);
2505 settings->setAllowRunningOfInsecureContent(
2506 prefs.allow_running_insecure_content);
2507 settings->setPasswordEchoEnabled(prefs.password_echo_enabled);
2508 settings->setShouldPrintBackgrounds(prefs.should_print_backgrounds);
2509 settings->setShouldClearDocumentBackground(
2510 prefs.should_clear_document_background);
2511 settings->setEnableScrollAnimator(prefs.enable_scroll_animator);
2512
2513 settings->setRegionBasedColumnsEnabled(prefs.region_based_columns_enabled);
2514
2515 WebRuntimeFeatures::enableTouch(prefs.touch_enabled);
2516 settings->setMaxTouchPoints(prefs.pointer_events_max_touch_points);
2517 settings->setDeviceSupportsTouch(prefs.device_supports_touch);
2518 settings->setDeviceSupportsMouse(prefs.device_supports_mouse);
2519 settings->setEnableTouchAdjustment(prefs.touch_adjustment_enabled);
2520
2521 settings->setDeferredImageDecodingEnabled(
2522 prefs.deferred_image_decoding_enabled);
2523 settings->setShouldRespectImageOrientation(
2524 prefs.should_respect_image_orientation);
2525
2526 settings->setUnsafePluginPastingEnabled(false);
2527 settings->setEditingBehavior(
2528 static_cast<WebSettings::EditingBehavior>(prefs.editing_behavior));
2529
2530 settings->setSupportsMultipleWindows(prefs.supports_multiple_windows);
2531
2532 settings->setViewportEnabled(prefs.viewport_enabled);
2533 settings->setLoadWithOverviewMode(prefs.initialize_at_minimum_page_scale);
2534 settings->setViewportMetaEnabled(prefs.viewport_meta_enabled);
2535 settings->setMainFrameResizesAreOrientationChanges(
2536 prefs.main_frame_resizes_are_orientation_changes);
2537
2538 settings->setSmartInsertDeleteEnabled(prefs.smart_insert_delete_enabled);
2539
2540 settings->setSpatialNavigationEnabled(prefs.spatial_navigation_enabled);
2541
2542 settings->setSelectionIncludesAltImageText(true);
2543
2544 #if defined(OS_ANDROID)
2545 settings->setAllowCustomScrollbarInMainFrame(false);
2546 settings->setTextAutosizingEnabled(prefs.text_autosizing_enabled);
2547 settings->setAccessibilityFontScaleFactor(prefs.font_scale_factor);
2548 settings->setDeviceScaleAdjustment(prefs.device_scale_adjustment);
2549 webview()->setIgnoreViewportTagScaleLimits(prefs.force_enable_zoom);
2550 settings->setAutoZoomFocusedNodeToLegibleScale(true);
2551 settings->setDoubleTapToZoomEnabled(prefs.double_tap_to_zoom_enabled);
2552 settings->setMediaControlsOverlayPlayButtonEnabled(true);
2553 settings->setMediaPlaybackRequiresUserGesture(
2554 prefs.user_gesture_required_for_media_playback);
2555 settings->setDefaultVideoPosterURL(
2556 base::ASCIIToUTF16(prefs.default_video_poster_url.spec()));
2557 settings->setSupportDeprecatedTargetDensityDPI(
2558 prefs.support_deprecated_target_density_dpi);
2559 settings->setUseLegacyBackgroundSizeShorthandBehavior(
2560 prefs.use_legacy_background_size_shorthand_behavior);
2561 settings->setWideViewportQuirkEnabled(prefs.wide_viewport_quirk);
2562 settings->setUseWideViewport(prefs.use_wide_viewport);
2563 settings->setViewportMetaLayoutSizeQuirk(
2564 prefs.viewport_meta_layout_size_quirk);
2565 settings->setViewportMetaMergeContentQuirk(
2566 prefs.viewport_meta_merge_content_quirk);
2567 settings->setViewportMetaNonUserScalableQuirk(
2568 prefs.viewport_meta_non_user_scalable_quirk);
2569 settings->setViewportMetaZeroValuesQuirk(
2570 prefs.viewport_meta_zero_values_quirk);
2571 settings->setClobberUserAgentInitialScaleQuirk(
2572 prefs.clobber_user_agent_initial_scale_quirk);
2573 settings->setIgnoreMainFrameOverflowHiddenQuirk(
2574 prefs.ignore_main_frame_overflow_hidden_quirk);
2575 settings->setReportScreenSizeInPhysicalPixelsQuirk(
2576 prefs.report_screen_size_in_physical_pixels_quirk);
2577 settings->setMainFrameClipsContent(false);
2578 settings->setShrinksStandaloneImagesToFit(false);
2579 settings->setShrinksViewportContentToFit(true);
2580 #endif
2581
2582 WebNetworkStateNotifier::setOnLine(prefs.is_online);
2583 WebNetworkStateNotifier::setWebConnectionType(
2584 NetConnectionTypeToWebConnectionType(prefs.connection_type));
2585 settings->setPinchVirtualViewportEnabled(
2586 prefs.pinch_virtual_viewport_enabled);
2587
2588 settings->setPinchOverlayScrollbarThickness(
2589 prefs.pinch_overlay_scrollbar_thickness);
2590 settings->setUseSolidColorScrollbars(prefs.use_solid_color_scrollbars);
2591 settings->setCompositorTouchHitTesting(prefs.compositor_touch_hit_testing);
2592 }
2593
2281 blink::WebView* RenderViewImpl::GetWebView() { 2594 blink::WebView* RenderViewImpl::GetWebView() {
2282 return webview(); 2595 return webview();
2283 } 2596 }
2284 2597
2285 blink::WebElement RenderViewImpl::GetFocusedElement() const { 2598 blink::WebElement RenderViewImpl::GetFocusedElement() const {
2286 if (!webview()) 2599 if (!webview())
2287 return WebElement(); 2600 return WebElement();
2288 WebFrame* focused_frame = webview()->focusedFrame(); 2601 WebFrame* focused_frame = webview()->focusedFrame();
2289 if (focused_frame) { 2602 if (focused_frame) {
2290 WebDocument doc = focused_frame->document(); 2603 WebDocument doc = focused_frame->document();
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
2734 WebDragOperation op) { 3047 WebDragOperation op) {
2735 webview()->dragSourceEndedAt(client_point, screen_point, op); 3048 webview()->dragSourceEndedAt(client_point, screen_point, op);
2736 } 3049 }
2737 3050
2738 void RenderViewImpl::OnDragSourceSystemDragEnded() { 3051 void RenderViewImpl::OnDragSourceSystemDragEnded() {
2739 webview()->dragSourceSystemDragEnded(); 3052 webview()->dragSourceSystemDragEnded();
2740 } 3053 }
2741 3054
2742 void RenderViewImpl::OnUpdateWebPreferences(const WebPreferences& prefs) { 3055 void RenderViewImpl::OnUpdateWebPreferences(const WebPreferences& prefs) {
2743 webkit_preferences_ = prefs; 3056 webkit_preferences_ = prefs;
2744 ApplyWebPreferences(webkit_preferences_, webview()); 3057 ApplyWebPreferences(webkit_preferences_);
2745 } 3058 }
2746 3059
2747 void RenderViewImpl::OnEnumerateDirectoryResponse( 3060 void RenderViewImpl::OnEnumerateDirectoryResponse(
2748 int id, 3061 int id,
2749 const std::vector<base::FilePath>& paths) { 3062 const std::vector<base::FilePath>& paths) {
2750 if (!enumeration_completions_[id]) 3063 if (!enumeration_completions_[id])
2751 return; 3064 return;
2752 3065
2753 WebVector<WebString> ws_file_names(paths.size()); 3066 WebVector<WebString> ws_file_names(paths.size());
2754 for (size_t i = 0; i < paths.size(); ++i) 3067 for (size_t i = 0; i < paths.size(); ++i)
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after
3982 std::vector<gfx::Size> sizes; 4295 std::vector<gfx::Size> sizes;
3983 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 4296 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
3984 if (!url.isEmpty()) 4297 if (!url.isEmpty())
3985 urls.push_back( 4298 urls.push_back(
3986 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); 4299 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes));
3987 } 4300 }
3988 SendUpdateFaviconURL(urls); 4301 SendUpdateFaviconURL(urls);
3989 } 4302 }
3990 4303
3991 } // namespace content 4304 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698