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/browser/renderer_host/render_widget_host_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <tuple> | 10 #include <tuple> |
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1172 if (!synthetic_gesture_controller_ && view_) { | 1172 if (!synthetic_gesture_controller_ && view_) { |
1173 synthetic_gesture_controller_.reset( | 1173 synthetic_gesture_controller_.reset( |
1174 new SyntheticGestureController(view_->CreateSyntheticGestureTarget())); | 1174 new SyntheticGestureController(view_->CreateSyntheticGestureTarget())); |
1175 } | 1175 } |
1176 if (synthetic_gesture_controller_) { | 1176 if (synthetic_gesture_controller_) { |
1177 synthetic_gesture_controller_->QueueSyntheticGesture( | 1177 synthetic_gesture_controller_->QueueSyntheticGesture( |
1178 std::move(synthetic_gesture), on_complete); | 1178 std::move(synthetic_gesture), on_complete); |
1179 } | 1179 } |
1180 } | 1180 } |
1181 | 1181 |
| 1182 void RenderWidgetHostImpl::QueueSyntheticGesture( |
| 1183 const SyntheticGestureParams& gesture_params, |
| 1184 const base::Callback<void(SyntheticGesture::Result)>& on_complete) { |
| 1185 if (!synthetic_gesture_controller_ && view_) { |
| 1186 synthetic_gesture_controller_.reset( |
| 1187 new SyntheticGestureController(view_->CreateSyntheticGestureTarget())); |
| 1188 } |
| 1189 if (synthetic_gesture_controller_) { |
| 1190 synthetic_gesture_controller_->QueueSyntheticPointerAction(gesture_params, |
| 1191 on_complete); |
| 1192 } |
| 1193 } |
| 1194 |
1182 void RenderWidgetHostImpl::SetCursor(const WebCursor& cursor) { | 1195 void RenderWidgetHostImpl::SetCursor(const WebCursor& cursor) { |
1183 if (!view_) | 1196 if (!view_) |
1184 return; | 1197 return; |
1185 view_->UpdateCursor(cursor); | 1198 view_->UpdateCursor(cursor); |
1186 } | 1199 } |
1187 | 1200 |
1188 void RenderWidgetHostImpl::ShowContextMenuAtPoint(const gfx::Point& point) { | 1201 void RenderWidgetHostImpl::ShowContextMenuAtPoint(const gfx::Point& point) { |
1189 Send(new ViewMsg_ShowContextMenu( | 1202 Send(new ViewMsg_ShowContextMenu( |
1190 GetRoutingID(), ui::MENU_SOURCE_MOUSE, point)); | 1203 GetRoutingID(), ui::MENU_SOURCE_MOUSE, point)); |
1191 } | 1204 } |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1723 const SyntheticGesturePacket& gesture_packet) { | 1736 const SyntheticGesturePacket& gesture_packet) { |
1724 // Only allow untrustworthy gestures if explicitly enabled. | 1737 // Only allow untrustworthy gestures if explicitly enabled. |
1725 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 1738 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
1726 cc::switches::kEnableGpuBenchmarking)) { | 1739 cc::switches::kEnableGpuBenchmarking)) { |
1727 bad_message::ReceivedBadMessage(GetProcess(), | 1740 bad_message::ReceivedBadMessage(GetProcess(), |
1728 bad_message::RWH_SYNTHETIC_GESTURE); | 1741 bad_message::RWH_SYNTHETIC_GESTURE); |
1729 return; | 1742 return; |
1730 } | 1743 } |
1731 | 1744 |
1732 QueueSyntheticGesture( | 1745 QueueSyntheticGesture( |
1733 SyntheticGesture::Create(*gesture_packet.gesture_params()), | 1746 *gesture_packet.gesture_params(), |
1734 base::Bind(&RenderWidgetHostImpl::OnSyntheticGestureCompleted, | 1747 base::Bind(&RenderWidgetHostImpl::OnSyntheticGestureCompleted, |
1735 weak_factory_.GetWeakPtr())); | 1748 weak_factory_.GetWeakPtr())); |
1736 } | 1749 } |
1737 | 1750 |
1738 void RenderWidgetHostImpl::OnSetCursor(const WebCursor& cursor) { | 1751 void RenderWidgetHostImpl::OnSetCursor(const WebCursor& cursor) { |
1739 SetCursor(cursor); | 1752 SetCursor(cursor); |
1740 } | 1753 } |
1741 | 1754 |
1742 void RenderWidgetHostImpl::SetTouchEventEmulationEnabled( | 1755 void RenderWidgetHostImpl::SetTouchEventEmulationEnabled( |
1743 bool enabled, ui::GestureProviderConfigType config_type) { | 1756 bool enabled, ui::GestureProviderConfigType config_type) { |
1744 if (enabled) { | 1757 if (enabled) { |
1745 if (!touch_emulator_) { | 1758 if (!touch_emulator_) { |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1998 void RenderWidgetHostImpl::OnUnexpectedEventAck(UnexpectedEventAckType type) { | 2011 void RenderWidgetHostImpl::OnUnexpectedEventAck(UnexpectedEventAckType type) { |
1999 if (type == BAD_ACK_MESSAGE) { | 2012 if (type == BAD_ACK_MESSAGE) { |
2000 bad_message::ReceivedBadMessage(process_, bad_message::RWH_BAD_ACK_MESSAGE); | 2013 bad_message::ReceivedBadMessage(process_, bad_message::RWH_BAD_ACK_MESSAGE); |
2001 } else if (type == UNEXPECTED_EVENT_TYPE) { | 2014 } else if (type == UNEXPECTED_EVENT_TYPE) { |
2002 suppress_next_char_events_ = false; | 2015 suppress_next_char_events_ = false; |
2003 } | 2016 } |
2004 } | 2017 } |
2005 | 2018 |
2006 void RenderWidgetHostImpl::OnSyntheticGestureCompleted( | 2019 void RenderWidgetHostImpl::OnSyntheticGestureCompleted( |
2007 SyntheticGesture::Result result) { | 2020 SyntheticGesture::Result result) { |
| 2021 LOG(ERROR) << "RenderWidgetHostImpl::OnSyntheticGestureCompleted " |
| 2022 << (int)result; |
2008 Send(new InputMsg_SyntheticGestureCompleted(GetRoutingID())); | 2023 Send(new InputMsg_SyntheticGestureCompleted(GetRoutingID())); |
2009 } | 2024 } |
2010 | 2025 |
| 2026 // void RenderWidgetHostImpl::OnSyntheticPointerActionCompleted( |
| 2027 // SyntheticGesture::Result result) { |
| 2028 // if (result == SyntheticGesture::GESTURE_FINISHED) { |
| 2029 // if (synthetic_gesture_controller_) |
| 2030 // synthetic_gesture_controller_->ResetSyntheticPointer(); |
| 2031 |
| 2032 // Send(new InputMsg_SyntheticGestureCompleted(GetRoutingID())); |
| 2033 // } |
| 2034 // } |
| 2035 |
2011 bool RenderWidgetHostImpl::ShouldDropInputEvents() const { | 2036 bool RenderWidgetHostImpl::ShouldDropInputEvents() const { |
2012 return ignore_input_events_ || process_->IgnoreInputEvents() || !delegate_; | 2037 return ignore_input_events_ || process_->IgnoreInputEvents() || !delegate_; |
2013 } | 2038 } |
2014 | 2039 |
2015 void RenderWidgetHostImpl::SetBackgroundOpaque(bool opaque) { | 2040 void RenderWidgetHostImpl::SetBackgroundOpaque(bool opaque) { |
2016 Send(new ViewMsg_SetBackgroundOpaque(GetRoutingID(), opaque)); | 2041 Send(new ViewMsg_SetBackgroundOpaque(GetRoutingID(), opaque)); |
2017 } | 2042 } |
2018 | 2043 |
2019 void RenderWidgetHostImpl::SetEditCommandsForNextKeyEvent( | 2044 void RenderWidgetHostImpl::SetEditCommandsForNextKeyEvent( |
2020 const std::vector<EditCommand>& commands) { | 2045 const std::vector<EditCommand>& commands) { |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2203 return delegate_ ? delegate_->GetRootBrowserAccessibilityManager() : NULL; | 2228 return delegate_ ? delegate_->GetRootBrowserAccessibilityManager() : NULL; |
2204 } | 2229 } |
2205 | 2230 |
2206 BrowserAccessibilityManager* | 2231 BrowserAccessibilityManager* |
2207 RenderWidgetHostImpl::GetOrCreateRootBrowserAccessibilityManager() { | 2232 RenderWidgetHostImpl::GetOrCreateRootBrowserAccessibilityManager() { |
2208 return delegate_ ? | 2233 return delegate_ ? |
2209 delegate_->GetOrCreateRootBrowserAccessibilityManager() : NULL; | 2234 delegate_->GetOrCreateRootBrowserAccessibilityManager() : NULL; |
2210 } | 2235 } |
2211 | 2236 |
2212 } // namespace content | 2237 } // namespace content |
OLD | NEW |