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

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

Issue 1707943002: Add SyntheticPointerActionParams used in Chromedriver extension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move PointerActionType to SyntheticPointerActionParams 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.h
diff --git a/content/common/input/synthetic_pointer_action_params.h b/content/common/input/synthetic_pointer_action_params.h
new file mode 100644
index 0000000000000000000000000000000000000000..874af0487d0ea6358d55de101e8f49ee021bc699
--- /dev/null
+++ b/content/common/input/synthetic_pointer_action_params.h
@@ -0,0 +1,85 @@
+// 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.
+
+#ifndef CONTENT_COMMON_INPUT_SYNTHETIC_POINTER_ACTION_PARAMS_H_
+#define CONTENT_COMMON_INPUT_SYNTHETIC_POINTER_ACTION_PARAMS_H_
+
+#include "base/logging.h"
+#include "content/common/content_export.h"
+#include "content/common/input/input_param_traits.h"
+#include "content/common/input/synthetic_gesture_params.h"
+#include "ui/gfx/geometry/point_f.h"
+
+namespace content {
+
+struct CONTENT_EXPORT SyntheticPointerActionParams
+ : public SyntheticGestureParams {
+ public:
+ // When we send actions one by one, once we receive a PROCESS action, we will
+ // start to dispatch an event with all the pending actions.
+ // TODO(lanwei): we will pre-process the delay action in the
tdresser 2016/03/22 14:38:10 As the plan of record never involves putting the d
lanwei 2016/03/23 14:01:52 Done.
+ // chromedrive_extension, here we do nothing for the delay. If the design
+ // changes, I will add a type for DELAY, see https://crbug.com/525187.
+ enum class PointerActionType {
+ NOT_INITIALIZED,
+ PRESS,
+ MOVE,
+ RELEASE,
+ PROCESS,
+ POINTER_ACTION_TYPE_MAX = PROCESS
+ };
+
+ SyntheticPointerActionParams();
+ SyntheticPointerActionParams(PointerActionType type);
+ SyntheticPointerActionParams(const SyntheticPointerActionParams& other);
+ ~SyntheticPointerActionParams() override;
+
+ GestureType GetGestureType() const override;
+
+ static const SyntheticPointerActionParams* Cast(
+ const SyntheticGestureParams* gesture_params);
+
+ void set_pointer_action_type(PointerActionType pointer_action_type) {
+ pointer_action_type_arg = pointer_action_type;
+ }
+
+ void set_index(int index) {
+ DCHECK(pointer_action_type_arg != PointerActionType::PROCESS);
+ index_arg = index;
+ }
+
+ void set_position(const gfx::PointF& position) {
+ DCHECK(pointer_action_type_arg == PointerActionType::PRESS ||
+ pointer_action_type_arg == PointerActionType::MOVE);
+ position_arg = position;
+ }
+
+ PointerActionType pointer_action_type() const {
+ return pointer_action_type_arg;
+ }
+
+ int index() const {
+ DCHECK(pointer_action_type_arg != PointerActionType::PROCESS);
+ return index_arg;
+ }
+
+ gfx::PointF position() const {
+ DCHECK(pointer_action_type_arg == PointerActionType::PRESS ||
+ pointer_action_type_arg == PointerActionType::MOVE);
+ return position_arg;
+ }
+
+ private:
+ friend struct IPC::ParamTraits<content::SyntheticPointerActionParams>;
+
+ PointerActionType pointer_action_type_arg;
tdresser 2016/03/22 14:38:10 I'm not sure the |_arg| suffix is adding much valu
lanwei 2016/03/23 14:01:52 I feel maybe it is confusing to have variable's na
+ // Pass a position value when sending a press or move action.
+ gfx::PointF position_arg;
+ // Pass an index value except the pointer_action_type_arg is PROCESS.
+ int index_arg;
+};
+
+} // namespace content
+
+#endif // CONTENT_COMMON_INPUT_SYNTHETIC_POINTER_ACTION_PARAMS_H_
« no previous file with comments | « content/common/input/synthetic_gesture_params.h ('k') | content/common/input/synthetic_pointer_action_params.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698