Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 1884883005: Prepare SyntheticPointerAction to handle touch actions for multiple fingers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add tests for mouse and change type of params_list Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <utility> 10 #include <utility>
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 if (!synthetic_gesture_controller_ && view_) { 1159 if (!synthetic_gesture_controller_ && view_) {
1160 synthetic_gesture_controller_.reset( 1160 synthetic_gesture_controller_.reset(
1161 new SyntheticGestureController(view_->CreateSyntheticGestureTarget())); 1161 new SyntheticGestureController(view_->CreateSyntheticGestureTarget()));
1162 } 1162 }
1163 if (synthetic_gesture_controller_) { 1163 if (synthetic_gesture_controller_) {
1164 synthetic_gesture_controller_->QueueSyntheticGesture( 1164 synthetic_gesture_controller_->QueueSyntheticGesture(
1165 std::move(synthetic_gesture), on_complete); 1165 std::move(synthetic_gesture), on_complete);
1166 } 1166 }
1167 } 1167 }
1168 1168
1169 void RenderWidgetHostImpl::QueueSyntheticPointerAction(
1170 const SyntheticPointerActionParams& gesture_params,
1171 const base::Callback<void(SyntheticGesture::Result)>& on_complete) {
1172 if (!synthetic_gesture_controller_ && view_) {
1173 synthetic_gesture_controller_.reset(
1174 new SyntheticGestureController(view_->CreateSyntheticGestureTarget()));
1175 }
1176 if (synthetic_gesture_controller_) {
tdresser 2016/05/31 13:44:26 Should this ever run if !view_? It might be easie
lanwei 2016/06/02 13:26:27 I feel if the synthetic_gesture_controller is not
tdresser 2016/06/02 13:39:24 Is there ever a case where the controller is non-n
1177 synthetic_gesture_controller_->QueueSyntheticPointerAction(gesture_params,
1178 on_complete);
1179 }
1180 }
1181
1169 void RenderWidgetHostImpl::SetCursor(const WebCursor& cursor) { 1182 void RenderWidgetHostImpl::SetCursor(const WebCursor& cursor) {
1170 if (!view_) 1183 if (!view_)
1171 return; 1184 return;
1172 view_->UpdateCursor(cursor); 1185 view_->UpdateCursor(cursor);
1173 } 1186 }
1174 1187
1175 void RenderWidgetHostImpl::ShowContextMenuAtPoint(const gfx::Point& point) { 1188 void RenderWidgetHostImpl::ShowContextMenuAtPoint(const gfx::Point& point) {
1176 Send(new ViewMsg_ShowContextMenu( 1189 Send(new ViewMsg_ShowContextMenu(
1177 GetRoutingID(), ui::MENU_SOURCE_MOUSE, point)); 1190 GetRoutingID(), ui::MENU_SOURCE_MOUSE, point));
1178 } 1191 }
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
1682 void RenderWidgetHostImpl::OnQueueSyntheticGesture( 1695 void RenderWidgetHostImpl::OnQueueSyntheticGesture(
1683 const SyntheticGesturePacket& gesture_packet) { 1696 const SyntheticGesturePacket& gesture_packet) {
1684 // Only allow untrustworthy gestures if explicitly enabled. 1697 // Only allow untrustworthy gestures if explicitly enabled.
1685 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 1698 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
1686 cc::switches::kEnableGpuBenchmarking)) { 1699 cc::switches::kEnableGpuBenchmarking)) {
1687 bad_message::ReceivedBadMessage(GetProcess(), 1700 bad_message::ReceivedBadMessage(GetProcess(),
1688 bad_message::RWH_SYNTHETIC_GESTURE); 1701 bad_message::RWH_SYNTHETIC_GESTURE);
1689 return; 1702 return;
1690 } 1703 }
1691 1704
1705 if (gesture_packet.gesture_params()->GetGestureType() ==
1706 SyntheticGestureParams::POINTER_ACTION) {
1707 QueueSyntheticPointerAction(
1708 *SyntheticPointerActionParams::Cast(gesture_packet.gesture_params()),
1709 base::Bind(&RenderWidgetHostImpl::OnSyntheticPointerActionCompleted,
1710 weak_factory_.GetWeakPtr()));
1711 return;
1712 }
1713
1692 QueueSyntheticGesture( 1714 QueueSyntheticGesture(
1693 SyntheticGesture::Create(*gesture_packet.gesture_params()), 1715 SyntheticGesture::Create(*gesture_packet.gesture_params()),
1694 base::Bind(&RenderWidgetHostImpl::OnSyntheticGestureCompleted, 1716 base::Bind(&RenderWidgetHostImpl::OnSyntheticGestureCompleted,
1695 weak_factory_.GetWeakPtr())); 1717 weak_factory_.GetWeakPtr()));
1696 } 1718 }
1697 1719
1698 void RenderWidgetHostImpl::OnSetCursor(const WebCursor& cursor) { 1720 void RenderWidgetHostImpl::OnSetCursor(const WebCursor& cursor) {
1699 SetCursor(cursor); 1721 SetCursor(cursor);
1700 } 1722 }
1701 1723
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
1946 } else if (type == UNEXPECTED_EVENT_TYPE) { 1968 } else if (type == UNEXPECTED_EVENT_TYPE) {
1947 suppress_next_char_events_ = false; 1969 suppress_next_char_events_ = false;
1948 } 1970 }
1949 } 1971 }
1950 1972
1951 void RenderWidgetHostImpl::OnSyntheticGestureCompleted( 1973 void RenderWidgetHostImpl::OnSyntheticGestureCompleted(
1952 SyntheticGesture::Result result) { 1974 SyntheticGesture::Result result) {
1953 Send(new InputMsg_SyntheticGestureCompleted(GetRoutingID())); 1975 Send(new InputMsg_SyntheticGestureCompleted(GetRoutingID()));
1954 } 1976 }
1955 1977
1978 void RenderWidgetHostImpl::OnSyntheticPointerActionCompleted(
1979 SyntheticGesture::Result result) {
1980 if (result == SyntheticGesture::POINTER_ACTION_FINISHED) {
1981 if (synthetic_gesture_controller_)
1982 synthetic_gesture_controller_->ResetSyntheticPointer();
1983 Send(new InputMsg_SyntheticGestureCompleted(GetRoutingID()));
1984 }
1985 }
1986
1956 bool RenderWidgetHostImpl::ShouldDropInputEvents() const { 1987 bool RenderWidgetHostImpl::ShouldDropInputEvents() const {
1957 return ignore_input_events_ || process_->IgnoreInputEvents() || !delegate_; 1988 return ignore_input_events_ || process_->IgnoreInputEvents() || !delegate_;
1958 } 1989 }
1959 1990
1960 void RenderWidgetHostImpl::SetBackgroundOpaque(bool opaque) { 1991 void RenderWidgetHostImpl::SetBackgroundOpaque(bool opaque) {
1961 Send(new ViewMsg_SetBackgroundOpaque(GetRoutingID(), opaque)); 1992 Send(new ViewMsg_SetBackgroundOpaque(GetRoutingID(), opaque));
1962 } 1993 }
1963 1994
1964 void RenderWidgetHostImpl::SetEditCommandsForNextKeyEvent( 1995 void RenderWidgetHostImpl::SetEditCommandsForNextKeyEvent(
1965 const std::vector<EditCommand>& commands) { 1996 const std::vector<EditCommand>& commands) {
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
2152 return delegate_ ? delegate_->GetRootBrowserAccessibilityManager() : NULL; 2183 return delegate_ ? delegate_->GetRootBrowserAccessibilityManager() : NULL;
2153 } 2184 }
2154 2185
2155 BrowserAccessibilityManager* 2186 BrowserAccessibilityManager*
2156 RenderWidgetHostImpl::GetOrCreateRootBrowserAccessibilityManager() { 2187 RenderWidgetHostImpl::GetOrCreateRootBrowserAccessibilityManager() {
2157 return delegate_ ? 2188 return delegate_ ?
2158 delegate_->GetOrCreateRootBrowserAccessibilityManager() : NULL; 2189 delegate_->GetOrCreateRootBrowserAccessibilityManager() : NULL;
2159 } 2190 }
2160 2191
2161 } // namespace content 2192 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698