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 2663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2674 case WM_RBUTTONDOWN: | 2674 case WM_RBUTTONDOWN: |
2675 case WM_MBUTTONDOWN: | 2675 case WM_MBUTTONDOWN: |
2676 render_widget_host_->StartUserGesture(); | 2676 render_widget_host_->StartUserGesture(); |
2677 break; | 2677 break; |
2678 default: | 2678 default: |
2679 break; | 2679 break; |
2680 } | 2680 } |
2681 return 0; | 2681 return 0; |
2682 } | 2682 } |
2683 | 2683 |
2684 LRESULT RenderWidgetHostViewWin::OnPointerMessage( | |
2685 UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled) { | |
2686 TRACE_EVENT0("browser", "RenderWidgetHostViewWin::OnPointerMessage"); | |
2687 POINT point = {0}; | |
2688 | |
2689 point.x = GET_X_LPARAM(lparam); | |
2690 point.y = GET_Y_LPARAM(lparam); | |
2691 ScreenToClient(&point); | |
2692 | |
2693 lparam = MAKELPARAM(point.x, point.y); | |
2694 | |
2695 if (message == WM_POINTERDOWN) { | |
2696 if (!base::win::IsMetroProcess()) { | |
2697 pointer_down_context_ = true; | |
2698 SetFocus(); | |
2699 received_focus_change_after_pointer_down_ = false; | |
2700 MessageLoop::current()->PostDelayedTask(FROM_HERE, | |
2701 base::Bind(&RenderWidgetHostViewWin::ResetPointerDownContext, | |
2702 weak_factory_.GetWeakPtr()), | |
2703 base::TimeDelta::FromMilliseconds(kPointerDownContextResetDelay)); | |
2704 } | |
2705 } | |
2706 handled = FALSE; | |
2707 return 0; | |
2708 } | |
2709 | |
2710 void RenderWidgetHostViewWin::OnFinalMessage(HWND window) { | 2684 void RenderWidgetHostViewWin::OnFinalMessage(HWND window) { |
2711 TRACE_EVENT0("browser", "RenderWidgetHostViewWin::OnFinalMessage"); | 2685 TRACE_EVENT0("browser", "RenderWidgetHostViewWin::OnFinalMessage"); |
2712 // When the render widget host is being destroyed, it ends up calling | 2686 // When the render widget host is being destroyed, it ends up calling |
2713 // Destroy() which NULLs render_widget_host_. | 2687 // Destroy() which NULLs render_widget_host_. |
2714 // Note: the following bug http://crbug.com/24248 seems to report that | 2688 // Note: the following bug http://crbug.com/24248 seems to report that |
2715 // OnFinalMessage is called with a deleted |render_widget_host_|. It is not | 2689 // OnFinalMessage is called with a deleted |render_widget_host_|. It is not |
2716 // clear how this could happen, hence the NULLing of render_widget_host_ | 2690 // clear how this could happen, hence the NULLing of render_widget_host_ |
2717 // above. | 2691 // above. |
2718 if (!render_widget_host_ && !being_destroyed_) { | 2692 if (!render_widget_host_ && !being_destroyed_) { |
2719 // If you hit this NOTREACHED, please add a comment to report it on | 2693 // If you hit this NOTREACHED, please add a comment to report it on |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3105 // receive a focus change in the context of a pointer down message, it means | 3079 // receive a focus change in the context of a pointer down message, it means |
3106 // that the pointer down message occurred on the edit field and we should | 3080 // that the pointer down message occurred on the edit field and we should |
3107 // display the on screen keyboard | 3081 // display the on screen keyboard |
3108 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) | 3082 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) |
3109 DisplayOnScreenKeyboardIfNeeded(); | 3083 DisplayOnScreenKeyboardIfNeeded(); |
3110 received_focus_change_after_pointer_down_ = false; | 3084 received_focus_change_after_pointer_down_ = false; |
3111 pointer_down_context_ = false; | 3085 pointer_down_context_ = false; |
3112 } | 3086 } |
3113 | 3087 |
3114 } // namespace content | 3088 } // namespace content |
OLD | NEW |