| 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 1882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1893 reinterpret_cast<LPARAM>(toplevel_hwnd)); | 1893 reinterpret_cast<LPARAM>(toplevel_hwnd)); |
| 1894 } | 1894 } |
| 1895 #endif | 1895 #endif |
| 1896 blink::WebMouseWheelEvent mouse_wheel_event = | 1896 blink::WebMouseWheelEvent mouse_wheel_event = |
| 1897 MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent&>(*event)); | 1897 MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent&>(*event)); |
| 1898 if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0) { | 1898 if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0) { |
| 1899 if (ShouldRouteEvent(event)) { | 1899 if (ShouldRouteEvent(event)) { |
| 1900 host_->delegate()->GetInputEventRouter()->RouteMouseWheelEvent( | 1900 host_->delegate()->GetInputEventRouter()->RouteMouseWheelEvent( |
| 1901 this, &mouse_wheel_event); | 1901 this, &mouse_wheel_event); |
| 1902 } else { | 1902 } else { |
| 1903 ProcessMouseWheelEvent(mouse_wheel_event); | 1903 ProcessMouseWheelEvent(mouse_wheel_event, *event->latency()); |
| 1904 } | 1904 } |
| 1905 } | 1905 } |
| 1906 } else { | 1906 } else { |
| 1907 bool is_selection_popup = | 1907 bool is_selection_popup = |
| 1908 popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab(); | 1908 popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab(); |
| 1909 if (CanRendererHandleEvent(event, mouse_locked_, is_selection_popup) && | 1909 if (CanRendererHandleEvent(event, mouse_locked_, is_selection_popup) && |
| 1910 !(event->flags() & ui::EF_FROM_TOUCH)) { | 1910 !(event->flags() & ui::EF_FROM_TOUCH)) { |
| 1911 // Confirm existing composition text on mouse press, to make sure | 1911 // Confirm existing composition text on mouse press, to make sure |
| 1912 // the input caret won't be moved with an ongoing composition text. | 1912 // the input caret won't be moved with an ongoing composition text. |
| 1913 if (event->type() == ui::ET_MOUSE_PRESSED) | 1913 if (event->type() == ui::ET_MOUSE_PRESSED) |
| 1914 FinishImeCompositionSession(); | 1914 FinishImeCompositionSession(); |
| 1915 | 1915 |
| 1916 blink::WebMouseEvent mouse_event = MakeWebMouseEvent(*event); | 1916 blink::WebMouseEvent mouse_event = MakeWebMouseEvent(*event); |
| 1917 ModifyEventMovementAndCoords(&mouse_event); | 1917 ModifyEventMovementAndCoords(&mouse_event); |
| 1918 if (ShouldRouteEvent(event)) { | 1918 if (ShouldRouteEvent(event)) { |
| 1919 host_->delegate()->GetInputEventRouter()->RouteMouseEvent(this, | 1919 host_->delegate()->GetInputEventRouter()->RouteMouseEvent(this, |
| 1920 &mouse_event); | 1920 &mouse_event); |
| 1921 } else { | 1921 } else { |
| 1922 ProcessMouseEvent(mouse_event); | 1922 ProcessMouseEvent(mouse_event, *event->latency()); |
| 1923 } | 1923 } |
| 1924 | 1924 |
| 1925 // Ensure that we get keyboard focus on mouse down as a plugin window may | 1925 // Ensure that we get keyboard focus on mouse down as a plugin window may |
| 1926 // have grabbed keyboard focus. | 1926 // have grabbed keyboard focus. |
| 1927 if (event->type() == ui::ET_MOUSE_PRESSED) | 1927 if (event->type() == ui::ET_MOUSE_PRESSED) |
| 1928 SetKeyboardFocus(); | 1928 SetKeyboardFocus(); |
| 1929 } | 1929 } |
| 1930 } | 1930 } |
| 1931 | 1931 |
| 1932 switch (event->type()) { | 1932 switch (event->type()) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1961 gfx::ConvertPointToDIP(device_scale_factor_, *transformed_point); | 1961 gfx::ConvertPointToDIP(device_scale_factor_, *transformed_point); |
| 1962 | 1962 |
| 1963 // It is possible that the renderer has not yet produced a surface, in which | 1963 // It is possible that the renderer has not yet produced a surface, in which |
| 1964 // case we return our current namespace. | 1964 // case we return our current namespace. |
| 1965 if (id.is_null()) | 1965 if (id.is_null()) |
| 1966 return GetSurfaceIdNamespace(); | 1966 return GetSurfaceIdNamespace(); |
| 1967 return cc::SurfaceIdAllocator::NamespaceForId(id); | 1967 return cc::SurfaceIdAllocator::NamespaceForId(id); |
| 1968 } | 1968 } |
| 1969 | 1969 |
| 1970 void RenderWidgetHostViewAura::ProcessMouseEvent( | 1970 void RenderWidgetHostViewAura::ProcessMouseEvent( |
| 1971 const blink::WebMouseEvent& event) { | 1971 const blink::WebMouseEvent& event, |
| 1972 host_->ForwardMouseEvent(event); | 1972 const ui::LatencyInfo& latency) { |
| 1973 host_->ForwardMouseEventWithLatencyInfo(event, latency); |
| 1973 } | 1974 } |
| 1974 | 1975 |
| 1975 void RenderWidgetHostViewAura::ProcessMouseWheelEvent( | 1976 void RenderWidgetHostViewAura::ProcessMouseWheelEvent( |
| 1976 const blink::WebMouseWheelEvent& event) { | 1977 const blink::WebMouseWheelEvent& event, |
| 1977 host_->ForwardWheelEvent(event); | 1978 const ui::LatencyInfo& latency) { |
| 1979 host_->ForwardWheelEventWithLatencyInfo(event, latency); |
| 1978 } | 1980 } |
| 1979 | 1981 |
| 1980 void RenderWidgetHostViewAura::ProcessTouchEvent( | 1982 void RenderWidgetHostViewAura::ProcessTouchEvent( |
| 1981 const blink::WebTouchEvent& event, | 1983 const blink::WebTouchEvent& event, |
| 1982 const ui::LatencyInfo& latency) { | 1984 const ui::LatencyInfo& latency) { |
| 1983 host_->ForwardTouchEventWithLatencyInfo(event, latency); | 1985 host_->ForwardTouchEventWithLatencyInfo(event, latency); |
| 1984 } | 1986 } |
| 1985 | 1987 |
| 1986 void RenderWidgetHostViewAura::ProcessGestureEvent( | 1988 void RenderWidgetHostViewAura::ProcessGestureEvent( |
| 1987 const blink::WebGestureEvent& event, | 1989 const blink::WebGestureEvent& event, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2011 // TODO(ananta) | 2013 // TODO(ananta) |
| 2012 // Investigate if this is true for Windows 8 Metro ASH as well. | 2014 // Investigate if this is true for Windows 8 Metro ASH as well. |
| 2013 if (event->finger_count() != 2) | 2015 if (event->finger_count() != 2) |
| 2014 return; | 2016 return; |
| 2015 #endif | 2017 #endif |
| 2016 blink::WebGestureEvent gesture_event = | 2018 blink::WebGestureEvent gesture_event = |
| 2017 MakeWebGestureEventFlingCancel(); | 2019 MakeWebGestureEventFlingCancel(); |
| 2018 host_->ForwardGestureEvent(gesture_event); | 2020 host_->ForwardGestureEvent(gesture_event); |
| 2019 blink::WebMouseWheelEvent mouse_wheel_event = | 2021 blink::WebMouseWheelEvent mouse_wheel_event = |
| 2020 MakeWebMouseWheelEvent(*event); | 2022 MakeWebMouseWheelEvent(*event); |
| 2021 host_->ForwardWheelEvent(mouse_wheel_event); | 2023 host_->ForwardWheelEventWithLatencyInfo(mouse_wheel_event, |
| 2024 *event->latency()); |
| 2022 RecordAction(base::UserMetricsAction("TrackpadScroll")); | 2025 RecordAction(base::UserMetricsAction("TrackpadScroll")); |
| 2023 } else if (event->type() == ui::ET_SCROLL_FLING_START || | 2026 } else if (event->type() == ui::ET_SCROLL_FLING_START || |
| 2024 event->type() == ui::ET_SCROLL_FLING_CANCEL) { | 2027 event->type() == ui::ET_SCROLL_FLING_CANCEL) { |
| 2025 blink::WebGestureEvent gesture_event = MakeWebGestureEvent(*event); | 2028 blink::WebGestureEvent gesture_event = MakeWebGestureEvent(*event); |
| 2026 host_->ForwardGestureEvent(gesture_event); | 2029 host_->ForwardGestureEvent(gesture_event); |
| 2027 if (event->type() == ui::ET_SCROLL_FLING_START) | 2030 if (event->type() == ui::ET_SCROLL_FLING_START) |
| 2028 RecordAction(base::UserMetricsAction("TrackpadScrollFling")); | 2031 RecordAction(base::UserMetricsAction("TrackpadScrollFling")); |
| 2029 } | 2032 } |
| 2030 | 2033 |
| 2031 event->SetHandled(); | 2034 event->SetHandled(); |
| (...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2865 | 2868 |
| 2866 //////////////////////////////////////////////////////////////////////////////// | 2869 //////////////////////////////////////////////////////////////////////////////// |
| 2867 // RenderWidgetHostViewBase, public: | 2870 // RenderWidgetHostViewBase, public: |
| 2868 | 2871 |
| 2869 // static | 2872 // static |
| 2870 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2873 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 2871 GetScreenInfoForWindow(results, NULL); | 2874 GetScreenInfoForWindow(results, NULL); |
| 2872 } | 2875 } |
| 2873 | 2876 |
| 2874 } // namespace content | 2877 } // namespace content |
| OLD | NEW |