| 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 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 #include "content/public/common/three_d_api_types.h" | 70 #include "content/public/common/three_d_api_types.h" |
| 71 #include "content/public/common/url_constants.h" | 71 #include "content/public/common/url_constants.h" |
| 72 #include "content/public/common/web_preferences.h" | 72 #include "content/public/common/web_preferences.h" |
| 73 #include "content/public/renderer/content_renderer_client.h" | 73 #include "content/public/renderer/content_renderer_client.h" |
| 74 #include "content/public/renderer/document_state.h" | 74 #include "content/public/renderer/document_state.h" |
| 75 #include "content/public/renderer/navigation_state.h" | 75 #include "content/public/renderer/navigation_state.h" |
| 76 #include "content/public/renderer/render_view_observer.h" | 76 #include "content/public/renderer/render_view_observer.h" |
| 77 #include "content/public/renderer/render_view_visitor.h" | 77 #include "content/public/renderer/render_view_visitor.h" |
| 78 #include "content/renderer/browser_plugin/browser_plugin.h" | 78 #include "content/renderer/browser_plugin/browser_plugin.h" |
| 79 #include "content/renderer/browser_plugin/browser_plugin_manager.h" | 79 #include "content/renderer/browser_plugin/browser_plugin_manager.h" |
| 80 #include "content/renderer/disambiguation_popup_helper.h" | |
| 81 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" | 80 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" |
| 82 #include "content/renderer/drop_data_builder.h" | 81 #include "content/renderer/drop_data_builder.h" |
| 83 #include "content/renderer/gpu/render_widget_compositor.h" | 82 #include "content/renderer/gpu/render_widget_compositor.h" |
| 84 #include "content/renderer/history_controller.h" | 83 #include "content/renderer/history_controller.h" |
| 85 #include "content/renderer/history_serialization.h" | 84 #include "content/renderer/history_serialization.h" |
| 86 #include "content/renderer/idle_user_detector.h" | 85 #include "content/renderer/idle_user_detector.h" |
| 87 #include "content/renderer/ime_event_guard.h" | 86 #include "content/renderer/ime_event_guard.h" |
| 88 #include "content/renderer/input/input_handler_manager.h" | 87 #include "content/renderer/input/input_handler_manager.h" |
| 89 #include "content/renderer/internal_document_state_data.h" | 88 #include "content/renderer/internal_document_state_data.h" |
| 90 #include "content/renderer/media/audio_device_factory.h" | 89 #include "content/renderer/media/audio_device_factory.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 #include "ui/gfx/geometry/size_conversions.h" | 175 #include "ui/gfx/geometry/size_conversions.h" |
| 177 #include "ui/gfx/native_widget_types.h" | 176 #include "ui/gfx/native_widget_types.h" |
| 178 #include "url/url_constants.h" | 177 #include "url/url_constants.h" |
| 179 #include "v8/include/v8.h" | 178 #include "v8/include/v8.h" |
| 180 | 179 |
| 181 #if defined(OS_ANDROID) | 180 #if defined(OS_ANDROID) |
| 182 #include <cpu-features.h> | 181 #include <cpu-features.h> |
| 183 | 182 |
| 184 #include "content/renderer/android/address_detector.h" | 183 #include "content/renderer/android/address_detector.h" |
| 185 #include "content/renderer/android/content_detector.h" | 184 #include "content/renderer/android/content_detector.h" |
| 185 #include "content/renderer/android/disambiguation_popup_helper.h" |
| 186 #include "content/renderer/android/email_detector.h" | 186 #include "content/renderer/android/email_detector.h" |
| 187 #include "content/renderer/android/phone_number_detector.h" | 187 #include "content/renderer/android/phone_number_detector.h" |
| 188 #include "ui/gfx/geometry/rect_f.h" | 188 #include "ui/gfx/geometry/rect_f.h" |
| 189 | 189 |
| 190 #elif defined(OS_WIN) | 190 #elif defined(OS_WIN) |
| 191 // TODO(port): these files are currently Windows only because they concern: | 191 // TODO(port): these files are currently Windows only because they concern: |
| 192 // * theming | 192 // * theming |
| 193 #include "ui/native_theme/native_theme_win.h" | 193 #include "ui/native_theme/native_theme_win.h" |
| 194 #elif defined(USE_X11) | 194 #elif defined(USE_X11) |
| 195 #include "ui/native_theme/native_theme.h" | 195 #include "ui/native_theme/native_theme.h" |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 settings->setMaxTouchPoints(prefs.pointer_events_max_touch_points); | 1003 settings->setMaxTouchPoints(prefs.pointer_events_max_touch_points); |
| 1004 settings->setAvailablePointerTypes(prefs.available_pointer_types); | 1004 settings->setAvailablePointerTypes(prefs.available_pointer_types); |
| 1005 settings->setPrimaryPointerType( | 1005 settings->setPrimaryPointerType( |
| 1006 static_cast<blink::PointerType>(prefs.primary_pointer_type)); | 1006 static_cast<blink::PointerType>(prefs.primary_pointer_type)); |
| 1007 settings->setAvailableHoverTypes(prefs.available_hover_types); | 1007 settings->setAvailableHoverTypes(prefs.available_hover_types); |
| 1008 settings->setPrimaryHoverType( | 1008 settings->setPrimaryHoverType( |
| 1009 static_cast<blink::HoverType>(prefs.primary_hover_type)); | 1009 static_cast<blink::HoverType>(prefs.primary_hover_type)); |
| 1010 settings->setDeviceSupportsTouch(prefs.device_supports_touch); | 1010 settings->setDeviceSupportsTouch(prefs.device_supports_touch); |
| 1011 settings->setDeviceSupportsMouse(prefs.device_supports_mouse); | 1011 settings->setDeviceSupportsMouse(prefs.device_supports_mouse); |
| 1012 settings->setEnableTouchAdjustment(prefs.touch_adjustment_enabled); | 1012 settings->setEnableTouchAdjustment(prefs.touch_adjustment_enabled); |
| 1013 settings->setMultiTargetTapNotificationEnabled( | |
| 1014 switches::IsLinkDisambiguationPopupEnabled()); | |
| 1015 | 1013 |
| 1016 WebRuntimeFeatures::enableImageColorProfiles( | 1014 WebRuntimeFeatures::enableImageColorProfiles( |
| 1017 prefs.image_color_profiles_enabled); | 1015 prefs.image_color_profiles_enabled); |
| 1018 settings->setShouldRespectImageOrientation( | 1016 settings->setShouldRespectImageOrientation( |
| 1019 prefs.should_respect_image_orientation); | 1017 prefs.should_respect_image_orientation); |
| 1020 | 1018 |
| 1021 settings->setEditingBehavior( | 1019 settings->setEditingBehavior( |
| 1022 static_cast<WebSettings::EditingBehavior>(prefs.editing_behavior)); | 1020 static_cast<WebSettings::EditingBehavior>(prefs.editing_behavior)); |
| 1023 | 1021 |
| 1024 settings->setSupportsMultipleWindows(prefs.supports_multiple_windows); | 1022 settings->setSupportsMultipleWindows(prefs.supports_multiple_windows); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1083 settings->setIgnoreMainFrameOverflowHiddenQuirk( | 1081 settings->setIgnoreMainFrameOverflowHiddenQuirk( |
| 1084 prefs.ignore_main_frame_overflow_hidden_quirk); | 1082 prefs.ignore_main_frame_overflow_hidden_quirk); |
| 1085 settings->setReportScreenSizeInPhysicalPixelsQuirk( | 1083 settings->setReportScreenSizeInPhysicalPixelsQuirk( |
| 1086 prefs.report_screen_size_in_physical_pixels_quirk); | 1084 prefs.report_screen_size_in_physical_pixels_quirk); |
| 1087 settings->setShouldReuseGlobalForUnownedMainFrame( | 1085 settings->setShouldReuseGlobalForUnownedMainFrame( |
| 1088 prefs.resue_global_for_unowned_main_frame); | 1086 prefs.resue_global_for_unowned_main_frame); |
| 1089 settings->setPreferHiddenVolumeControls(true); | 1087 settings->setPreferHiddenVolumeControls(true); |
| 1090 settings->setShrinksViewportContentToFit(true); | 1088 settings->setShrinksViewportContentToFit(true); |
| 1091 settings->setAutoplayExperimentMode( | 1089 settings->setAutoplayExperimentMode( |
| 1092 blink::WebString::fromUTF8(prefs.autoplay_experiment_mode)); | 1090 blink::WebString::fromUTF8(prefs.autoplay_experiment_mode)); |
| 1091 settings->setMultiTargetTapNotificationEnabled(true); |
| 1093 #endif | 1092 #endif |
| 1094 | 1093 |
| 1095 settings->setViewportEnabled(prefs.viewport_enabled); | 1094 settings->setViewportEnabled(prefs.viewport_enabled); |
| 1096 settings->setViewportMetaEnabled(prefs.viewport_meta_enabled); | 1095 settings->setViewportMetaEnabled(prefs.viewport_meta_enabled); |
| 1097 settings->setViewportStyle( | 1096 settings->setViewportStyle( |
| 1098 static_cast<blink::WebViewportStyle>(prefs.viewport_style)); | 1097 static_cast<blink::WebViewportStyle>(prefs.viewport_style)); |
| 1099 | 1098 |
| 1100 settings->setLoadWithOverviewMode(prefs.initialize_at_minimum_page_scale); | 1099 settings->setLoadWithOverviewMode(prefs.initialize_at_minimum_page_scale); |
| 1101 settings->setMainFrameResizesAreOrientationChanges( | 1100 settings->setMainFrameResizesAreOrientationChanges( |
| 1102 prefs.main_frame_resizes_are_orientation_changes); | 1101 prefs.main_frame_resizes_are_orientation_changes); |
| (...skipping 2001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3104 void RenderViewImpl::OnShowContextMenu( | 3103 void RenderViewImpl::OnShowContextMenu( |
| 3105 ui::MenuSourceType source_type, const gfx::Point& location) { | 3104 ui::MenuSourceType source_type, const gfx::Point& location) { |
| 3106 input_handler_->set_context_menu_source_type(source_type); | 3105 input_handler_->set_context_menu_source_type(source_type); |
| 3107 has_host_context_menu_location_ = true; | 3106 has_host_context_menu_location_ = true; |
| 3108 host_context_menu_location_ = location; | 3107 host_context_menu_location_ = location; |
| 3109 if (webview()) | 3108 if (webview()) |
| 3110 webview()->showContextMenu(); | 3109 webview()->showContextMenu(); |
| 3111 has_host_context_menu_location_ = false; | 3110 has_host_context_menu_location_ = false; |
| 3112 } | 3111 } |
| 3113 | 3112 |
| 3114 #if defined(OS_ANDROID) || defined(USE_AURA) | 3113 #if defined(OS_ANDROID) |
| 3115 bool RenderViewImpl::didTapMultipleTargets( | 3114 bool RenderViewImpl::didTapMultipleTargets( |
| 3116 const WebSize& inner_viewport_offset, | 3115 const WebSize& inner_viewport_offset, |
| 3117 const WebRect& touch_rect, | 3116 const WebRect& touch_rect, |
| 3118 const WebVector<WebRect>& target_rects) { | 3117 const WebVector<WebRect>& target_rects) { |
| 3119 DCHECK(switches::IsLinkDisambiguationPopupEnabled()); | |
| 3120 | |
| 3121 // Never show a disambiguation popup when accessibility is enabled, | 3118 // Never show a disambiguation popup when accessibility is enabled, |
| 3122 // as this interferes with "touch exploration". | 3119 // as this interferes with "touch exploration". |
| 3123 AccessibilityMode accessibility_mode = | 3120 AccessibilityMode accessibility_mode = |
| 3124 GetMainRenderFrame()->accessibility_mode(); | 3121 GetMainRenderFrame()->accessibility_mode(); |
| 3125 bool matches_accessibility_mode_complete = | 3122 bool matches_accessibility_mode_complete = |
| 3126 (accessibility_mode & AccessibilityModeComplete) == | 3123 (accessibility_mode & AccessibilityModeComplete) == |
| 3127 AccessibilityModeComplete; | 3124 AccessibilityModeComplete; |
| 3128 if (matches_accessibility_mode_complete) | 3125 if (matches_accessibility_mode_complete) |
| 3129 return false; | 3126 return false; |
| 3130 | 3127 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3187 handled = true; | 3184 handled = true; |
| 3188 break; | 3185 break; |
| 3189 } | 3186 } |
| 3190 case TAP_MULTIPLE_TARGETS_STRATEGY_NONE: | 3187 case TAP_MULTIPLE_TARGETS_STRATEGY_NONE: |
| 3191 // No-op. | 3188 // No-op. |
| 3192 break; | 3189 break; |
| 3193 } | 3190 } |
| 3194 | 3191 |
| 3195 return handled; | 3192 return handled; |
| 3196 } | 3193 } |
| 3197 #endif // defined(OS_ANDROID) || defined(USE_AURA) | 3194 #endif // defined(OS_ANDROID) |
| 3198 | 3195 |
| 3199 unsigned RenderViewImpl::GetLocalSessionHistoryLengthForTesting() const { | 3196 unsigned RenderViewImpl::GetLocalSessionHistoryLengthForTesting() const { |
| 3200 return history_list_length_; | 3197 return history_list_length_; |
| 3201 } | 3198 } |
| 3202 | 3199 |
| 3203 void RenderViewImpl::SetFocusAndActivateForTesting(bool enable) { | 3200 void RenderViewImpl::SetFocusAndActivateForTesting(bool enable) { |
| 3204 if (enable) { | 3201 if (enable) { |
| 3205 if (has_focus()) | 3202 if (has_focus()) |
| 3206 return; | 3203 return; |
| 3207 OnSetActive(true); | 3204 OnSetActive(true); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3298 if (IsUseZoomForDSFEnabled()) { | 3295 if (IsUseZoomForDSFEnabled()) { |
| 3299 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); | 3296 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); |
| 3300 } else { | 3297 } else { |
| 3301 webview()->setDeviceScaleFactor(device_scale_factor_); | 3298 webview()->setDeviceScaleFactor(device_scale_factor_); |
| 3302 } | 3299 } |
| 3303 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 3300 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
| 3304 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); | 3301 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); |
| 3305 } | 3302 } |
| 3306 | 3303 |
| 3307 } // namespace content | 3304 } // namespace content |
| OLD | NEW |