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

Unified Diff: content/common/input/synthetic_pointer_action_params.cc

Issue 1707943002: Add SyntheticPointerActionParams used in Chromedriver extension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add constraint to SyntheticPointerActionParams tests 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/common/input/synthetic_pointer_action_params.cc
diff --git a/content/common/input/synthetic_pointer_action_params.cc b/content/common/input/synthetic_pointer_action_params.cc
new file mode 100644
index 0000000000000000000000000000000000000000..593413b9822e8a52668cce5488c953ec302c8854
--- /dev/null
+++ b/content/common/input/synthetic_pointer_action_params.cc
@@ -0,0 +1,48 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/common/input/synthetic_pointer_action_params.h"
+
+namespace content {
+
+SyntheticPointerActionParams::SyntheticPointerActionParams()
+ : pointer_action_type_(PointerActionType::NOT_INITIALIZED), index_(-1) {}
+
+SyntheticPointerActionParams::SyntheticPointerActionParams(
+ PointerActionType type)
+ : pointer_action_type_(type), index_(-1) {}
+
+SyntheticPointerActionParams::SyntheticPointerActionParams(
+ const SyntheticPointerActionParams& other)
+ : SyntheticGestureParams(other),
+ pointer_action_type_(other.pointer_action_type()) {
+ switch (other.pointer_action_type()) {
dcheng 2016/03/31 20:04:37 I'm curious why we can't just default this ctor: d
dcheng 2016/04/02 08:05:11 Ping? I'm still curious about the answer to this q
lanwei 2016/04/02 14:51:21 We are using SyntheticPointerActionParams to warp
+ case PointerActionType::PRESS:
+ case PointerActionType::MOVE:
+ index_ = other.index();
+ position_ = other.position();
+ break;
+ case PointerActionType::RELEASE:
+ index_ = other.index();
+ break;
+ default:
+ break;
+ }
+}
+
+SyntheticPointerActionParams::~SyntheticPointerActionParams() {}
+
+SyntheticGestureParams::GestureType
+SyntheticPointerActionParams::GetGestureType() const {
+ return POINTER_ACTION;
+}
+
+const SyntheticPointerActionParams* SyntheticPointerActionParams::Cast(
+ const SyntheticGestureParams* gesture_params) {
+ DCHECK(gesture_params);
+ DCHECK_EQ(POINTER_ACTION, gesture_params->GetGestureType());
+ return static_cast<const SyntheticPointerActionParams*>(gesture_params);
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698