| Index: ui/touch_selection/touch_selection_controller_impl.h
|
| diff --git a/ui/touch_selection/touch_selection_controller_impl.h b/ui/touch_selection/touch_selection_controller_impl.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..9cb7498a997d372a3defcb6b7846e7ec8f6218c7
|
| --- /dev/null
|
| +++ b/ui/touch_selection/touch_selection_controller_impl.h
|
| @@ -0,0 +1,126 @@
|
| +// 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__IMPL_H_
|
| +#define UI_TOUCH_SELECTION_TOUCH_SELECTION_CONTROLLER__IMPL_H_
|
| +
|
| +#include "base/timer/timer.h"
|
| +#include "ui/touch_selection/touch_selection_controller.h"
|
| +
|
| +namespace ui {
|
| +
|
| +class UI_TOUCH_SELECTION_EXPORT TouchSelectionControllerImpl
|
| + : public TouchSelectionController {
|
| + public:
|
| + TouchSelectionControllerImpl(TouchSelectionControllerClient* client,
|
| + base::TimeDelta tap_timeout,
|
| + float tap_slop,
|
| + bool show_on_tap_for_empty_editable);
|
| + ~TouchSelectionControllerImpl() override;
|
| +
|
| + // TouchSelectionController:
|
| + bool OnSelectionBoundsUpdated(const SelectionBound& start,
|
| + const SelectionBound& end) override;
|
| + bool WillHandleTouchEvent(const MotionEvent& event) override;
|
| + void OnTapEvent() override;
|
| + void OnLongPressEvent() override;
|
| + void AllowShowingFromCurrentSelection() override;
|
| + void HideAndDisallowShowingAutomatically() override;
|
| + void SetTemporarilyHidden(bool hidden) override;
|
| + void OnSelectionEditable(bool editable) override;
|
| + void OnSelectionEmpty(bool empty) override;
|
| + bool Animate(base::TimeTicks animate_time) override;
|
| + gfx::Rect GetRectBetweenBounds() const override;
|
| + void OnNativeViewMoved() override;
|
| + void OnOverscrollStarted() override;
|
| + void OnOverscrollCompleted() override;
|
| +
|
| + protected:
|
| + TouchSelectionControllerClient* client() const { return client_; }
|
| +
|
| + const SelectionBound& start() const { return start_; }
|
| + const SelectionBound& end() const { return end_; }
|
| +
|
| + bool is_insertion_active() const { return is_insertion_active_; }
|
| + bool is_selection_active() const { return is_selection_active_; }
|
| + bool is_selection_editable() const { return selection_editable_; }
|
| +
|
| +
|
| + virtual void ActivateInsertion();
|
| + virtual void DeactivateInsertion();
|
| + virtual void ActivateSelection();
|
| + virtual void DeactivateSelection();
|
| +
|
| + private:
|
| + enum InputEventType { TAP, LONG_PRESS, INPUT_EVENT_TYPE_NONE };
|
| +
|
| + // TouchHandleClient:
|
| + void OnHandleDragBegin(const TouchHandle& handle) override;
|
| + void OnHandleDragUpdate(const TouchHandle& handle,
|
| + const gfx::PointF& new_position) override;
|
| + void OnHandleDragEnd(const TouchHandle& handle) override;
|
| + void OnHandleTapped(const TouchHandle& handle) override;
|
| + void SetNeedsAnimate() override;
|
| + scoped_ptr<TouchHandleDrawable> CreateDrawable() override;
|
| + base::TimeDelta GetTapTimeout() const override;
|
| + float GetTapSlop() const override;
|
| +
|
| + void ShowInsertionHandleAutomatically();
|
| + void ShowSelectionHandlesAutomatically();
|
| +
|
| + void OnInsertionChanged();
|
| + void OnSelectionChanged();
|
| +
|
| + void ResetCachedValuesIfInactive();
|
| +
|
| + const gfx::PointF& GetStartPosition() const;
|
| + const gfx::PointF& GetEndPosition() const;
|
| + gfx::Vector2dF GetStartLineOffset() const;
|
| + gfx::Vector2dF GetEndLineOffset() const;
|
| + bool GetStartVisible() const;
|
| + bool GetEndVisible() const;
|
| + TouchHandle::AnimationStyle GetAnimationStyle(bool was_active) const;
|
| +
|
| + void LogSelectionEnd();
|
| +
|
| + TouchSelectionControllerClient* const client_;
|
| + const base::TimeDelta tap_timeout_;
|
| + const float tap_slop_;
|
| +
|
| + // Controls whether an insertion handle is shown on a tap for an empty
|
| + // editable text.
|
| + bool show_on_tap_for_empty_editable_;
|
| +
|
| + InputEventType response_pending_input_event_;
|
| +
|
| + SelectionBound start_;
|
| + SelectionBound end_;
|
| + TouchHandleOrientation start_orientation_;
|
| + TouchHandleOrientation end_orientation_;
|
| +
|
| + scoped_ptr<TouchHandle> insertion_handle_;
|
| + bool is_insertion_active_;
|
| + bool activate_insertion_automatically_;
|
| +
|
| + scoped_ptr<TouchHandle> start_selection_handle_;
|
| + scoped_ptr<TouchHandle> end_selection_handle_;
|
| + bool is_selection_active_;
|
| + bool activate_selection_automatically_;
|
| +
|
| + bool selection_empty_;
|
| + bool selection_editable_;
|
| +
|
| + bool temporarily_hidden_;
|
| +
|
| + base::TimeTicks selection_start_time_;
|
| + // Whether a selection handle was dragged during the current 'selection
|
| + // session' - i.e. since the current selection has been activated.
|
| + bool selection_handle_was_dragged_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(TouchSelectionControllerImpl);
|
| +};
|
| +
|
| +} // namespace ui
|
| +
|
| +#endif // UI_TOUCH_SELECTION_TOUCH_SELECTION_CONTROLLER__IMPL_H_
|
|
|