| Index: content/browser/renderer_host/touch_selection_controller_aura.h
|
| diff --git a/content/browser/renderer_host/touch_selection_controller_aura.h b/content/browser/renderer_host/touch_selection_controller_aura.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..a5edd2a88a883a6448d034b5580e071825c11e34
|
| --- /dev/null
|
| +++ b/content/browser/renderer_host/touch_selection_controller_aura.h
|
| @@ -0,0 +1,111 @@
|
| +// 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 CONTENT_BROWSER_RENDERER_HOST_TOUCH_SELECTION_CONTROLLER_AURA_H_
|
| +#define CONTENT_BROWSER_RENDERER_HOST_TOUCH_SELECTION_CONTROLLER_AURA_H_
|
| +
|
| +#include <set>
|
| +
|
| +#include "base/timer/timer.h"
|
| +#include "cc/output/viewport_selection_bound.h"
|
| +#include "content/browser/renderer_host/input/touch_selection_controller.h"
|
| +#include "ui/views/touchui/touch_editing_menu.h"
|
| +
|
| +namespace aura {
|
| +class Window;
|
| +}
|
| +
|
| +namespace ui {
|
| +class MotionEventAura;
|
| +class TouchEvent;
|
| +}
|
| +
|
| +namespace content {
|
| +
|
| +class TouchSelectionControllerAuraClient {
|
| + public:
|
| + virtual float GetDeviceScaleFactor() = 0;
|
| + virtual void MoveCaret(const gfx::PointF& position) = 0;
|
| + virtual void SelectBetweenCoordinates(const gfx::PointF& start,
|
| + const gfx::PointF& end) = 0;
|
| + virtual aura::Window* GetParentWindow() = 0;
|
| + virtual bool IsCommandIdEnabled(int command_id) = 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::RectF& rect) const = 0;
|
| +};
|
| +
|
| +class TouchSelectionControllerAura : public TouchSelectionControllerClient,
|
| + public views::TouchEditingMenuController,
|
| + public ui::EventHandler {
|
| + public:
|
| + explicit TouchSelectionControllerAura(
|
| + TouchSelectionControllerAuraClient* client);
|
| + virtual ~TouchSelectionControllerAura();
|
| +
|
| + //void SetTemporarilyHidden(bool hidden);
|
| + void OnSelectionEditable(bool editable);
|
| + void OnSelectionEmpty(bool empty);
|
| + void OnSelectionBoundsChanged(const cc::ViewportSelectionBound& start,
|
| + const cc::ViewportSelectionBound& end);
|
| + void HandleGestureEvent(ui::GestureEvent* event);
|
| + void HideAndDisallowShowingAutomatically();
|
| + void HandleTouchEvent(ui::TouchEvent* event);
|
| + void OnWindowMoved();
|
| + void OnOverscrollStarted();
|
| + void OnOverscrollCompleted();
|
| + void OnFlingCompleted();
|
| +
|
| + gfx::RectF GetCaretBounds() const;
|
| +
|
| + const cc::ViewportSelectionBound& start() const { return start_; }
|
| + const cc::ViewportSelectionBound& end() const { return end_; }
|
| +
|
| + private:
|
| + gfx::RectF GetStartRect() const;
|
| + gfx::RectF GetEndRect() const;
|
| + gfx::RectF GetBoundingRect() const;
|
| + gfx::RectF GetAnchorRect() const;
|
| + void QuickMenuTimerFired();
|
| + void UpdateQuickMenu();
|
| + bool IsQuickMenuAllowed() const;
|
| +
|
| + // Overriden from TouchSelectionControllerClient.
|
| + virtual bool SupportsAnimation() const override;
|
| + virtual void SetNeedsAnimate() override;
|
| + virtual void MoveCaret(const gfx::PointF& position) override;
|
| + virtual void SelectBetweenCoordinates(const gfx::PointF& start,
|
| + const gfx::PointF& end) override;
|
| + virtual void OnSelectionEvent(SelectionEventType event,
|
| + const gfx::PointF& position) override;
|
| + virtual scoped_ptr<TouchHandleDrawable> CreateDrawable() override;
|
| +
|
| + // Overriden from views::TouchEditingMenuController.
|
| + virtual bool IsCommandIdEnabled(int command_id) const override;
|
| + virtual void ExecuteCommand(int command_id, int event_flags) override;
|
| + virtual void OpenContextMenu() override;
|
| + virtual void OnMenuClosed(views::TouchEditingMenuView* menu) override;
|
| +
|
| + // Overriden from ui::EventHandler.
|
| + virtual void OnKeyEvent(ui::KeyEvent* event) override;
|
| + virtual void OnMouseEvent(ui::MouseEvent* event) override;
|
| + virtual void OnScrollEvent(ui::ScrollEvent* event) override;
|
| +
|
| + TouchSelectionControllerAuraClient* client_;
|
| + scoped_ptr<ui::MotionEventAura> motion_event_;
|
| + scoped_ptr<TouchSelectionController> controller_;
|
| + base::OneShotTimer<TouchSelectionControllerAura> quick_menu_timer_;
|
| + views::TouchEditingMenuView* quick_menu_;
|
| + bool scroll_in_progress_;
|
| + bool overscroll_in_progress_;
|
| + bool handle_drag_in_progress_;
|
| + cc::ViewportSelectionBound start_;
|
| + cc::ViewportSelectionBound end_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(TouchSelectionControllerAura);
|
| +};
|
| +
|
| +}
|
| +
|
| +#endif // CONTENT_BROWSER_RENDERER_HOST_TOUCH_SELECTION_CONTROLLER_AURA_H_
|
|
|