OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/views/touchui/touch_selection_controller_impl.h" | 5 #include "ui/views/touchui/touch_selection_controller_impl.h" |
6 | 6 |
7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
8 #include "ui/aura/client/cursor_client.h" | 8 #include "ui/aura/client/cursor_client.h" |
9 #include "ui/aura/env.h" | 9 #include "ui/aura/env.h" |
10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
430 EditingHandleView* handle) { | 430 EditingHandleView* handle) { |
431 dragging_handle_ = handle; | 431 dragging_handle_ = handle; |
432 if (dragging_handle_) | 432 if (dragging_handle_) |
433 HideContextMenu(); | 433 HideContextMenu(); |
434 else | 434 else |
435 StartContextMenuTimer(); | 435 StartContextMenuTimer(); |
436 } | 436 } |
437 | 437 |
438 void TouchSelectionControllerImpl::SelectionHandleDragged( | 438 void TouchSelectionControllerImpl::SelectionHandleDragged( |
439 const gfx::Point& drag_pos) { | 439 const gfx::Point& drag_pos) { |
440 // We do not want to show the context menu while dragging. | |
441 HideContextMenu(); | |
oshima
2014/09/04 00:23:35
are these change intentional?
mohsen
2014/09/04 14:57:22
Yes. These are not needed. For this case, context
| |
442 | |
443 DCHECK(dragging_handle_); | 440 DCHECK(dragging_handle_); |
444 gfx::Point drag_pos_in_client = drag_pos; | 441 gfx::Point drag_pos_in_client = drag_pos; |
445 ConvertPointToClientView(dragging_handle_, &drag_pos_in_client); | 442 ConvertPointToClientView(dragging_handle_, &drag_pos_in_client); |
446 | 443 |
447 if (dragging_handle_ == cursor_handle_.get()) { | 444 if (dragging_handle_ == cursor_handle_.get()) { |
448 client_view_->MoveCaretTo(drag_pos_in_client); | 445 client_view_->MoveCaretTo(drag_pos_in_client); |
449 return; | 446 return; |
450 } | 447 } |
451 | 448 |
452 // Find the stationary selection handle. | 449 // Find the stationary selection handle. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
514 | 511 |
515 void TouchSelectionControllerImpl::OnWidgetClosing(Widget* widget) { | 512 void TouchSelectionControllerImpl::OnWidgetClosing(Widget* widget) { |
516 DCHECK_EQ(client_widget_, widget); | 513 DCHECK_EQ(client_widget_, widget); |
517 client_widget_ = NULL; | 514 client_widget_ = NULL; |
518 } | 515 } |
519 | 516 |
520 void TouchSelectionControllerImpl::OnWidgetBoundsChanged( | 517 void TouchSelectionControllerImpl::OnWidgetBoundsChanged( |
521 Widget* widget, | 518 Widget* widget, |
522 const gfx::Rect& new_bounds) { | 519 const gfx::Rect& new_bounds) { |
523 DCHECK_EQ(client_widget_, widget); | 520 DCHECK_EQ(client_widget_, widget); |
524 HideContextMenu(); | |
525 SelectionChanged(); | 521 SelectionChanged(); |
526 } | 522 } |
527 | 523 |
528 void TouchSelectionControllerImpl::OnKeyEvent(ui::KeyEvent* event) { | 524 void TouchSelectionControllerImpl::OnKeyEvent(ui::KeyEvent* event) { |
529 client_view_->DestroyTouchSelection(); | 525 client_view_->DestroyTouchSelection(); |
530 } | 526 } |
531 | 527 |
532 void TouchSelectionControllerImpl::OnMouseEvent(ui::MouseEvent* event) { | 528 void TouchSelectionControllerImpl::OnMouseEvent(ui::MouseEvent* event) { |
533 aura::client::CursorClient* cursor_client = aura::client::GetCursorClient( | 529 aura::client::CursorClient* cursor_client = aura::client::GetCursorClient( |
534 client_view_->GetNativeView()->GetRootWindow()); | 530 client_view_->GetNativeView()->GetRootWindow()); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
621 | 617 |
622 bool TouchSelectionControllerImpl::IsSelectionHandle2Visible() { | 618 bool TouchSelectionControllerImpl::IsSelectionHandle2Visible() { |
623 return selection_handle_2_->IsWidgetVisible(); | 619 return selection_handle_2_->IsWidgetVisible(); |
624 } | 620 } |
625 | 621 |
626 bool TouchSelectionControllerImpl::IsCursorHandleVisible() { | 622 bool TouchSelectionControllerImpl::IsCursorHandleVisible() { |
627 return cursor_handle_->IsWidgetVisible(); | 623 return cursor_handle_->IsWidgetVisible(); |
628 } | 624 } |
629 | 625 |
630 } // namespace views | 626 } // namespace views |
OLD | NEW |