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

Unified Diff: content/browser/renderer_host/input/synthetic_pointer_action.cc

Issue 1707943002: Add SyntheticPointerActionParams used in Chromedriver extension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add explicit to constructor Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/input/synthetic_pointer_action.cc
diff --git a/content/browser/renderer_host/input/synthetic_pointer_action.cc b/content/browser/renderer_host/input/synthetic_pointer_action.cc
index 2577e3f5497fed988c2804978f6d7073954514ab..6353f342631d0cf7cb7ca49235e5e5311823921b 100644
--- a/content/browser/renderer_host/input/synthetic_pointer_action.cc
+++ b/content/browser/renderer_host/input/synthetic_pointer_action.cc
@@ -11,26 +11,24 @@
namespace content {
SyntheticPointerAction::SyntheticPointerAction(
- SyntheticGestureParams::GestureSourceType gesture_source_type,
- PointerActionType pointer_action_type,
- SyntheticPointer* synthetic_pointer,
- gfx::PointF position,
- int index)
- : gesture_source_type_(gesture_source_type),
- pointer_action_type_(pointer_action_type),
- position_(position),
- index_(index),
- synthetic_pointer_(synthetic_pointer) {}
+ const SyntheticPointerActionParams& params)
+ : params_(params) {}
+
+SyntheticPointerAction::SyntheticPointerAction(
+ const SyntheticPointerActionParams& params,
+ SyntheticPointer* synthetic_pointer)
+ : params_(params), synthetic_pointer_(synthetic_pointer) {}
SyntheticPointerAction::~SyntheticPointerAction() {}
SyntheticGesture::Result SyntheticPointerAction::ForwardInputEvents(
const base::TimeTicks& timestamp,
SyntheticGestureTarget* target) {
- if (gesture_source_type_ == SyntheticGestureParams::DEFAULT_INPUT)
- gesture_source_type_ = target->GetDefaultSyntheticGestureSourceType();
+ if (params_.gesture_source_type == SyntheticGestureParams::DEFAULT_INPUT)
+ params_.gesture_source_type =
+ target->GetDefaultSyntheticGestureSourceType();
- DCHECK_NE(gesture_source_type_, SyntheticGestureParams::DEFAULT_INPUT);
+ DCHECK_NE(params_.gesture_source_type, SyntheticGestureParams::DEFAULT_INPUT);
ForwardTouchOrMouseInputEvents(timestamp, target);
return SyntheticGesture::GESTURE_FINISHED;
@@ -39,17 +37,20 @@ SyntheticGesture::Result SyntheticPointerAction::ForwardInputEvents(
void SyntheticPointerAction::ForwardTouchOrMouseInputEvents(
const base::TimeTicks& timestamp,
SyntheticGestureTarget* target) {
- switch (pointer_action_type_) {
- case SyntheticGesture::PRESS:
- synthetic_pointer_->Press(position_.x(), position_.y(), target,
- timestamp);
+ switch (params_.pointer_action_type()) {
+ case SyntheticPointerActionParams::PointerActionType::PRESS:
+ synthetic_pointer_->Press(params_.position().x(), params_.position().y(),
+ target, timestamp);
+ break;
+ case SyntheticPointerActionParams::PointerActionType::MOVE:
+ synthetic_pointer_->Move(params_.index(), params_.position().x(),
+ params_.position().y(), target, timestamp);
break;
- case SyntheticGesture::MOVE:
- synthetic_pointer_->Move(index_, position_.x(), position_.y(), target,
- timestamp);
+ case SyntheticPointerActionParams::PointerActionType::RELEASE:
+ synthetic_pointer_->Release(params_.index(), target, timestamp);
break;
- case SyntheticGesture::RELEASE:
- synthetic_pointer_->Release(index_, target, timestamp);
+ default:
+ NOTREACHED();
break;
}
synthetic_pointer_->DispatchEvent(target, timestamp);
« no previous file with comments | « content/browser/renderer_host/input/synthetic_pointer_action.h ('k') | content/common/input/input_param_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698