| Index: content/browser/renderer_host/input/touch_selection_controller_client_aura.cc
|
| diff --git a/content/browser/renderer_host/input/touch_selection_controller_client_aura.cc b/content/browser/renderer_host/input/touch_selection_controller_client_aura.cc
|
| index 1bf91a5447060e31afbc5159cc7474d592c4993d..aa6b518630c5814ca67d8ca3df5284f60fb877b8 100644
|
| --- a/content/browser/renderer_host/input/touch_selection_controller_client_aura.cc
|
| +++ b/content/browser/renderer_host/input/touch_selection_controller_client_aura.cc
|
| @@ -47,68 +47,6 @@ gfx::Rect ConvertRectToScreen(aura::Window* window, const gfx::RectF& rect) {
|
|
|
| } // namespace
|
|
|
| -// A pre-target event handler for aura::Env which deactivates touch selection on
|
| -// mouse and keyboard events.
|
| -class TouchSelectionControllerClientAura::EnvPreTargetHandler
|
| - : public ui::EventHandler {
|
| - public:
|
| - EnvPreTargetHandler(ui::TouchSelectionController* selection_controller,
|
| - aura::Window* window);
|
| - ~EnvPreTargetHandler() override;
|
| -
|
| - private:
|
| - // EventHandler:
|
| - void OnKeyEvent(ui::KeyEvent* event) override;
|
| - void OnMouseEvent(ui::MouseEvent* event) override;
|
| - void OnScrollEvent(ui::ScrollEvent* event) override;
|
| -
|
| - ui::TouchSelectionController* selection_controller_;
|
| - aura::Window* window_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(EnvPreTargetHandler);
|
| -};
|
| -
|
| -TouchSelectionControllerClientAura::EnvPreTargetHandler::EnvPreTargetHandler(
|
| - ui::TouchSelectionController* selection_controller,
|
| - aura::Window* window)
|
| - : selection_controller_(selection_controller), window_(window) {
|
| - aura::Env::GetInstance()->AddPreTargetHandler(this);
|
| -}
|
| -
|
| -TouchSelectionControllerClientAura::EnvPreTargetHandler::
|
| - ~EnvPreTargetHandler() {
|
| - aura::Env::GetInstance()->RemovePreTargetHandler(this);
|
| -}
|
| -
|
| -void TouchSelectionControllerClientAura::EnvPreTargetHandler::OnKeyEvent(
|
| - ui::KeyEvent* event) {
|
| - DCHECK_NE(ui::TouchSelectionController::INACTIVE,
|
| - selection_controller_->active_status());
|
| -
|
| - selection_controller_->HideAndDisallowShowingAutomatically();
|
| -}
|
| -
|
| -void TouchSelectionControllerClientAura::EnvPreTargetHandler::OnMouseEvent(
|
| - ui::MouseEvent* event) {
|
| - DCHECK_NE(ui::TouchSelectionController::INACTIVE,
|
| - selection_controller_->active_status());
|
| -
|
| - // If mouse events are not enabled, this mouse event is synthesized from a
|
| - // touch event in which case we don't want to deactivate touch selection.
|
| - aura::client::CursorClient* cursor_client =
|
| - aura::client::GetCursorClient(window_->GetRootWindow());
|
| - if (!cursor_client || cursor_client->IsMouseEventsEnabled())
|
| - selection_controller_->HideAndDisallowShowingAutomatically();
|
| -}
|
| -
|
| -void TouchSelectionControllerClientAura::EnvPreTargetHandler::OnScrollEvent(
|
| - ui::ScrollEvent* event) {
|
| - DCHECK_NE(ui::TouchSelectionController::INACTIVE,
|
| - selection_controller_->active_status());
|
| -
|
| - selection_controller_->HideAndDisallowShowingAutomatically();
|
| -}
|
| -
|
| TouchSelectionControllerClientAura::TouchSelectionControllerClientAura(
|
| RenderWidgetHostViewAura* rwhva)
|
| : rwhva_(rwhva),
|
| @@ -157,10 +95,9 @@ void TouchSelectionControllerClientAura::OnScrollCompleted() {
|
| bool TouchSelectionControllerClientAura::HandleContextMenu(
|
| const ContextMenuParams& params) {
|
| if (params.source_type == ui::MENU_SOURCE_LONG_PRESS &&
|
| - rwhva_->selection_controller()->insertion_active_or_requested() &&
|
| + params.is_editable &&
|
| + params.selection_text.empty() &&
|
| IsQuickMenuAvailable()) {
|
| - DCHECK(params.is_editable);
|
| - DCHECK(params.selection_text.empty());
|
| quick_menu_requested_ = true;
|
| UpdateQuickMenu();
|
| return true;
|
| @@ -273,12 +210,9 @@ void TouchSelectionControllerClientAura::OnSelectionEvent(
|
| // Fall through.
|
| case ui::INSERTION_HANDLE_SHOWN:
|
| UpdateQuickMenu();
|
| - env_pre_target_handler_.reset(new EnvPreTargetHandler(
|
| - rwhva_->selection_controller(), rwhva_->GetNativeView()));
|
| break;
|
| case ui::SELECTION_HANDLES_CLEARED:
|
| case ui::INSERTION_HANDLE_CLEARED:
|
| - env_pre_target_handler_.reset();
|
| quick_menu_requested_ = false;
|
| UpdateQuickMenu();
|
| break;
|
| @@ -300,9 +234,6 @@ void TouchSelectionControllerClientAura::OnSelectionEvent(
|
| quick_menu_requested_ = !quick_menu_requested_;
|
| UpdateQuickMenu();
|
| break;
|
| - case ui::SELECTION_ESTABLISHED:
|
| - case ui::SELECTION_DISSOLVED:
|
| - break;
|
| };
|
| }
|
|
|
|
|