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

Side by Side Diff: content/browser/renderer_host/input/synthetic_pointer_action_controller.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: Modify comments Created 4 years, 7 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/browser/renderer_host/input/synthetic_pointer_action_controlle r.h"
6
7 namespace content {
8
9 SyntheticPointerActionController::SyntheticPointerActionController() {
10 for (size_t i = 0; i < index_map_.size(); ++i)
11 index_map_[i] = -1;
tdresser 2016/05/20 14:24:31 std::fill
lanwei 2016/05/23 16:40:51 Done.
12 }
13 SyntheticPointerActionController::~SyntheticPointerActionController() {}
14
15 std::unique_ptr<SyntheticGesture>
16 SyntheticPointerActionController::CreateSyntheticPointerAction(
17 const SyntheticPointerActionParams& gesture_params) {
18 DCHECK(gesture_params.pointer_action_type() !=
19 SyntheticPointerActionParams::PointerActionType::NOT_INITIALIZED);
20 std::unique_ptr<SyntheticGesture> synthetic_gesture;
21 if (gesture_params.pointer_action_type() !=
22 SyntheticPointerActionParams::PointerActionType::PROCESS)
tdresser 2016/05/20 14:24:31 This isn't technically required by the style guide
lanwei 2016/05/23 16:40:51 Done.
23 action_param_list_.push_back(gesture_params);
tdresser 2016/05/20 14:24:31 Should we push back the gesture params if the type
lanwei 2016/05/23 16:40:51 The reason I push the 'FINISH' action into the par
24
25 if (gesture_params.pointer_action_type() ==
26 SyntheticPointerActionParams::PointerActionType::PROCESS ||
27 gesture_params.pointer_action_type() ==
28 SyntheticPointerActionParams::PointerActionType::FINISH) {
29 // TODO(lanwei): Will support multiple pointer types in the same stream
30 // later, see https://crbug.com/613303.
31 if (!action_param_list_.empty()) {
32 if (!synthetic_pointer_)
33 SetSyntheticPointer(gesture_params);
34
35 synthetic_gesture =
36 std::unique_ptr<SyntheticGesture>(new SyntheticPointerAction(
37 action_param_list_, synthetic_pointer_.get(), &index_map_));
38 action_param_list_.clear();
39 }
40 }
41 return synthetic_gesture;
42 }
43
44 void SyntheticPointerActionController::SetSyntheticPointer(
45 const SyntheticPointerActionParams& gesture_params) {
46 SyntheticGestureParams::GestureSourceType gesture_source_type =
47 gesture_params.gesture_source_type;
48 if (gesture_source_type == SyntheticGestureParams::DEFAULT_INPUT)
49 gesture_source_type = default_type_;
50 DCHECK_NE(gesture_source_type, SyntheticGestureParams::DEFAULT_INPUT);
51 synthetic_pointer_ = SyntheticPointer::Create(gesture_source_type);
52 }
53
54 void SyntheticPointerActionController::ResetSyntheticPointer() {
55 synthetic_pointer_.reset();
56 }
57
58 void SyntheticPointerActionController::SetDefaultGestureSourceType(
59 SyntheticGestureParams::GestureSourceType default_type) {
60 default_type_ = default_type;
61 }
62
63 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698