| 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_widget.h" | 5 #include "content/renderer/render_widget.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/feature_list.h" | 13 #include "base/feature_list.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
| 17 #include "base/memory/singleton.h" | 17 #include "base/memory/singleton.h" |
| 18 #include "base/message_loop/message_loop.h" | 18 #include "base/message_loop/message_loop.h" |
| 19 #include "base/metrics/histogram_macros.h" | 19 #include "base/metrics/histogram_macros.h" |
| 20 #include "base/stl_util.h" | 20 #include "base/stl_util.h" |
| 21 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
| 22 #include "base/sys_info.h" | 22 #include "base/sys_info.h" |
| 23 #include "base/threading/thread_task_runner_handle.h" | 23 #include "base/threading/thread_task_runner_handle.h" |
| 24 #include "base/trace_event/trace_event.h" | 24 #include "base/trace_event/trace_event.h" |
| 25 #include "base/trace_event/trace_event_synthetic_delay.h" | 25 #include "base/trace_event/trace_event_synthetic_delay.h" |
| 26 #include "build/build_config.h" | 26 #include "build/build_config.h" |
| 27 #include "cc/animation/animation_host.h" | 27 #include "cc/animation/animation_host.h" |
| 28 #include "cc/input/touch_action.h" |
| 28 #include "cc/output/compositor_frame_sink.h" | 29 #include "cc/output/compositor_frame_sink.h" |
| 29 #include "cc/output/copy_output_request.h" | 30 #include "cc/output/copy_output_request.h" |
| 30 #include "cc/scheduler/begin_frame_source.h" | 31 #include "cc/scheduler/begin_frame_source.h" |
| 31 #include "cc/trees/layer_tree_host.h" | 32 #include "cc/trees/layer_tree_host.h" |
| 32 #include "content/common/content_switches_internal.h" | 33 #include "content/common/content_switches_internal.h" |
| 33 #include "content/common/drag_event_source_info.h" | 34 #include "content/common/drag_event_source_info.h" |
| 34 #include "content/common/drag_messages.h" | 35 #include "content/common/drag_messages.h" |
| 35 #include "content/common/input/synthetic_gesture_packet.h" | 36 #include "content/common/input/synthetic_gesture_packet.h" |
| 36 #include "content/common/input_messages.h" | 37 #include "content/common/input_messages.h" |
| 37 #include "content/common/render_message_filter.mojom.h" | 38 #include "content/common/render_message_filter.mojom.h" |
| (...skipping 2201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2239 void RenderWidget::SetHandlingInputEventForTesting(bool handling_input_event) { | 2240 void RenderWidget::SetHandlingInputEventForTesting(bool handling_input_event) { |
| 2240 input_handler_->set_handling_input_event(handling_input_event); | 2241 input_handler_->set_handling_input_event(handling_input_event); |
| 2241 } | 2242 } |
| 2242 | 2243 |
| 2243 void RenderWidget::HasTouchEventHandlers(bool has_handlers) { | 2244 void RenderWidget::HasTouchEventHandlers(bool has_handlers) { |
| 2244 if (render_widget_scheduling_state_) | 2245 if (render_widget_scheduling_state_) |
| 2245 render_widget_scheduling_state_->SetHasTouchHandler(has_handlers); | 2246 render_widget_scheduling_state_->SetHasTouchHandler(has_handlers); |
| 2246 Send(new ViewHostMsg_HasTouchEventHandlers(routing_id_, has_handlers)); | 2247 Send(new ViewHostMsg_HasTouchEventHandlers(routing_id_, has_handlers)); |
| 2247 } | 2248 } |
| 2248 | 2249 |
| 2249 void RenderWidget::SetTouchAction(blink::WebTouchAction web_touch_action) { | 2250 void RenderWidget::SetTouchAction(cc::TouchAction touch_action) { |
| 2250 // Ignore setTouchAction calls that result from synthetic touch events (eg. | 2251 // Ignore setTouchAction calls that result from synthetic touch events (eg. |
| 2251 // when blink is emulating touch with mouse). | 2252 // when blink is emulating touch with mouse). |
| 2252 if (input_handler_->handling_event_type() != WebInputEvent::kTouchStart) | 2253 if (input_handler_->handling_event_type() != WebInputEvent::kTouchStart) |
| 2253 return; | 2254 return; |
| 2254 | 2255 |
| 2255 content::TouchAction content_touch_action = | 2256 Send(new InputHostMsg_SetTouchAction(routing_id_, touch_action)); |
| 2256 static_cast<content::TouchAction>(web_touch_action); | |
| 2257 Send(new InputHostMsg_SetTouchAction(routing_id_, content_touch_action)); | |
| 2258 } | 2257 } |
| 2259 | 2258 |
| 2260 void RenderWidget::RegisterRenderFrameProxy(RenderFrameProxy* proxy) { | 2259 void RenderWidget::RegisterRenderFrameProxy(RenderFrameProxy* proxy) { |
| 2261 render_frame_proxies_.AddObserver(proxy); | 2260 render_frame_proxies_.AddObserver(proxy); |
| 2262 } | 2261 } |
| 2263 | 2262 |
| 2264 void RenderWidget::UnregisterRenderFrameProxy(RenderFrameProxy* proxy) { | 2263 void RenderWidget::UnregisterRenderFrameProxy(RenderFrameProxy* proxy) { |
| 2265 render_frame_proxies_.RemoveObserver(proxy); | 2264 render_frame_proxies_.RemoveObserver(proxy); |
| 2266 } | 2265 } |
| 2267 | 2266 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2341 // browser side (https://crbug.com/669219). | 2340 // browser side (https://crbug.com/669219). |
| 2342 // If there is no WebFrameWidget, then there will be no | 2341 // If there is no WebFrameWidget, then there will be no |
| 2343 // InputMethodControllers for a WebLocalFrame. | 2342 // InputMethodControllers for a WebLocalFrame. |
| 2344 return nullptr; | 2343 return nullptr; |
| 2345 } | 2344 } |
| 2346 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) | 2345 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) |
| 2347 ->GetActiveWebInputMethodController(); | 2346 ->GetActiveWebInputMethodController(); |
| 2348 } | 2347 } |
| 2349 | 2348 |
| 2350 } // namespace content | 2349 } // namespace content |
| OLD | NEW |