| Index: ui/touch_selection/touch_selection_controller_aura.h
|
| diff --git a/ui/touch_selection/touch_selection_controller_aura.h b/ui/touch_selection/touch_selection_controller_aura.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7bd65c6019a6527759be54f58275f39b0c933451
|
| --- /dev/null
|
| +++ b/ui/touch_selection/touch_selection_controller_aura.h
|
| @@ -0,0 +1,110 @@
|
| +// Copyright 2015 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 UI_TOUCH_SELECTION_TOUCH_SELECTION_CONTROLLER_AURA_H_
|
| +#define UI_TOUCH_SELECTION_TOUCH_SELECTION_CONTROLLER_AURA_H_
|
| +
|
| +#include "base/timer/timer.h"
|
| +#include "ui/events/event_handler.h"
|
| +#include "ui/events/event_target.h"
|
| +#include "ui/touch_selection/touch_selection_controller.h"
|
| +#include "ui/touch_selection/touch_selection_menu_runner.h"
|
| +
|
| +namespace aura {
|
| +class Window;
|
| +}
|
| +
|
| +namespace ui {
|
| +class MotionEventAura;
|
| +class TouchEvent;
|
| +class TouchSelectionControllerAuraTestApi;
|
| +
|
| +// The interface used by TouchSelectionControllerAura to communicate with its
|
| +// client.
|
| +class UI_TOUCH_SELECTION_EXPORT TouchSelectionControllerAuraClient {
|
| + public:
|
| + virtual ~TouchSelectionControllerAuraClient() {};
|
| +
|
| + virtual EventTarget* GetEventTarget() const = 0;
|
| + virtual void MoveCaret(const gfx::PointF& position) = 0;
|
| + virtual void MoveRangeSelectionExtent(const gfx::PointF& extent) = 0;
|
| + virtual void SelectBetweenCoordinates(const gfx::PointF& base,
|
| + const gfx::PointF& extent) = 0;
|
| + virtual aura::Window* GetParentWindow() const = 0;
|
| + virtual gfx::Rect GetClientBounds() const = 0;
|
| + virtual bool IsCommandIdEnabled(int command_id) const = 0;
|
| + virtual void ExecuteCommand(int command_id, int event_flags) = 0;
|
| + virtual void OpenContextMenu(const gfx::PointF& point) = 0;
|
| +};
|
| +
|
| +// Aura specific implementaion of a touch selection controller. Wraps an
|
| +// instance of TouchSelectionController and augments it with additional behavior
|
| +// needed in Aura.
|
| +class UI_TOUCH_SELECTION_EXPORT TouchSelectionControllerAura
|
| + : public TouchSelectionControllerClient,
|
| + public TouchSelectionMenuClient,
|
| + public EventHandler {
|
| + public:
|
| + explicit TouchSelectionControllerAura(
|
| + TouchSelectionControllerAuraClient* client);
|
| + ~TouchSelectionControllerAura() override;
|
| +
|
| + void OnSelectionEditable(bool editable);
|
| + void OnSelectionEmpty(bool empty);
|
| + void OnSelectionBoundsUpdated(const SelectionBound& start,
|
| + const SelectionBound& end);
|
| + void HideAndDisallowShowingAutomatically();
|
| + void OnWindowMoved();
|
| + void OnOverscrollStarted();
|
| + void OnOverscrollCompleted();
|
| + void OnFlingCompleted();
|
| +
|
| + protected:
|
| + // TouchSelectionControllerClient:
|
| + bool SupportsAnimation() const override;
|
| + void SetNeedsAnimate() override;
|
| + void MoveCaret(const gfx::PointF& position) override;
|
| + void MoveRangeSelectionExtent(const gfx::PointF& extent) override;
|
| + void SelectBetweenCoordinates(const gfx::PointF& base,
|
| + const gfx::PointF& extent) override;
|
| + void OnSelectionEvent(SelectionEventType event,
|
| + const gfx::PointF& position) override;
|
| + scoped_ptr<TouchHandleDrawable> CreateDrawable() override;
|
| +
|
| + private:
|
| + friend class TouchSelectionControllerAuraTestApi;
|
| + class EnvPreTargetHandler;
|
| +
|
| + gfx::Rect GetMenuAnchorRect() const;
|
| + void ShowQuickMenu();
|
| + void UpdateQuickMenu();
|
| + bool IsQuickMenuAllowed() const;
|
| +
|
| + // TouchSelectionMenuClient:
|
| + bool IsCommandIdEnabled(int command_id) const override;
|
| + void ExecuteCommand(int command_id, int event_flags) override;
|
| + void OpenContextMenu() override;
|
| +
|
| + // EventHandler:
|
| + void OnTouchEvent(TouchEvent* event) override;
|
| + void OnGestureEvent(GestureEvent* event) override;
|
| +
|
| + TouchSelectionControllerAuraClient* client_;
|
| + scoped_ptr<MotionEventAura> motion_event_;
|
| + scoped_ptr<TouchSelectionController> controller_;
|
| + scoped_ptr<EnvPreTargetHandler> env_pre_target_handler_;
|
| + base::OneShotTimer<TouchSelectionControllerAura> quick_menu_timer_;
|
| + bool scroll_in_progress_;
|
| + bool overscroll_in_progress_;
|
| + bool handle_drag_in_progress_;
|
| + bool selection_editable_;
|
| +
|
| + TouchSelectionControllerAuraTestApi* test_api_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(TouchSelectionControllerAura);
|
| +};
|
| +
|
| +} // namespace ui
|
| +
|
| +#endif // UI_TOUCH_SELECTION_TOUCH_SELECTION_CONTROLLER_AURA_H_
|
|
|