| 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 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 | 755 |
| 756 webview()->setDeviceScaleFactor(device_scale_factor_); | 756 webview()->setDeviceScaleFactor(device_scale_factor_); |
| 757 webview()->setDisplayMode(display_mode_); | 757 webview()->setDisplayMode(display_mode_); |
| 758 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 758 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
| 759 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); | 759 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); |
| 760 webview()->settings()->setThreadedScrollingEnabled( | 760 webview()->settings()->setThreadedScrollingEnabled( |
| 761 !command_line.HasSwitch(switches::kDisableThreadedScrolling)); | 761 !command_line.HasSwitch(switches::kDisableThreadedScrolling)); |
| 762 webview()->settings()->setRootLayerScrolls( | 762 webview()->settings()->setRootLayerScrolls( |
| 763 command_line.HasSwitch(switches::kRootLayerScrolls)); | 763 command_line.HasSwitch(switches::kRootLayerScrolls)); |
| 764 | 764 |
| 765 ApplyWebPreferences(webkit_preferences_, webview()); | 765 ApplyWebPreferencesInternal(webkit_preferences_, webview(), compositor_deps_); |
| 766 | 766 |
| 767 if (switches::IsTouchDragDropEnabled()) | 767 if (switches::IsTouchDragDropEnabled()) |
| 768 webview()->settings()->setTouchDragDropEnabled(true); | 768 webview()->settings()->setTouchDragDropEnabled(true); |
| 769 | 769 |
| 770 if (switches::IsTouchEditingEnabled()) | 770 if (switches::IsTouchEditingEnabled()) |
| 771 webview()->settings()->setTouchEditingEnabled(true); | 771 webview()->settings()->setTouchEditingEnabled(true); |
| 772 | 772 |
| 773 WebSettings::SelectionStrategyType selection_strategy = | 773 WebSettings::SelectionStrategyType selection_strategy = |
| 774 WebSettings::SelectionStrategyType::Character; | 774 WebSettings::SelectionStrategyType::Character; |
| 775 const std::string selection_strategy_str = | 775 const std::string selection_strategy_str = |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 /*static*/ | 900 /*static*/ |
| 901 void RenderView::ForEach(RenderViewVisitor* visitor) { | 901 void RenderView::ForEach(RenderViewVisitor* visitor) { |
| 902 ViewMap* views = g_view_map.Pointer(); | 902 ViewMap* views = g_view_map.Pointer(); |
| 903 for (ViewMap::iterator it = views->begin(); it != views->end(); ++it) { | 903 for (ViewMap::iterator it = views->begin(); it != views->end(); ++it) { |
| 904 if (!visitor->Visit(it->second)) | 904 if (!visitor->Visit(it->second)) |
| 905 return; | 905 return; |
| 906 } | 906 } |
| 907 } | 907 } |
| 908 | 908 |
| 909 /*static*/ | 909 /*static*/ |
| 910 void RenderView::ApplyWebPreferences(const WebPreferences& prefs, | 910 void RenderView::ApplyWebPreferencesInternal( |
| 911 WebView* web_view) { | 911 const WebPreferences& prefs, |
| 912 WebView* web_view, |
| 913 CompositorDependencies* compositor_deps) { |
| 912 WebSettings* settings = web_view->settings(); | 914 WebSettings* settings = web_view->settings(); |
| 913 ApplyFontsFromMap(prefs.standard_font_family_map, | 915 ApplyFontsFromMap(prefs.standard_font_family_map, |
| 914 SetStandardFontFamilyWrapper, settings); | 916 SetStandardFontFamilyWrapper, settings); |
| 915 ApplyFontsFromMap(prefs.fixed_font_family_map, | 917 ApplyFontsFromMap(prefs.fixed_font_family_map, |
| 916 SetFixedFontFamilyWrapper, settings); | 918 SetFixedFontFamilyWrapper, settings); |
| 917 ApplyFontsFromMap(prefs.serif_font_family_map, | 919 ApplyFontsFromMap(prefs.serif_font_family_map, |
| 918 SetSerifFontFamilyWrapper, settings); | 920 SetSerifFontFamilyWrapper, settings); |
| 919 ApplyFontsFromMap(prefs.sans_serif_font_family_map, | 921 ApplyFontsFromMap(prefs.sans_serif_font_family_map, |
| 920 SetSansSerifFontFamilyWrapper, settings); | 922 SetSansSerifFontFamilyWrapper, settings); |
| 921 ApplyFontsFromMap(prefs.cursive_font_family_map, | 923 ApplyFontsFromMap(prefs.cursive_font_family_map, |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1127 WebNetworkStateNotifier::setWebConnectionType( | 1129 WebNetworkStateNotifier::setWebConnectionType( |
| 1128 NetConnectionTypeToWebConnectionType(prefs.connection_type)); | 1130 NetConnectionTypeToWebConnectionType(prefs.connection_type)); |
| 1129 | 1131 |
| 1130 settings->setPinchOverlayScrollbarThickness( | 1132 settings->setPinchOverlayScrollbarThickness( |
| 1131 prefs.pinch_overlay_scrollbar_thickness); | 1133 prefs.pinch_overlay_scrollbar_thickness); |
| 1132 settings->setUseSolidColorScrollbars(prefs.use_solid_color_scrollbars); | 1134 settings->setUseSolidColorScrollbars(prefs.use_solid_color_scrollbars); |
| 1133 | 1135 |
| 1134 settings->setShowContextMenuOnMouseUp(prefs.context_menu_on_mouse_up); | 1136 settings->setShowContextMenuOnMouseUp(prefs.context_menu_on_mouse_up); |
| 1135 | 1137 |
| 1136 #if defined(OS_MACOSX) | 1138 #if defined(OS_MACOSX) |
| 1139 #if !defined(OS_IOS) |
| 1140 bool is_elastic_overscroll_enabled = |
| 1141 compositor_deps ? compositor_deps->IsElasticOverscrollEnabled() : false; |
| 1142 settings->setReportWheelOverscroll(is_elastic_overscroll_enabled); |
| 1143 #endif |
| 1137 settings->setDoubleTapToZoomEnabled(true); | 1144 settings->setDoubleTapToZoomEnabled(true); |
| 1138 web_view->setMaximumLegibleScale(prefs.default_maximum_page_scale_factor); | 1145 web_view->setMaximumLegibleScale(prefs.default_maximum_page_scale_factor); |
| 1139 #endif | 1146 #endif |
| 1140 } | 1147 } |
| 1141 | 1148 |
| 1142 /*static*/ | 1149 /*static*/ |
| 1143 RenderViewImpl* RenderViewImpl::Create(const ViewMsg_New_Params& params, | 1150 RenderViewImpl* RenderViewImpl::Create(const ViewMsg_New_Params& params, |
| 1144 CompositorDependencies* compositor_deps, | 1151 CompositorDependencies* compositor_deps, |
| 1145 bool was_created_by_renderer) { | 1152 bool was_created_by_renderer) { |
| 1146 DCHECK(params.view_id != MSG_ROUTING_NONE); | 1153 DCHECK(params.view_id != MSG_ROUTING_NONE); |
| (...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2639 WebDragOperation op) { | 2646 WebDragOperation op) { |
| 2640 webview()->dragSourceEndedAt(client_point, screen_point, op); | 2647 webview()->dragSourceEndedAt(client_point, screen_point, op); |
| 2641 } | 2648 } |
| 2642 | 2649 |
| 2643 void RenderViewImpl::OnDragSourceSystemDragEnded() { | 2650 void RenderViewImpl::OnDragSourceSystemDragEnded() { |
| 2644 webview()->dragSourceSystemDragEnded(); | 2651 webview()->dragSourceSystemDragEnded(); |
| 2645 } | 2652 } |
| 2646 | 2653 |
| 2647 void RenderViewImpl::OnUpdateWebPreferences(const WebPreferences& prefs) { | 2654 void RenderViewImpl::OnUpdateWebPreferences(const WebPreferences& prefs) { |
| 2648 webkit_preferences_ = prefs; | 2655 webkit_preferences_ = prefs; |
| 2649 ApplyWebPreferences(webkit_preferences_, webview()); | 2656 ApplyWebPreferencesInternal(webkit_preferences_, webview(), NULL); |
| 2650 } | 2657 } |
| 2651 | 2658 |
| 2652 void RenderViewImpl::OnEnumerateDirectoryResponse( | 2659 void RenderViewImpl::OnEnumerateDirectoryResponse( |
| 2653 int id, | 2660 int id, |
| 2654 const std::vector<base::FilePath>& paths) { | 2661 const std::vector<base::FilePath>& paths) { |
| 2655 if (!enumeration_completions_[id]) | 2662 if (!enumeration_completions_[id]) |
| 2656 return; | 2663 return; |
| 2657 | 2664 |
| 2658 WebVector<WebString> ws_file_names(paths.size()); | 2665 WebVector<WebString> ws_file_names(paths.size()); |
| 2659 for (size_t i = 0; i < paths.size(); ++i) | 2666 for (size_t i = 0; i < paths.size(); ++i) |
| (...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3796 std::vector<gfx::Size> sizes; | 3803 std::vector<gfx::Size> sizes; |
| 3797 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 3804 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
| 3798 if (!url.isEmpty()) | 3805 if (!url.isEmpty()) |
| 3799 urls.push_back( | 3806 urls.push_back( |
| 3800 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 3807 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
| 3801 } | 3808 } |
| 3802 SendUpdateFaviconURL(urls); | 3809 SendUpdateFaviconURL(urls); |
| 3803 } | 3810 } |
| 3804 | 3811 |
| 3805 } // namespace content | 3812 } // namespace content |
| OLD | NEW |