| 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 2765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2776 #endif | 2776 #endif |
| 2777 | 2777 |
| 2778 target_host->ForwardKeyboardEvent(event); | 2778 target_host->ForwardKeyboardEvent(event); |
| 2779 } | 2779 } |
| 2780 | 2780 |
| 2781 void RenderWidgetHostViewAura::SelectionUpdated( | 2781 void RenderWidgetHostViewAura::SelectionUpdated( |
| 2782 bool is_editable, | 2782 bool is_editable, |
| 2783 bool is_empty_text_form_control, | 2783 bool is_empty_text_form_control, |
| 2784 const gfx::SelectionBound& start, | 2784 const gfx::SelectionBound& start, |
| 2785 const gfx::SelectionBound& end) { | 2785 const gfx::SelectionBound& end) { |
| 2786 selection_controller_->OnSelectionEditable(is_editable); | |
| 2787 selection_controller_->OnSelectionEmpty(is_empty_text_form_control); | |
| 2788 selection_controller_->OnSelectionBoundsChanged(start, end); | 2786 selection_controller_->OnSelectionBoundsChanged(start, end); |
| 2789 } | 2787 } |
| 2790 | 2788 |
| 2791 void RenderWidgetHostViewAura::CreateSelectionController() { | 2789 void RenderWidgetHostViewAura::CreateSelectionController() { |
| 2792 ui::TouchSelectionController::Config tsc_config; | 2790 ui::TouchSelectionController::Config tsc_config; |
| 2793 tsc_config.max_tap_duration = base::TimeDelta::FromMilliseconds( | 2791 tsc_config.max_tap_duration = base::TimeDelta::FromMilliseconds( |
| 2794 ui::GestureConfiguration::GetInstance()->long_press_time_in_ms()); | 2792 ui::GestureConfiguration::GetInstance()->long_press_time_in_ms()); |
| 2795 tsc_config.tap_slop = ui::GestureConfiguration::GetInstance() | 2793 tsc_config.tap_slop = ui::GestureConfiguration::GetInstance() |
| 2796 ->max_touch_move_in_pixels_for_click(); | 2794 ->max_touch_move_in_pixels_for_click(); |
| 2797 tsc_config.enable_longpress_drag_selection = false; | 2795 tsc_config.enable_longpress_drag_selection = false; |
| 2798 selection_controller_.reset(new ui::TouchSelectionController( | 2796 selection_controller_.reset(new ui::TouchSelectionController( |
| 2799 selection_controller_client_.get(), tsc_config)); | 2797 selection_controller_client_.get(), tsc_config)); |
| 2800 } | 2798 } |
| 2801 | 2799 |
| 2802 void RenderWidgetHostViewAura::HandleGestureForTouchSelection( | 2800 void RenderWidgetHostViewAura::HandleGestureForTouchSelection( |
| 2803 ui::GestureEvent* event) { | 2801 ui::GestureEvent* event) { |
| 2804 switch (event->type()) { | 2802 switch (event->type()) { |
| 2805 case ui::ET_GESTURE_LONG_PRESS: | 2803 case ui::ET_GESTURE_LONG_PRESS: |
| 2806 if (selection_controller_->WillHandleLongPressEvent( | 2804 selection_controller_->WillHandleLongPressEvent( |
| 2807 event->time_stamp(), event->location_f())) { | 2805 event->time_stamp(), event->location_f()); |
| 2808 event->SetHandled(); | |
| 2809 } | |
| 2810 break; | 2806 break; |
| 2811 case ui::ET_GESTURE_TAP: | 2807 case ui::ET_GESTURE_TAP: |
| 2812 if (selection_controller_->WillHandleTapEvent( | 2808 selection_controller_->WillHandleTapEvent( |
| 2813 event->location_f(), event->details().tap_count())) { | 2809 event->location_f(), event->details().tap_count()); |
| 2814 event->SetHandled(); | |
| 2815 } | |
| 2816 break; | 2810 break; |
| 2817 case ui::ET_GESTURE_SCROLL_BEGIN: | 2811 case ui::ET_GESTURE_SCROLL_BEGIN: |
| 2818 selection_controller_client_->OnScrollStarted(); | 2812 selection_controller_client_->OnScrollStarted(); |
| 2819 break; | 2813 break; |
| 2820 case ui::ET_GESTURE_SCROLL_END: | 2814 case ui::ET_GESTURE_SCROLL_END: |
| 2821 selection_controller_client_->OnScrollCompleted(); | 2815 selection_controller_client_->OnScrollCompleted(); |
| 2822 break; | 2816 break; |
| 2823 #if defined(OS_WIN) | 2817 #if defined(OS_WIN) |
| 2824 case ui::ET_GESTURE_LONG_TAP: { | 2818 case ui::ET_GESTURE_LONG_TAP: { |
| 2825 if (!last_context_menu_params_) | 2819 if (!last_context_menu_params_) |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3080 ->GetTextSelection(focused_view) | 3074 ->GetTextSelection(focused_view) |
| 3081 ->GetSelectedText(&selected_text)) { | 3075 ->GetSelectedText(&selected_text)) { |
| 3082 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. | 3076 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. |
| 3083 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); | 3077 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); |
| 3084 clipboard_writer.WriteText(selected_text); | 3078 clipboard_writer.WriteText(selected_text); |
| 3085 } | 3079 } |
| 3086 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) | 3080 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) |
| 3087 } | 3081 } |
| 3088 | 3082 |
| 3089 } // namespace content | 3083 } // namespace content |
| OLD | NEW |