Chromium Code Reviews| 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_win.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_win.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <peninputpanel_i.c> | 9 #include <peninputpanel_i.c> |
| 10 #include <stack> | 10 #include <stack> |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 373 set_rotation_angle(touch_point.rotationAngle); | 373 set_rotation_angle(touch_point.rotationAngle); |
| 374 set_force(touch_point.force); | 374 set_force(touch_point.force); |
| 375 } | 375 } |
| 376 | 376 |
| 377 virtual ~TouchEventFromWebTouchPoint() {} | 377 virtual ~TouchEventFromWebTouchPoint() {} |
| 378 | 378 |
| 379 private: | 379 private: |
| 380 DISALLOW_COPY_AND_ASSIGN(TouchEventFromWebTouchPoint); | 380 DISALLOW_COPY_AND_ASSIGN(TouchEventFromWebTouchPoint); |
| 381 }; | 381 }; |
| 382 | 382 |
| 383 bool ShouldSendPinchGesture() { | |
| 384 static bool pinch_allowed = | |
| 385 CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnablePinch); | |
|
Nico
2012/09/28 04:00:14
nit: HasSwitch() should be fast, no need to make t
| |
| 386 return pinch_allowed; | |
| 387 } | |
| 388 | |
| 383 } // namespace | 389 } // namespace |
| 384 | 390 |
| 385 const wchar_t kRenderWidgetHostHWNDClass[] = L"Chrome_RenderWidgetHostHWND"; | 391 const wchar_t kRenderWidgetHostHWNDClass[] = L"Chrome_RenderWidgetHostHWND"; |
| 386 | 392 |
| 387 // Wrapper for maintaining touchstate associated with a WebTouchEvent. | 393 // Wrapper for maintaining touchstate associated with a WebTouchEvent. |
| 388 class WebTouchState { | 394 class WebTouchState { |
| 389 public: | 395 public: |
| 390 explicit WebTouchState(const RenderWidgetHostViewWin* window); | 396 explicit WebTouchState(const RenderWidgetHostViewWin* window); |
| 391 | 397 |
| 392 // Updates the current touchpoint state with the supplied touches. | 398 // Updates the current touchpoint state with the supplied touches. |
| (...skipping 2385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2778 if (::IsWindow(tooltip_hwnd_)) | 2784 if (::IsWindow(tooltip_hwnd_)) |
| 2779 ::DestroyWindow(tooltip_hwnd_); | 2785 ::DestroyWindow(tooltip_hwnd_); |
| 2780 tooltip_hwnd_ = NULL; | 2786 tooltip_hwnd_ = NULL; |
| 2781 } | 2787 } |
| 2782 | 2788 |
| 2783 bool RenderWidgetHostViewWin::ForwardGestureEventToRenderer( | 2789 bool RenderWidgetHostViewWin::ForwardGestureEventToRenderer( |
| 2784 ui::GestureEvent* gesture) { | 2790 ui::GestureEvent* gesture) { |
| 2785 if (!render_widget_host_) | 2791 if (!render_widget_host_) |
| 2786 return false; | 2792 return false; |
| 2787 | 2793 |
| 2794 // Pinch gestures are disabled by default on windows desktop. See | |
| 2795 // crbug.com/128477 and crbug.com/148816 | |
| 2796 if ((gesture->type() == ui::ET_GESTURE_PINCH_BEGIN || | |
| 2797 gesture->type() == ui::ET_GESTURE_PINCH_UPDATE || | |
| 2798 gesture->type() == ui::ET_GESTURE_PINCH_END) && | |
| 2799 !ShouldSendPinchGesture()) { | |
| 2800 return true; | |
| 2801 } | |
| 2802 | |
| 2788 WebKit::WebGestureEvent web_gesture = CreateWebGestureEvent(m_hWnd, *gesture); | 2803 WebKit::WebGestureEvent web_gesture = CreateWebGestureEvent(m_hWnd, *gesture); |
| 2789 if (web_gesture.type == WebKit::WebGestureEvent::Undefined) | 2804 if (web_gesture.type == WebKit::WebGestureEvent::Undefined) |
| 2790 return false; | 2805 return false; |
| 2791 render_widget_host_->ForwardGestureEvent(web_gesture); | 2806 render_widget_host_->ForwardGestureEvent(web_gesture); |
| 2792 return true; | 2807 return true; |
| 2793 } | 2808 } |
| 2794 | 2809 |
| 2795 void RenderWidgetHostViewWin::ForwardMouseEventToRenderer(UINT message, | 2810 void RenderWidgetHostViewWin::ForwardMouseEventToRenderer(UINT message, |
| 2796 WPARAM wparam, | 2811 WPARAM wparam, |
| 2797 LPARAM lparam) { | 2812 LPARAM lparam) { |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3093 // receive a focus change in the context of a pointer down message, it means | 3108 // receive a focus change in the context of a pointer down message, it means |
| 3094 // that the pointer down message occurred on the edit field and we should | 3109 // that the pointer down message occurred on the edit field and we should |
| 3095 // display the on screen keyboard | 3110 // display the on screen keyboard |
| 3096 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) | 3111 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) |
| 3097 DisplayOnScreenKeyboardIfNeeded(); | 3112 DisplayOnScreenKeyboardIfNeeded(); |
| 3098 received_focus_change_after_pointer_down_ = false; | 3113 received_focus_change_after_pointer_down_ = false; |
| 3099 pointer_down_context_ = false; | 3114 pointer_down_context_ = false; |
| 3100 } | 3115 } |
| 3101 | 3116 |
| 3102 } // namespace content | 3117 } // namespace content |
| OLD | NEW |