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

Side by Side Diff: ash/autoclick/autoclick_ring_handler.h

Issue 2016073004: Show a visual indicator for the progress of auto-click. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Created 4 years, 6 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 (c) 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 #ifndef ASH_AUTOCLICK_AUTOCLICK_RING_HANDLER_H_
6 #define ASH_AUTOCLICK_AUTOCLICK_RING_HANDLER_H_
7
8 #include <memory>
9
10 #include "base/macros.h"
11 #include "base/timer/timer.h"
12 #include "ui/aura/window_observer.h"
13 #include "ui/events/event.h"
14 #include "ui/gfx/animation/linear_animation.h"
15 #include "ui/gfx/geometry/point.h"
16
17 namespace ui {
18 class GestureEvent;
19 }
20
21 namespace ash {
22
23 namespace test {
24 class SystemGestureEventFilterTest;
25 }
26
27 // LongPressAutoclickRingHandler displays an animated affordance that is shown
28 // on a TAP_DOWN gesture. The animation sequence consists of two parts:
29 // The first part is a grow animation that starts at semi-long-press and
30 // completes on a long-press gesture. The affordance animates to full size
31 // during grow animation.
32 // The second part is a shrink animation that start after grow and shrinks the
33 // affordance out of view.
34 class LongPressAutoclickRingHandler : public gfx::LinearAnimation,
35 public aura::WindowObserver {
36 public:
37 LongPressAutoclickRingHandler();
38 ~LongPressAutoclickRingHandler() override;
39
40 // Displays or removes long press affordance according to the |event|.
41 void ProcessEvent(ui::LocatedEvent* event,
42 int delay_ms,
43 bool start_animation);
44
45 private:
46 friend class ash::test::SystemGestureEventFilterTest;
47
48 class LongPressAutoclickRingView;
49
50 enum LongPressAnimationType {
51 NONE,
52 GROW_ANIMATION,
53 SHRINK_ANIMATION,
54 };
55
56 gfx::Point GetLastMouseLocation();
57 aura::Window* GetTargetWindow();
58 void SetTapDownLocationAndTarget();
59 void StartAnimation(int delay_ms);
60 void StopAutoclickRing();
61 void SetTapDownTarget(aura::Window* target);
62
63 // Overridden from gfx::LinearAnimation.
64 void AnimateToState(double state) override;
65 void AnimationStopped() override;
66
67 // Overridden from aura::WindowObserver.
68 void OnWindowDestroying(aura::Window* window) override;
69
70 std::unique_ptr<LongPressAutoclickRingView> view_;
71 gfx::Point tap_down_location_;
72 aura::Window* tap_down_target_;
73 LongPressAnimationType current_animation_type_;
74
75 DISALLOW_COPY_AND_ASSIGN(LongPressAutoclickRingHandler);
76 };
77
78 } // namespace ash
79
80 #endif // ASH_AUTOCLICK_AUTOCLICK_RING_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698