| 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..2ef39b1c6b8d43b6faceb7fa620b8ef25ee17262
|
| --- /dev/null
|
| +++ b/ui/touch_selection/touch_selection_controller_aura.h
|
| @@ -0,0 +1,113 @@
|
| +// Copyright 2014 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/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 UI_TOUCH_SELECTION_EXPORT TouchSelectionControllerAuraClient {
|
| + public:
|
| + virtual ~TouchSelectionControllerAuraClient() {};
|
| +
|
| + 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 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;
|
| + virtual gfx::Rect ConvertRectToScreen(const gfx::Rect& rect) const = 0;
|
| +};
|
| +
|
| +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 HandleGestureEvent(GestureEvent* event);
|
| + void HandleTouchEvent(TouchEvent* event);
|
| + void HideAndDisallowShowingAutomatically();
|
| + void OnWindowMoved();
|
| + void OnOverscrollStarted();
|
| + void OnOverscrollCompleted();
|
| + void OnFlingCompleted();
|
| +
|
| + const SelectionBound& start() const { return controller_->start(); }
|
| + const SelectionBound& end() const { return controller_->end(); }
|
| +
|
| + private:
|
| + friend class TouchSelectionControllerAuraTest;
|
| +
|
| + gfx::Rect GetAnchorRect() const;
|
| + void ShowQuickMenu();
|
| + void UpdateQuickMenu();
|
| + bool IsQuickMenuAllowed() const;
|
| +
|
| + // Overriden from 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;
|
| +
|
| + // Overriden from TouchSelectionMenuClient.
|
| + bool IsCommandIdEnabled(int command_id) const override;
|
| + void ExecuteCommand(int command_id, int event_flags) override;
|
| + void OpenContextMenu() override;
|
| +
|
| + // Overriden from EventHandler.
|
| + void OnKeyEvent(KeyEvent* event) override;
|
| + void OnMouseEvent(MouseEvent* event) override;
|
| + void OnScrollEvent(ScrollEvent* event) override;
|
| +
|
| + TouchSelectionController* controller_for_testing() const {
|
| + return controller_.get();
|
| + }
|
| +
|
| + void set_immediate_quick_menu_for_testing(bool immediate) {
|
| + immediate_quick_menu_for_testing_ = immediate;
|
| + }
|
| +
|
| + TouchSelectionControllerAuraClient* client_;
|
| + scoped_ptr<MotionEventAura> motion_event_;
|
| + scoped_ptr<TouchSelectionController> controller_;
|
| + base::OneShotTimer<TouchSelectionControllerAura> quick_menu_timer_;
|
| + bool scroll_in_progress_;
|
| + bool overscroll_in_progress_;
|
| + bool handle_drag_in_progress_;
|
| +
|
| + bool immediate_quick_menu_for_testing_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(TouchSelectionControllerAura);
|
| +};
|
| +
|
| +} // namespace ui
|
| +
|
| +#endif // UI_TOUCH_SELECTION_TOUCH_SELECTION_CONTROLLER_AURA_H_
|
|
|