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 <InputScope.h> | 7 #include <InputScope.h> |
8 #include <wtsapi32.h> | 8 #include <wtsapi32.h> |
9 #pragma comment(lib, "wtsapi32.lib") | 9 #pragma comment(lib, "wtsapi32.lib") |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "base/win/windows_version.h" | 27 #include "base/win/windows_version.h" |
28 #include "base/win/wrapped_window_proc.h" | 28 #include "base/win/wrapped_window_proc.h" |
29 #include "content/browser/accessibility/browser_accessibility_manager_win.h" | 29 #include "content/browser/accessibility/browser_accessibility_manager_win.h" |
30 #include "content/browser/accessibility/browser_accessibility_state_impl.h" | 30 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
31 #include "content/browser/accessibility/browser_accessibility_win.h" | 31 #include "content/browser/accessibility/browser_accessibility_win.h" |
32 #include "content/browser/gpu/gpu_data_manager_impl.h" | 32 #include "content/browser/gpu/gpu_data_manager_impl.h" |
33 #include "content/browser/gpu/gpu_process_host.h" | 33 #include "content/browser/gpu/gpu_process_host.h" |
34 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 34 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
35 #include "content/browser/renderer_host/backing_store.h" | 35 #include "content/browser/renderer_host/backing_store.h" |
36 #include "content/browser/renderer_host/backing_store_win.h" | 36 #include "content/browser/renderer_host/backing_store_win.h" |
| 37 #include "content/browser/renderer_host/input/web_input_event_builders_win.h" |
37 #include "content/browser/renderer_host/render_process_host_impl.h" | 38 #include "content/browser/renderer_host/render_process_host_impl.h" |
38 #include "content/browser/renderer_host/render_widget_host_impl.h" | 39 #include "content/browser/renderer_host/render_widget_host_impl.h" |
39 #include "content/browser/renderer_host/ui_events_helper.h" | 40 #include "content/browser/renderer_host/ui_events_helper.h" |
40 #include "content/common/accessibility_messages.h" | 41 #include "content/common/accessibility_messages.h" |
41 #include "content/common/gpu/gpu_messages.h" | 42 #include "content/common/gpu/gpu_messages.h" |
42 #include "content/common/plugin_constants_win.h" | 43 #include "content/common/plugin_constants_win.h" |
43 #include "content/common/view_messages.h" | 44 #include "content/common/view_messages.h" |
44 #include "content/common/webplugin_geometry.h" | 45 #include "content/common/webplugin_geometry.h" |
45 #include "content/public/browser/browser_thread.h" | 46 #include "content/public/browser/browser_thread.h" |
46 #include "content/public/browser/child_process_data.h" | 47 #include "content/public/browser/child_process_data.h" |
47 #include "content/public/browser/content_browser_client.h" | 48 #include "content/public/browser/content_browser_client.h" |
48 #include "content/public/browser/native_web_keyboard_event.h" | 49 #include "content/public/browser/native_web_keyboard_event.h" |
49 #include "content/public/browser/notification_service.h" | 50 #include "content/public/browser/notification_service.h" |
50 #include "content/public/browser/notification_types.h" | 51 #include "content/public/browser/notification_types.h" |
51 #include "content/public/common/content_switches.h" | 52 #include "content/public/common/content_switches.h" |
52 #include "content/public/common/page_zoom.h" | 53 #include "content/public/common/page_zoom.h" |
53 #include "content/public/common/process_type.h" | 54 #include "content/public/common/process_type.h" |
54 #include "skia/ext/skia_utils_win.h" | 55 #include "skia/ext/skia_utils_win.h" |
55 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" | 56 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" |
56 #include "third_party/WebKit/public/web/WebInputEvent.h" | 57 #include "third_party/WebKit/public/web/WebInputEvent.h" |
57 #include "third_party/WebKit/public/web/win/WebInputEventFactory.h" | |
58 #include "third_party/skia/include/core/SkRegion.h" | 58 #include "third_party/skia/include/core/SkRegion.h" |
59 #include "ui/base/events/event.h" | 59 #include "ui/base/events/event.h" |
60 #include "ui/base/events/event_utils.h" | 60 #include "ui/base/events/event_utils.h" |
61 #include "ui/base/ime/composition_text.h" | 61 #include "ui/base/ime/composition_text.h" |
62 #include "ui/base/ime/win/tsf_input_scope.h" | 62 #include "ui/base/ime/win/tsf_input_scope.h" |
63 #include "ui/base/l10n/l10n_util_win.h" | 63 #include "ui/base/l10n/l10n_util_win.h" |
64 #include "ui/base/text/text_elider.h" | 64 #include "ui/base/text/text_elider.h" |
65 #include "ui/base/touch/touch_device.h" | 65 #include "ui/base/touch/touch_device.h" |
66 #include "ui/base/ui_base_switches.h" | 66 #include "ui/base/ui_base_switches.h" |
67 #include "ui/base/view_prop.h" | 67 #include "ui/base/view_prop.h" |
68 #include "ui/base/win/dpi.h" | 68 #include "ui/base/win/dpi.h" |
69 #include "ui/base/win/hwnd_util.h" | 69 #include "ui/base/win/hwnd_util.h" |
70 #include "ui/base/win/mouse_wheel_util.h" | 70 #include "ui/base/win/mouse_wheel_util.h" |
71 #include "ui/base/win/touch_input.h" | 71 #include "ui/base/win/touch_input.h" |
72 #include "ui/gfx/canvas.h" | 72 #include "ui/gfx/canvas.h" |
73 #include "ui/gfx/rect.h" | 73 #include "ui/gfx/rect.h" |
74 #include "ui/gfx/rect_conversions.h" | 74 #include "ui/gfx/rect_conversions.h" |
75 #include "ui/gfx/screen.h" | 75 #include "ui/gfx/screen.h" |
76 #include "webkit/common/cursors/webcursor.h" | 76 #include "webkit/common/cursors/webcursor.h" |
77 #include "win8/util/win8_util.h" | 77 #include "win8/util/win8_util.h" |
78 | 78 |
79 using base::TimeDelta; | 79 using base::TimeDelta; |
80 using base::TimeTicks; | 80 using base::TimeTicks; |
81 using ui::ViewProp; | 81 using ui::ViewProp; |
82 using WebKit::WebInputEvent; | 82 using WebKit::WebInputEvent; |
83 using WebKit::WebInputEventFactory; | |
84 using WebKit::WebMouseEvent; | 83 using WebKit::WebMouseEvent; |
85 using WebKit::WebTextDirection; | 84 using WebKit::WebTextDirection; |
86 | 85 |
87 namespace content { | 86 namespace content { |
88 namespace { | 87 namespace { |
89 | 88 |
90 // Tooltips will wrap after this width. Yes, wrap. Imagine that! | 89 // Tooltips will wrap after this width. Yes, wrap. Imagine that! |
91 const int kTooltipMaxWidthPixels = 300; | 90 const int kTooltipMaxWidthPixels = 300; |
92 | 91 |
93 // Maximum number of characters we allow in a tooltip. | 92 // Maximum number of characters we allow in a tooltip. |
(...skipping 1907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2001 if (m_hWnd != GetForegroundWindow()) { | 2000 if (m_hWnd != GetForegroundWindow()) { |
2002 HWND toplevel_hwnd = ::GetAncestor(m_hWnd, GA_ROOT); | 2001 HWND toplevel_hwnd = ::GetAncestor(m_hWnd, GA_ROOT); |
2003 EnumThreadWindows( | 2002 EnumThreadWindows( |
2004 GetCurrentThreadId(), | 2003 GetCurrentThreadId(), |
2005 DismissOwnedPopups, | 2004 DismissOwnedPopups, |
2006 reinterpret_cast<LPARAM>(toplevel_hwnd)); | 2005 reinterpret_cast<LPARAM>(toplevel_hwnd)); |
2007 } | 2006 } |
2008 | 2007 |
2009 if (render_widget_host_) { | 2008 if (render_widget_host_) { |
2010 WebKit::WebMouseWheelEvent wheel_event = | 2009 WebKit::WebMouseWheelEvent wheel_event = |
2011 WebInputEventFactory::mouseWheelEvent(m_hWnd, message, wparam, lparam); | 2010 WebMouseWheelEventBuilder::Build(m_hWnd, message, wparam, lparam); |
2012 float scale = ui::win::GetDeviceScaleFactor(); | 2011 float scale = ui::win::GetDeviceScaleFactor(); |
2013 wheel_event.x /= scale; | 2012 wheel_event.x /= scale; |
2014 wheel_event.y /= scale; | 2013 wheel_event.y /= scale; |
2015 wheel_event.deltaX /= scale; | 2014 wheel_event.deltaX /= scale; |
2016 wheel_event.deltaY /= scale; | 2015 wheel_event.deltaY /= scale; |
2017 | 2016 |
2018 render_widget_host_->ForwardWheelEvent(wheel_event); | 2017 render_widget_host_->ForwardWheelEvent(wheel_event); |
2019 } | 2018 } |
2020 handled = TRUE; | 2019 handled = TRUE; |
2021 return 0; | 2020 return 0; |
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2896 TRACE_EVENT0("browser", "EarlyOut_NoRWH"); | 2895 TRACE_EVENT0("browser", "EarlyOut_NoRWH"); |
2897 return; | 2896 return; |
2898 } | 2897 } |
2899 | 2898 |
2900 gfx::Point point = ui::win::ScreenToDIPPoint( | 2899 gfx::Point point = ui::win::ScreenToDIPPoint( |
2901 gfx::Point(static_cast<short>(LOWORD(lparam)), | 2900 gfx::Point(static_cast<short>(LOWORD(lparam)), |
2902 static_cast<short>(HIWORD(lparam)))); | 2901 static_cast<short>(HIWORD(lparam)))); |
2903 lparam = MAKELPARAM(point.x(), point.y()); | 2902 lparam = MAKELPARAM(point.x(), point.y()); |
2904 | 2903 |
2905 WebMouseEvent event( | 2904 WebMouseEvent event( |
2906 WebInputEventFactory::mouseEvent(m_hWnd, message, wparam, lparam)); | 2905 WebMouseEventBuilder::Build(m_hWnd, message, wparam, lparam)); |
2907 | 2906 |
2908 if (mouse_locked_) { | 2907 if (mouse_locked_) { |
2909 event.movementX = event.globalX - last_mouse_position_.locked_global.x(); | 2908 event.movementX = event.globalX - last_mouse_position_.locked_global.x(); |
2910 event.movementY = event.globalY - last_mouse_position_.locked_global.y(); | 2909 event.movementY = event.globalY - last_mouse_position_.locked_global.y(); |
2911 last_mouse_position_.locked_global.SetPoint(event.globalX, event.globalY); | 2910 last_mouse_position_.locked_global.SetPoint(event.globalX, event.globalY); |
2912 | 2911 |
2913 event.x = last_mouse_position_.unlocked.x(); | 2912 event.x = last_mouse_position_.unlocked.x(); |
2914 event.y = last_mouse_position_.unlocked.y(); | 2913 event.y = last_mouse_position_.unlocked.y(); |
2915 event.windowX = last_mouse_position_.unlocked.x(); | 2914 event.windowX = last_mouse_position_.unlocked.x(); |
2916 event.windowY = last_mouse_position_.unlocked.y(); | 2915 event.windowY = last_mouse_position_.unlocked.y(); |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3200 return new RenderWidgetHostViewWin(widget); | 3199 return new RenderWidgetHostViewWin(widget); |
3201 } | 3200 } |
3202 | 3201 |
3203 // static | 3202 // static |
3204 void RenderWidgetHostViewPort::GetDefaultScreenInfo( | 3203 void RenderWidgetHostViewPort::GetDefaultScreenInfo( |
3205 WebKit::WebScreenInfo* results) { | 3204 WebKit::WebScreenInfo* results) { |
3206 GetScreenInfoForWindow(0, results); | 3205 GetScreenInfoForWindow(0, results); |
3207 } | 3206 } |
3208 | 3207 |
3209 } // namespace content | 3208 } // namespace content |
OLD | NEW |