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 "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 Loading... |
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 Loading... |
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 Loading... |
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 Loading... |
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 Loading... |
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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
879 /*static*/ | 968 /*static*/ |
880 void RenderView::ForEach(RenderViewVisitor* visitor) { | 969 void RenderView::ForEach(RenderViewVisitor* visitor) { |
881 ViewMap* views = g_view_map.Pointer(); | 970 ViewMap* views = g_view_map.Pointer(); |
882 for (ViewMap::iterator it = views->begin(); it != views->end(); ++it) { | 971 for (ViewMap::iterator it = views->begin(); it != views->end(); ++it) { |
883 if (!visitor->Visit(it->second)) | 972 if (!visitor->Visit(it->second)) |
884 return; | 973 return; |
885 } | 974 } |
886 } | 975 } |
887 | 976 |
888 /*static*/ | 977 /*static*/ |
| 978 void RenderView::ApplyWebPreferences(const WebPreferences& prefs, |
| 979 WebView* web_view) { |
| 980 WebSettings* settings = web_view->settings(); |
| 981 ApplyFontsFromMap(prefs.standard_font_family_map, |
| 982 SetStandardFontFamilyWrapper, settings); |
| 983 ApplyFontsFromMap(prefs.fixed_font_family_map, |
| 984 SetFixedFontFamilyWrapper, settings); |
| 985 ApplyFontsFromMap(prefs.serif_font_family_map, |
| 986 SetSerifFontFamilyWrapper, settings); |
| 987 ApplyFontsFromMap(prefs.sans_serif_font_family_map, |
| 988 SetSansSerifFontFamilyWrapper, settings); |
| 989 ApplyFontsFromMap(prefs.cursive_font_family_map, |
| 990 SetCursiveFontFamilyWrapper, settings); |
| 991 ApplyFontsFromMap(prefs.fantasy_font_family_map, |
| 992 SetFantasyFontFamilyWrapper, settings); |
| 993 ApplyFontsFromMap(prefs.pictograph_font_family_map, |
| 994 SetPictographFontFamilyWrapper, settings); |
| 995 settings->setDefaultFontSize(prefs.default_font_size); |
| 996 settings->setDefaultFixedFontSize(prefs.default_fixed_font_size); |
| 997 settings->setMinimumFontSize(prefs.minimum_font_size); |
| 998 settings->setMinimumLogicalFontSize(prefs.minimum_logical_font_size); |
| 999 settings->setDefaultTextEncodingName( |
| 1000 base::ASCIIToUTF16(prefs.default_encoding)); |
| 1001 settings->setJavaScriptEnabled(prefs.javascript_enabled); |
| 1002 settings->setWebSecurityEnabled(prefs.web_security_enabled); |
| 1003 settings->setJavaScriptCanOpenWindowsAutomatically( |
| 1004 prefs.javascript_can_open_windows_automatically); |
| 1005 settings->setLoadsImagesAutomatically(prefs.loads_images_automatically); |
| 1006 settings->setImagesEnabled(prefs.images_enabled); |
| 1007 settings->setPluginsEnabled(prefs.plugins_enabled); |
| 1008 settings->setDOMPasteAllowed(prefs.dom_paste_enabled); |
| 1009 settings->setNeedsSiteSpecificQuirks(prefs.site_specific_quirks_enabled); |
| 1010 settings->setShrinksStandaloneImagesToFit( |
| 1011 prefs.shrinks_standalone_images_to_fit); |
| 1012 settings->setUsesEncodingDetector(prefs.uses_universal_detector); |
| 1013 settings->setTextAreasAreResizable(prefs.text_areas_are_resizable); |
| 1014 settings->setAllowScriptsToCloseWindows(prefs.allow_scripts_to_close_windows); |
| 1015 settings->setDownloadableBinaryFontsEnabled(prefs.remote_fonts_enabled); |
| 1016 settings->setJavaScriptCanAccessClipboard( |
| 1017 prefs.javascript_can_access_clipboard); |
| 1018 WebRuntimeFeatures::enableXSLT(prefs.xslt_enabled); |
| 1019 settings->setXSSAuditorEnabled(prefs.xss_auditor_enabled); |
| 1020 settings->setDNSPrefetchingEnabled(prefs.dns_prefetching_enabled); |
| 1021 settings->setLocalStorageEnabled(prefs.local_storage_enabled); |
| 1022 settings->setSyncXHRInDocumentsEnabled(prefs.sync_xhr_in_documents_enabled); |
| 1023 WebRuntimeFeatures::enableDatabase(prefs.databases_enabled); |
| 1024 settings->setOfflineWebApplicationCacheEnabled( |
| 1025 prefs.application_cache_enabled); |
| 1026 settings->setCaretBrowsingEnabled(prefs.caret_browsing_enabled); |
| 1027 settings->setHyperlinkAuditingEnabled(prefs.hyperlink_auditing_enabled); |
| 1028 settings->setCookieEnabled(prefs.cookie_enabled); |
| 1029 settings->setNavigateOnDragDrop(prefs.navigate_on_drag_drop); |
| 1030 |
| 1031 settings->setJavaEnabled(prefs.java_enabled); |
| 1032 |
| 1033 // By default, allow_universal_access_from_file_urls is set to false and thus |
| 1034 // we mitigate attacks from local HTML files by not granting file:// URLs |
| 1035 // universal access. Only test shell will enable this. |
| 1036 settings->setAllowUniversalAccessFromFileURLs( |
| 1037 prefs.allow_universal_access_from_file_urls); |
| 1038 settings->setAllowFileAccessFromFileURLs( |
| 1039 prefs.allow_file_access_from_file_urls); |
| 1040 |
| 1041 // Enable the web audio API if requested on the command line. |
| 1042 settings->setWebAudioEnabled(prefs.webaudio_enabled); |
| 1043 |
| 1044 // Enable experimental WebGL support if requested on command line |
| 1045 // and support is compiled in. |
| 1046 settings->setExperimentalWebGLEnabled(prefs.experimental_webgl_enabled); |
| 1047 |
| 1048 // Disable GL multisampling if requested on command line. |
| 1049 settings->setOpenGLMultisamplingEnabled(prefs.gl_multisampling_enabled); |
| 1050 |
| 1051 // Enable WebGL errors to the JS console if requested. |
| 1052 settings->setWebGLErrorsToConsoleEnabled( |
| 1053 prefs.webgl_errors_to_console_enabled); |
| 1054 |
| 1055 // Uses the mock theme engine for scrollbars. |
| 1056 settings->setMockScrollbarsEnabled(prefs.mock_scrollbars_enabled); |
| 1057 |
| 1058 settings->setLayerSquashingEnabled(prefs.layer_squashing_enabled); |
| 1059 |
| 1060 // Enable gpu-accelerated compositing always. |
| 1061 settings->setAcceleratedCompositingEnabled(true); |
| 1062 |
| 1063 // Enable gpu-accelerated 2d canvas if requested on the command line. |
| 1064 settings->setAccelerated2dCanvasEnabled(prefs.accelerated_2d_canvas_enabled); |
| 1065 |
| 1066 settings->setMinimumAccelerated2dCanvasSize( |
| 1067 prefs.minimum_accelerated_2d_canvas_size); |
| 1068 |
| 1069 // Disable antialiasing for 2d canvas if requested on the command line. |
| 1070 settings->setAntialiased2dCanvasEnabled( |
| 1071 !prefs.antialiased_2d_canvas_disabled); |
| 1072 |
| 1073 // Set MSAA sample count for 2d canvas if requested on the command line (or |
| 1074 // default value if not). |
| 1075 settings->setAccelerated2dCanvasMSAASampleCount( |
| 1076 prefs.accelerated_2d_canvas_msaa_sample_count); |
| 1077 |
| 1078 // Enable deferred filter rendering if requested on the command line. |
| 1079 settings->setDeferredFiltersEnabled(prefs.deferred_filters_enabled); |
| 1080 |
| 1081 // Enable container culling if requested on the command line. |
| 1082 settings->setContainerCullingEnabled(prefs.container_culling_enabled); |
| 1083 |
| 1084 // Enable gesture tap highlight if requested on the command line. |
| 1085 settings->setGestureTapHighlightEnabled(prefs.gesture_tap_highlight_enabled); |
| 1086 |
| 1087 // Enabling accelerated layers from the command line enabled accelerated |
| 1088 // Video. |
| 1089 settings->setAcceleratedCompositingForVideoEnabled( |
| 1090 prefs.accelerated_compositing_for_video_enabled); |
| 1091 |
| 1092 // WebGL and accelerated 2D canvas are always gpu composited. |
| 1093 settings->setAcceleratedCompositingForCanvasEnabled( |
| 1094 prefs.experimental_webgl_enabled || prefs.accelerated_2d_canvas_enabled); |
| 1095 |
| 1096 settings->setAsynchronousSpellCheckingEnabled( |
| 1097 prefs.asynchronous_spell_checking_enabled); |
| 1098 settings->setUnifiedTextCheckerEnabled(prefs.unified_textchecker_enabled); |
| 1099 |
| 1100 for (WebInspectorPreferences::const_iterator it = |
| 1101 prefs.inspector_settings.begin(); |
| 1102 it != prefs.inspector_settings.end(); |
| 1103 ++it) { |
| 1104 web_view->setInspectorSetting(WebString::fromUTF8(it->first), |
| 1105 WebString::fromUTF8(it->second)); |
| 1106 } |
| 1107 |
| 1108 // Tabs to link is not part of the settings. WebCore calls |
| 1109 // ChromeClient::tabsToLinks which is part of the glue code. |
| 1110 web_view->setTabsToLinks(prefs.tabs_to_links); |
| 1111 |
| 1112 settings->setAllowDisplayOfInsecureContent( |
| 1113 prefs.allow_displaying_insecure_content); |
| 1114 settings->setAllowRunningOfInsecureContent( |
| 1115 prefs.allow_running_insecure_content); |
| 1116 settings->setPasswordEchoEnabled(prefs.password_echo_enabled); |
| 1117 settings->setShouldPrintBackgrounds(prefs.should_print_backgrounds); |
| 1118 settings->setShouldClearDocumentBackground( |
| 1119 prefs.should_clear_document_background); |
| 1120 settings->setEnableScrollAnimator(prefs.enable_scroll_animator); |
| 1121 |
| 1122 settings->setRegionBasedColumnsEnabled(prefs.region_based_columns_enabled); |
| 1123 |
| 1124 WebRuntimeFeatures::enableTouch(prefs.touch_enabled); |
| 1125 settings->setMaxTouchPoints(prefs.pointer_events_max_touch_points); |
| 1126 settings->setDeviceSupportsTouch(prefs.device_supports_touch); |
| 1127 settings->setDeviceSupportsMouse(prefs.device_supports_mouse); |
| 1128 settings->setEnableTouchAdjustment(prefs.touch_adjustment_enabled); |
| 1129 |
| 1130 settings->setDeferredImageDecodingEnabled( |
| 1131 prefs.deferred_image_decoding_enabled); |
| 1132 settings->setShouldRespectImageOrientation( |
| 1133 prefs.should_respect_image_orientation); |
| 1134 |
| 1135 settings->setUnsafePluginPastingEnabled(false); |
| 1136 settings->setEditingBehavior( |
| 1137 static_cast<WebSettings::EditingBehavior>(prefs.editing_behavior)); |
| 1138 |
| 1139 settings->setSupportsMultipleWindows(prefs.supports_multiple_windows); |
| 1140 |
| 1141 settings->setViewportEnabled(prefs.viewport_enabled); |
| 1142 settings->setLoadWithOverviewMode(prefs.initialize_at_minimum_page_scale); |
| 1143 settings->setViewportMetaEnabled(prefs.viewport_meta_enabled); |
| 1144 settings->setMainFrameResizesAreOrientationChanges( |
| 1145 prefs.main_frame_resizes_are_orientation_changes); |
| 1146 |
| 1147 settings->setSmartInsertDeleteEnabled(prefs.smart_insert_delete_enabled); |
| 1148 |
| 1149 settings->setSpatialNavigationEnabled(prefs.spatial_navigation_enabled); |
| 1150 |
| 1151 settings->setSelectionIncludesAltImageText(true); |
| 1152 |
| 1153 #if defined(OS_ANDROID) |
| 1154 settings->setAllowCustomScrollbarInMainFrame(false); |
| 1155 settings->setTextAutosizingEnabled(prefs.text_autosizing_enabled); |
| 1156 settings->setAccessibilityFontScaleFactor(prefs.font_scale_factor); |
| 1157 settings->setDeviceScaleAdjustment(prefs.device_scale_adjustment); |
| 1158 web_view->setIgnoreViewportTagScaleLimits(prefs.force_enable_zoom); |
| 1159 settings->setAutoZoomFocusedNodeToLegibleScale(true); |
| 1160 settings->setDoubleTapToZoomEnabled(prefs.double_tap_to_zoom_enabled); |
| 1161 settings->setMediaControlsOverlayPlayButtonEnabled(true); |
| 1162 settings->setMediaPlaybackRequiresUserGesture( |
| 1163 prefs.user_gesture_required_for_media_playback); |
| 1164 settings->setDefaultVideoPosterURL( |
| 1165 base::ASCIIToUTF16(prefs.default_video_poster_url.spec())); |
| 1166 settings->setSupportDeprecatedTargetDensityDPI( |
| 1167 prefs.support_deprecated_target_density_dpi); |
| 1168 settings->setUseLegacyBackgroundSizeShorthandBehavior( |
| 1169 prefs.use_legacy_background_size_shorthand_behavior); |
| 1170 settings->setWideViewportQuirkEnabled(prefs.wide_viewport_quirk); |
| 1171 settings->setUseWideViewport(prefs.use_wide_viewport); |
| 1172 settings->setViewportMetaLayoutSizeQuirk( |
| 1173 prefs.viewport_meta_layout_size_quirk); |
| 1174 settings->setViewportMetaMergeContentQuirk( |
| 1175 prefs.viewport_meta_merge_content_quirk); |
| 1176 settings->setViewportMetaNonUserScalableQuirk( |
| 1177 prefs.viewport_meta_non_user_scalable_quirk); |
| 1178 settings->setViewportMetaZeroValuesQuirk( |
| 1179 prefs.viewport_meta_zero_values_quirk); |
| 1180 settings->setClobberUserAgentInitialScaleQuirk( |
| 1181 prefs.clobber_user_agent_initial_scale_quirk); |
| 1182 settings->setIgnoreMainFrameOverflowHiddenQuirk( |
| 1183 prefs.ignore_main_frame_overflow_hidden_quirk); |
| 1184 settings->setReportScreenSizeInPhysicalPixelsQuirk( |
| 1185 prefs.report_screen_size_in_physical_pixels_quirk); |
| 1186 settings->setMainFrameClipsContent(false); |
| 1187 settings->setShrinksStandaloneImagesToFit(false); |
| 1188 settings->setShrinksViewportContentToFit(true); |
| 1189 #endif |
| 1190 |
| 1191 WebNetworkStateNotifier::setOnLine(prefs.is_online); |
| 1192 WebNetworkStateNotifier::setWebConnectionType( |
| 1193 NetConnectionTypeToWebConnectionType(prefs.connection_type)); |
| 1194 settings->setPinchVirtualViewportEnabled( |
| 1195 prefs.pinch_virtual_viewport_enabled); |
| 1196 |
| 1197 settings->setPinchOverlayScrollbarThickness( |
| 1198 prefs.pinch_overlay_scrollbar_thickness); |
| 1199 settings->setUseSolidColorScrollbars(prefs.use_solid_color_scrollbars); |
| 1200 settings->setCompositorTouchHitTesting(prefs.compositor_touch_hit_testing); |
| 1201 } |
| 1202 |
| 1203 /*static*/ |
889 RenderViewImpl* RenderViewImpl::Create( | 1204 RenderViewImpl* RenderViewImpl::Create( |
890 int32 opener_id, | 1205 int32 opener_id, |
891 bool window_was_created_with_opener, | 1206 bool window_was_created_with_opener, |
892 const RendererPreferences& renderer_prefs, | 1207 const RendererPreferences& renderer_prefs, |
893 const WebPreferences& webkit_prefs, | 1208 const WebPreferences& webkit_prefs, |
894 int32 routing_id, | 1209 int32 routing_id, |
895 int32 main_frame_routing_id, | 1210 int32 main_frame_routing_id, |
896 int32 surface_id, | 1211 int32 surface_id, |
897 int64 session_storage_namespace_id, | 1212 int64 session_storage_namespace_id, |
898 const base::string16& frame_name, | 1213 const base::string16& frame_name, |
(...skipping 3083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3982 std::vector<gfx::Size> sizes; | 4297 std::vector<gfx::Size> sizes; |
3983 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4298 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
3984 if (!url.isEmpty()) | 4299 if (!url.isEmpty()) |
3985 urls.push_back( | 4300 urls.push_back( |
3986 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4301 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
3987 } | 4302 } |
3988 SendUpdateFaviconURL(urls); | 4303 SendUpdateFaviconURL(urls); |
3989 } | 4304 } |
3990 | 4305 |
3991 } // namespace content | 4306 } // namespace content |
OLD | NEW |