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 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1183 if (!synthetic_gesture_controller_ && view_) { | 1183 if (!synthetic_gesture_controller_ && view_) { |
1184 synthetic_gesture_controller_.reset( | 1184 synthetic_gesture_controller_.reset( |
1185 new SyntheticGestureController(view_->CreateSyntheticGestureTarget())); | 1185 new SyntheticGestureController(view_->CreateSyntheticGestureTarget())); |
1186 } | 1186 } |
1187 if (synthetic_gesture_controller_) { | 1187 if (synthetic_gesture_controller_) { |
1188 synthetic_gesture_controller_->QueueSyntheticGesture( | 1188 synthetic_gesture_controller_->QueueSyntheticGesture( |
1189 std::move(synthetic_gesture), on_complete); | 1189 std::move(synthetic_gesture), on_complete); |
1190 } | 1190 } |
1191 } | 1191 } |
1192 | 1192 |
1193 void RenderWidgetHostImpl::QueueSyntheticGesture( | |
1194 const SyntheticGestureParams& gesture_params, | |
1195 const base::Callback<void(SyntheticGesture::Result)>& on_complete) { | |
1196 if (!synthetic_gesture_controller_ && view_) { | |
1197 synthetic_gesture_controller_.reset( | |
1198 new SyntheticGestureController(view_->CreateSyntheticGestureTarget())); | |
1199 } | |
1200 if (synthetic_gesture_controller_) { | |
1201 synthetic_gesture_controller_->QueueSyntheticPointerAction(gesture_params, | |
1202 on_complete); | |
1203 } | |
1204 } | |
1205 | |
1193 void RenderWidgetHostImpl::SetCursor(const WebCursor& cursor) { | 1206 void RenderWidgetHostImpl::SetCursor(const WebCursor& cursor) { |
1194 if (!view_) | 1207 if (!view_) |
1195 return; | 1208 return; |
1196 view_->UpdateCursor(cursor); | 1209 view_->UpdateCursor(cursor); |
1197 } | 1210 } |
1198 | 1211 |
1199 void RenderWidgetHostImpl::ShowContextMenuAtPoint(const gfx::Point& point) { | 1212 void RenderWidgetHostImpl::ShowContextMenuAtPoint(const gfx::Point& point) { |
1200 Send(new ViewMsg_ShowContextMenu( | 1213 Send(new ViewMsg_ShowContextMenu( |
1201 GetRoutingID(), ui::MENU_SOURCE_MOUSE, point)); | 1214 GetRoutingID(), ui::MENU_SOURCE_MOUSE, point)); |
1202 } | 1215 } |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1737 const SyntheticGesturePacket& gesture_packet) { | 1750 const SyntheticGesturePacket& gesture_packet) { |
1738 // Only allow untrustworthy gestures if explicitly enabled. | 1751 // Only allow untrustworthy gestures if explicitly enabled. |
1739 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 1752 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
1740 cc::switches::kEnableGpuBenchmarking)) { | 1753 cc::switches::kEnableGpuBenchmarking)) { |
1741 bad_message::ReceivedBadMessage(GetProcess(), | 1754 bad_message::ReceivedBadMessage(GetProcess(), |
1742 bad_message::RWH_SYNTHETIC_GESTURE); | 1755 bad_message::RWH_SYNTHETIC_GESTURE); |
1743 return; | 1756 return; |
1744 } | 1757 } |
1745 | 1758 |
1746 QueueSyntheticGesture( | 1759 QueueSyntheticGesture( |
1747 SyntheticGesture::Create(*gesture_packet.gesture_params()), | 1760 *gesture_packet.gesture_params(), |
1748 base::Bind(&RenderWidgetHostImpl::OnSyntheticGestureCompleted, | 1761 base::Bind(&RenderWidgetHostImpl::OnSyntheticGestureCompleted, |
1749 weak_factory_.GetWeakPtr())); | 1762 weak_factory_.GetWeakPtr())); |
tdresser
2016/09/30 13:24:30
Why did we stop doing things this way?
Perhaps the
| |
1750 } | 1763 } |
1751 | 1764 |
1752 void RenderWidgetHostImpl::OnSetCursor(const WebCursor& cursor) { | 1765 void RenderWidgetHostImpl::OnSetCursor(const WebCursor& cursor) { |
1753 SetCursor(cursor); | 1766 SetCursor(cursor); |
1754 } | 1767 } |
1755 | 1768 |
1756 void RenderWidgetHostImpl::SetTouchEventEmulationEnabled( | 1769 void RenderWidgetHostImpl::SetTouchEventEmulationEnabled( |
1757 bool enabled, ui::GestureProviderConfigType config_type) { | 1770 bool enabled, ui::GestureProviderConfigType config_type) { |
1758 if (enabled) { | 1771 if (enabled) { |
1759 if (!touch_emulator_) { | 1772 if (!touch_emulator_) { |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2012 void RenderWidgetHostImpl::OnUnexpectedEventAck(UnexpectedEventAckType type) { | 2025 void RenderWidgetHostImpl::OnUnexpectedEventAck(UnexpectedEventAckType type) { |
2013 if (type == BAD_ACK_MESSAGE) { | 2026 if (type == BAD_ACK_MESSAGE) { |
2014 bad_message::ReceivedBadMessage(process_, bad_message::RWH_BAD_ACK_MESSAGE); | 2027 bad_message::ReceivedBadMessage(process_, bad_message::RWH_BAD_ACK_MESSAGE); |
2015 } else if (type == UNEXPECTED_EVENT_TYPE) { | 2028 } else if (type == UNEXPECTED_EVENT_TYPE) { |
2016 suppress_next_char_events_ = false; | 2029 suppress_next_char_events_ = false; |
2017 } | 2030 } |
2018 } | 2031 } |
2019 | 2032 |
2020 void RenderWidgetHostImpl::OnSyntheticGestureCompleted( | 2033 void RenderWidgetHostImpl::OnSyntheticGestureCompleted( |
2021 SyntheticGesture::Result result) { | 2034 SyntheticGesture::Result result) { |
2035 LOG(ERROR) << "RenderWidgetHostImpl::OnSyntheticGestureCompleted " | |
2036 << (int)result; | |
tdresser
2016/09/30 13:24:30
Remove log.
lanwei
2016/10/21 21:53:07
Done.
| |
2022 Send(new InputMsg_SyntheticGestureCompleted(GetRoutingID())); | 2037 Send(new InputMsg_SyntheticGestureCompleted(GetRoutingID())); |
2023 } | 2038 } |
2024 | 2039 |
2025 bool RenderWidgetHostImpl::ShouldDropInputEvents() const { | 2040 bool RenderWidgetHostImpl::ShouldDropInputEvents() const { |
2026 return ignore_input_events_ || process_->IgnoreInputEvents() || !delegate_; | 2041 return ignore_input_events_ || process_->IgnoreInputEvents() || !delegate_; |
2027 } | 2042 } |
2028 | 2043 |
2029 void RenderWidgetHostImpl::SetBackgroundOpaque(bool opaque) { | 2044 void RenderWidgetHostImpl::SetBackgroundOpaque(bool opaque) { |
2030 Send(new ViewMsg_SetBackgroundOpaque(GetRoutingID(), opaque)); | 2045 Send(new ViewMsg_SetBackgroundOpaque(GetRoutingID(), opaque)); |
2031 } | 2046 } |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2217 return delegate_ ? delegate_->GetRootBrowserAccessibilityManager() : NULL; | 2232 return delegate_ ? delegate_->GetRootBrowserAccessibilityManager() : NULL; |
2218 } | 2233 } |
2219 | 2234 |
2220 BrowserAccessibilityManager* | 2235 BrowserAccessibilityManager* |
2221 RenderWidgetHostImpl::GetOrCreateRootBrowserAccessibilityManager() { | 2236 RenderWidgetHostImpl::GetOrCreateRootBrowserAccessibilityManager() { |
2222 return delegate_ ? | 2237 return delegate_ ? |
2223 delegate_->GetOrCreateRootBrowserAccessibilityManager() : NULL; | 2238 delegate_->GetOrCreateRootBrowserAccessibilityManager() : NULL; |
2224 } | 2239 } |
2225 | 2240 |
2226 } // namespace content | 2241 } // namespace content |
OLD | NEW |