| Index: ash/autoclick/autoclick_ring_handler.h
|
| diff --git a/ash/autoclick/autoclick_ring_handler.h b/ash/autoclick/autoclick_ring_handler.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..89261708e5334f44315da33c79cf4d618177c8d5
|
| --- /dev/null
|
| +++ b/ash/autoclick/autoclick_ring_handler.h
|
| @@ -0,0 +1,80 @@
|
| +// Copyright (c) 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 ASH_AUTOCLICK_AUTOCLICK_RING_HANDLER_H_
|
| +#define ASH_AUTOCLICK_AUTOCLICK_RING_HANDLER_H_
|
| +
|
| +#include <memory>
|
| +
|
| +#include "base/macros.h"
|
| +#include "base/timer/timer.h"
|
| +#include "ui/aura/window_observer.h"
|
| +#include "ui/events/event.h"
|
| +#include "ui/gfx/animation/linear_animation.h"
|
| +#include "ui/gfx/geometry/point.h"
|
| +
|
| +namespace ui {
|
| +class GestureEvent;
|
| +}
|
| +
|
| +namespace ash {
|
| +
|
| +namespace test {
|
| +class SystemGestureEventFilterTest;
|
| +}
|
| +
|
| +// LongPressAutoclickRingHandler displays an animated affordance that is shown
|
| +// on a TAP_DOWN gesture. The animation sequence consists of two parts:
|
| +// The first part is a grow animation that starts at semi-long-press and
|
| +// completes on a long-press gesture. The affordance animates to full size
|
| +// during grow animation.
|
| +// The second part is a shrink animation that start after grow and shrinks the
|
| +// affordance out of view.
|
| +class LongPressAutoclickRingHandler : public gfx::LinearAnimation,
|
| + public aura::WindowObserver {
|
| + public:
|
| + LongPressAutoclickRingHandler();
|
| + ~LongPressAutoclickRingHandler() override;
|
| +
|
| + // Displays or removes long press affordance according to the |event|.
|
| + void ProcessEvent(ui::LocatedEvent* event,
|
| + int delay_ms,
|
| + bool start_animation);
|
| +
|
| + private:
|
| + friend class ash::test::SystemGestureEventFilterTest;
|
| +
|
| + class LongPressAutoclickRingView;
|
| +
|
| + enum LongPressAnimationType {
|
| + NONE,
|
| + GROW_ANIMATION,
|
| + SHRINK_ANIMATION,
|
| + };
|
| +
|
| + gfx::Point GetLastMouseLocation();
|
| + aura::Window* GetTargetWindow();
|
| + void SetTapDownLocationAndTarget();
|
| + void StartAnimation(int delay_ms);
|
| + void StopAutoclickRing();
|
| + void SetTapDownTarget(aura::Window* target);
|
| +
|
| + // Overridden from gfx::LinearAnimation.
|
| + void AnimateToState(double state) override;
|
| + void AnimationStopped() override;
|
| +
|
| + // Overridden from aura::WindowObserver.
|
| + void OnWindowDestroying(aura::Window* window) override;
|
| +
|
| + std::unique_ptr<LongPressAutoclickRingView> view_;
|
| + gfx::Point tap_down_location_;
|
| + aura::Window* tap_down_target_;
|
| + LongPressAnimationType current_animation_type_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(LongPressAutoclickRingHandler);
|
| +};
|
| +
|
| +} // namespace ash
|
| +
|
| +#endif // ASH_AUTOCLICK_AUTOCLICK_RING_HANDLER_H_
|
|
|