| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 2749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2760 #endif | 2760 #endif |
| 2761 | 2761 |
| 2762 target_host->ForwardKeyboardEvent(event); | 2762 target_host->ForwardKeyboardEvent(event); |
| 2763 } | 2763 } |
| 2764 | 2764 |
| 2765 void RenderWidgetHostViewAura::SelectionUpdated( | 2765 void RenderWidgetHostViewAura::SelectionUpdated( |
| 2766 bool is_editable, | 2766 bool is_editable, |
| 2767 bool is_empty_text_form_control, | 2767 bool is_empty_text_form_control, |
| 2768 const gfx::SelectionBound& start, | 2768 const gfx::SelectionBound& start, |
| 2769 const gfx::SelectionBound& end) { | 2769 const gfx::SelectionBound& end) { |
| 2770 selection_controller_->OnSelectionEditable(is_editable); | |
| 2771 selection_controller_->OnSelectionEmpty(is_empty_text_form_control); | |
| 2772 selection_controller_->OnSelectionBoundsChanged(start, end); | 2770 selection_controller_->OnSelectionBoundsChanged(start, end); |
| 2773 } | 2771 } |
| 2774 | 2772 |
| 2775 void RenderWidgetHostViewAura::CreateSelectionController() { | 2773 void RenderWidgetHostViewAura::CreateSelectionController() { |
| 2776 ui::TouchSelectionController::Config tsc_config; | 2774 ui::TouchSelectionController::Config tsc_config; |
| 2777 tsc_config.max_tap_duration = base::TimeDelta::FromMilliseconds( | 2775 tsc_config.max_tap_duration = base::TimeDelta::FromMilliseconds( |
| 2778 ui::GestureConfiguration::GetInstance()->long_press_time_in_ms()); | 2776 ui::GestureConfiguration::GetInstance()->long_press_time_in_ms()); |
| 2779 tsc_config.tap_slop = ui::GestureConfiguration::GetInstance() | 2777 tsc_config.tap_slop = ui::GestureConfiguration::GetInstance() |
| 2780 ->max_touch_move_in_pixels_for_click(); | 2778 ->max_touch_move_in_pixels_for_click(); |
| 2781 tsc_config.enable_longpress_drag_selection = false; | 2779 tsc_config.enable_longpress_drag_selection = false; |
| 2782 selection_controller_.reset(new ui::TouchSelectionController( | 2780 selection_controller_.reset(new ui::TouchSelectionController( |
| 2783 selection_controller_client_.get(), tsc_config)); | 2781 selection_controller_client_.get(), tsc_config)); |
| 2784 } | 2782 } |
| 2785 | 2783 |
| 2786 void RenderWidgetHostViewAura::HandleGestureForTouchSelection( | 2784 void RenderWidgetHostViewAura::HandleGestureForTouchSelection( |
| 2787 ui::GestureEvent* event) { | 2785 ui::GestureEvent* event) { |
| 2788 switch (event->type()) { | 2786 switch (event->type()) { |
| 2789 case ui::ET_GESTURE_LONG_PRESS: | 2787 case ui::ET_GESTURE_LONG_PRESS: |
| 2790 if (selection_controller_->WillHandleLongPressEvent( | 2788 selection_controller_->WillHandleLongPressEvent( |
| 2791 event->time_stamp(), event->location_f())) { | 2789 event->time_stamp(), event->location_f()); |
| 2792 event->SetHandled(); | |
| 2793 } | |
| 2794 break; | 2790 break; |
| 2795 case ui::ET_GESTURE_TAP: | 2791 case ui::ET_GESTURE_TAP: |
| 2796 if (selection_controller_->WillHandleTapEvent( | 2792 selection_controller_->WillHandleTapEvent( |
| 2797 event->location_f(), event->details().tap_count())) { | 2793 event->location_f(), event->details().tap_count()); |
| 2798 event->SetHandled(); | |
| 2799 } | |
| 2800 break; | 2794 break; |
| 2801 case ui::ET_GESTURE_SCROLL_BEGIN: | 2795 case ui::ET_GESTURE_SCROLL_BEGIN: |
| 2802 selection_controller_client_->OnScrollStarted(); | 2796 selection_controller_client_->OnScrollStarted(); |
| 2803 break; | 2797 break; |
| 2804 case ui::ET_GESTURE_SCROLL_END: | 2798 case ui::ET_GESTURE_SCROLL_END: |
| 2805 selection_controller_client_->OnScrollCompleted(); | 2799 selection_controller_client_->OnScrollCompleted(); |
| 2806 break; | 2800 break; |
| 2807 #if defined(OS_WIN) | 2801 #if defined(OS_WIN) |
| 2808 case ui::ET_GESTURE_LONG_TAP: { | 2802 case ui::ET_GESTURE_LONG_TAP: { |
| 2809 if (!last_context_menu_params_) | 2803 if (!last_context_menu_params_) |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3064 ->GetTextSelection(focused_view) | 3058 ->GetTextSelection(focused_view) |
| 3065 ->GetSelectedText(&selected_text)) { | 3059 ->GetSelectedText(&selected_text)) { |
| 3066 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. | 3060 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. |
| 3067 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); | 3061 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); |
| 3068 clipboard_writer.WriteText(selected_text); | 3062 clipboard_writer.WriteText(selected_text); |
| 3069 } | 3063 } |
| 3070 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) | 3064 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) |
| 3071 } | 3065 } |
| 3072 | 3066 |
| 3073 } // namespace content | 3067 } // namespace content |
| OLD | NEW |