#include "ui/views/touchui/touch_selection_controller_impl.h"
#include <set>
#include <utility>
#include "base/check_op.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/raw_ptr_exclusion.h"
#include "base/notreached.h"
#include "base/time/time.h"
#include "ui/aura/client/cursor_client.h"
#include "ui/aura/env.h"
#include "ui/aura/window.h"
#include "ui/aura/window_targeter.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/models/image_model.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_features.h"
#include "ui/color/color_id.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/image/image.h"
#include "ui/resources/grit/ui_resources.h"
#include "ui/touch_selection/touch_selection_magnifier_aura.h"
#include "ui/touch_selection/touch_selection_metrics.h"
#include "ui/touch_selection/vector_icons/vector_icons.h"
#include "ui/views/view_utils.h"
#include "ui/views/views_delegate.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_delegate.h"
#include "ui/wm/core/coordinate_conversion.h"
namespace {
constexpr int kSelectionHandleVerticalDragOffset = …;
constexpr int kSelectionHandleBarMinHeight = …;
constexpr int kSelectionHandleBarBottomAllowance = …;
constexpr float kSelectionHandleOpacity = …;
constexpr int kQuickMenuDelayInMs = …;
constexpr int kSelectionHandleVerticalOffset = …;
int GetSelectionHandleVerticalOffset() { … }
constexpr int kSelectionHandleHorizontalPadding = …;
constexpr int kSelectionHandleBottomPadding = …;
constexpr int kSelectionHandlePadding = …;
int GetSelectionHandleHorizontalPadding() { … }
int GetSelectionHandleBottomPadding() { … }
gfx::Image* GetCenterHandleImage() { … }
gfx::Image* GetLeftHandleImage() { … }
gfx::Image* GetRightHandleImage() { … }
gfx::Image* GetHandleImage(gfx::SelectionBound::Type bound_type) { … }
ui::ImageModel GetHandleVectorIcon(gfx::SelectionBound::Type bound_type) { … }
ui::ImageModel GetHandleImageModel(gfx::SelectionBound::Type bound_type) { … }
gfx::Rect GetSelectionWidgetBounds(const gfx::SelectionBound& bound) { … }
gfx::Size GetMaxHandleImageSize() { … }
gfx::SelectionBound ConvertFromScreen(ui::TouchEditable* client,
const gfx::SelectionBound& bound) { … }
gfx::SelectionBound ConvertToScreen(ui::TouchEditable* client,
const gfx::SelectionBound& bound) { … }
gfx::Rect BoundToRect(const gfx::SelectionBound& bound) { … }
std::unique_ptr<views::Widget> CreateHandleWidget(gfx::NativeView parent) { … }
}
namespace views {
EditingHandleView;
class TouchSelectionControllerImpl::EditingHandleView : public View { … };
BEGIN_METADATA(…)
TouchSelectionControllerImpl::TouchSelectionControllerImpl(
ui::TouchEditable* client_view)
: … { … }
TouchSelectionControllerImpl::~TouchSelectionControllerImpl() { … }
void TouchSelectionControllerImpl::SelectionChanged() { … }
void TouchSelectionControllerImpl::ToggleQuickMenu() { … }
void TouchSelectionControllerImpl::ShowQuickMenuImmediatelyForTesting() { … }
void TouchSelectionControllerImpl::OnDragBegin(EditingHandleView* handle) { … }
void TouchSelectionControllerImpl::OnDragUpdate(EditingHandleView* handle,
const gfx::Point& drag_pos) { … }
void TouchSelectionControllerImpl::OnDragEnd() { … }
void TouchSelectionControllerImpl::ConvertPointToClientView(
EditingHandleView* source,
gfx::Point* point) { … }
void TouchSelectionControllerImpl::SetHandleBound(
EditingHandleView* handle,
const gfx::SelectionBound& bound,
const gfx::SelectionBound& bound_in_screen) { … }
bool TouchSelectionControllerImpl::ShouldShowHandleFor(
const gfx::SelectionBound& bound) const { … }
bool TouchSelectionControllerImpl::IsCommandIdEnabled(int command_id) const { … }
void TouchSelectionControllerImpl::ExecuteCommand(int command_id,
int event_flags) { … }
void TouchSelectionControllerImpl::RunContextMenu() { … }
bool TouchSelectionControllerImpl::ShouldShowQuickMenu() { … }
std::u16string TouchSelectionControllerImpl::GetSelectedText() { … }
void TouchSelectionControllerImpl::OnWidgetDestroying(Widget* widget) { … }
void TouchSelectionControllerImpl::OnWidgetBoundsChanged(
Widget* widget,
const gfx::Rect& new_bounds) { … }
void TouchSelectionControllerImpl::OnEvent(const ui::Event& event) { … }
void TouchSelectionControllerImpl::QuickMenuTimerFired() { … }
void TouchSelectionControllerImpl::StartQuickMenuTimer() { … }
void TouchSelectionControllerImpl::UpdateQuickMenu() { … }
void TouchSelectionControllerImpl::HideQuickMenu() { … }
gfx::Rect TouchSelectionControllerImpl::GetQuickMenuAnchorRect() const { … }
void TouchSelectionControllerImpl::ShowMagnifier(
const gfx::SelectionBound& focus_bound_in_screen) { … }
void TouchSelectionControllerImpl::HideMagnifier() { … }
void TouchSelectionControllerImpl::CreateHandleWidgets() { … }
EditingHandleView* TouchSelectionControllerImpl::GetSelectionHandle1() { … }
EditingHandleView* TouchSelectionControllerImpl::GetSelectionHandle2() { … }
EditingHandleView* TouchSelectionControllerImpl::GetCursorHandle() { … }
EditingHandleView* TouchSelectionControllerImpl::GetDraggingHandle() { … }
gfx::NativeView TouchSelectionControllerImpl::GetCursorHandleNativeView() { … }
gfx::SelectionBound::Type
TouchSelectionControllerImpl::GetSelectionHandle1Type() { … }
gfx::Rect TouchSelectionControllerImpl::GetSelectionHandle1Bounds() { … }
gfx::Rect TouchSelectionControllerImpl::GetSelectionHandle2Bounds() { … }
gfx::Rect TouchSelectionControllerImpl::GetCursorHandleBounds() { … }
bool TouchSelectionControllerImpl::IsSelectionHandle1Visible() { … }
bool TouchSelectionControllerImpl::IsSelectionHandle2Visible() { … }
bool TouchSelectionControllerImpl::IsCursorHandleVisible() { … }
gfx::Rect TouchSelectionControllerImpl::GetExpectedHandleBounds(
const gfx::SelectionBound& bound) { … }
View* TouchSelectionControllerImpl::GetHandle1View() { … }
View* TouchSelectionControllerImpl::GetHandle2View() { … }
}
DEFINE_ENUM_CONVERTERS(…)