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

Side by Side Diff: mash/simple_wm/move_loop.cc

Issue 2655303004: Add id properties to PointerEvent (Closed)
Patch Set: pointer id Created 3 years, 10 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 2016 The Chromium Authors. All rights reserved. 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 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 "mash/simple_wm/move_loop.h" 5 #include "mash/simple_wm/move_loop.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "ui/aura/client/aura_constants.h" 9 #include "ui/aura/client/aura_constants.h"
10 #include "ui/aura/window.h" 10 #include "ui/aura/window.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 VerticalLocation v_loc; 45 VerticalLocation v_loc;
46 if (!DetermineType(ht_location, &type, &h_loc, &v_loc)) 46 if (!DetermineType(ht_location, &type, &h_loc, &v_loc))
47 return nullptr; 47 return nullptr;
48 48
49 return base::WrapUnique(new MoveLoop(target, event, type, h_loc, v_loc)); 49 return base::WrapUnique(new MoveLoop(target, event, type, h_loc, v_loc));
50 } 50 }
51 51
52 MoveLoop::MoveResult MoveLoop::Move(const ui::PointerEvent& event) { 52 MoveLoop::MoveResult MoveLoop::Move(const ui::PointerEvent& event) {
53 switch (event.type()) { 53 switch (event.type()) {
54 case ui::ET_POINTER_CANCELLED: 54 case ui::ET_POINTER_CANCELLED:
55 if (event.pointer_id() == pointer_id_) { 55 if (event.pointer_details().id == pointer_id_) {
56 if (target_) 56 if (target_)
57 Revert(); 57 Revert();
58 return MoveResult::DONE; 58 return MoveResult::DONE;
59 } 59 }
60 return MoveResult::CONTINUE; 60 return MoveResult::CONTINUE;
61 61
62 case ui::ET_POINTER_MOVED: 62 case ui::ET_POINTER_MOVED:
63 if (target_ && event.pointer_id() == pointer_id_) 63 if (target_ && event.pointer_details().id == pointer_id_)
64 MoveImpl(event); 64 MoveImpl(event);
65 return MoveResult::CONTINUE; 65 return MoveResult::CONTINUE;
66 66
67 case ui::ET_POINTER_UP: 67 case ui::ET_POINTER_UP:
68 if (event.pointer_id() == pointer_id_) { 68 if (event.pointer_details().id == pointer_id_) {
69 // TODO(sky): need to support changed_flags. 69 // TODO(sky): need to support changed_flags.
70 if (target_) 70 if (target_)
71 MoveImpl(event); 71 MoveImpl(event);
72 return MoveResult::DONE; 72 return MoveResult::DONE;
73 } 73 }
74 return MoveResult::CONTINUE; 74 return MoveResult::CONTINUE;
75 75
76 default: 76 default:
77 break; 77 break;
78 } 78 }
(...skipping 11 matching lines...) Expand all
90 90
91 MoveLoop::MoveLoop(aura::Window* target, 91 MoveLoop::MoveLoop(aura::Window* target,
92 const ui::PointerEvent& event, 92 const ui::PointerEvent& event,
93 Type type, 93 Type type,
94 HorizontalLocation h_loc, 94 HorizontalLocation h_loc,
95 VerticalLocation v_loc) 95 VerticalLocation v_loc)
96 : target_(target), 96 : target_(target),
97 type_(type), 97 type_(type),
98 h_loc_(h_loc), 98 h_loc_(h_loc),
99 v_loc_(v_loc), 99 v_loc_(v_loc),
100 pointer_id_(event.pointer_id()), 100 pointer_id_(event.pointer_details().id),
101 initial_event_screen_location_(event.root_location()), 101 initial_event_screen_location_(event.root_location()),
102 initial_window_bounds_(target->bounds()), 102 initial_window_bounds_(target->bounds()),
103 initial_user_set_bounds_(target->bounds()), 103 initial_user_set_bounds_(target->bounds()),
104 // GetWindowUserSetBounds(target)), 104 // GetWindowUserSetBounds(target)),
sadrul 2017/02/07 05:40:41 Since you are here, delete this line?
lanwei 2017/02/10 20:54:38 Done.
105 changing_bounds_(false) { 105 changing_bounds_(false) {
106 target->AddObserver(this); 106 target->AddObserver(this);
107 } 107 }
108 108
109 // static 109 // static
110 bool MoveLoop::DetermineType(int ht_location, 110 bool MoveLoop::DetermineType(int ht_location,
111 Type* type, 111 Type* type,
112 HorizontalLocation* h_loc, 112 HorizontalLocation* h_loc,
113 VerticalLocation* v_loc) { 113 VerticalLocation* v_loc) {
114 *h_loc = HorizontalLocation::OTHER; 114 *h_loc = HorizontalLocation::OTHER;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 if (!changing_bounds_) 231 if (!changing_bounds_)
232 Cancel(); 232 Cancel();
233 } 233 }
234 234
235 void MoveLoop::OnWindowVisibilityChanged(aura::Window* window, bool visible) { 235 void MoveLoop::OnWindowVisibilityChanged(aura::Window* window, bool visible) {
236 DCHECK_EQ(window, target_); 236 DCHECK_EQ(window, target_);
237 Cancel(); 237 Cancel();
238 } 238 }
239 239
240 } // namespace simple_wm 240 } // namespace simple_wm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698