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