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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1675 ui::ER_UNHANDLED; | 1675 ui::ER_UNHANDLED; |
1676 if (point) { | 1676 if (point) { |
1677 if (host_->ShouldForwardTouchEvent()) | 1677 if (host_->ShouldForwardTouchEvent()) |
1678 host_->ForwardTouchEvent(touch_event_); | 1678 host_->ForwardTouchEvent(touch_event_); |
1679 UpdateWebTouchEventAfterDispatch(&touch_event_, point); | 1679 UpdateWebTouchEventAfterDispatch(&touch_event_, point); |
1680 } | 1680 } |
1681 | 1681 |
1682 return result; | 1682 return result; |
1683 } | 1683 } |
1684 | 1684 |
1685 ui::EventResult RenderWidgetHostViewAura::OnGestureEvent( | 1685 void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) { |
1686 ui::GestureEvent* event) { | |
1687 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnGestureEvent"); | 1686 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnGestureEvent"); |
1688 // Pinch gestures are currently disabled by default. See crbug.com/128477. | 1687 // Pinch gestures are currently disabled by default. See crbug.com/128477. |
1689 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN || | 1688 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN || |
1690 event->type() == ui::ET_GESTURE_PINCH_UPDATE || | 1689 event->type() == ui::ET_GESTURE_PINCH_UPDATE || |
1691 event->type() == ui::ET_GESTURE_PINCH_END) && !ShouldSendPinchGesture()) { | 1690 event->type() == ui::ET_GESTURE_PINCH_END) && !ShouldSendPinchGesture()) { |
1692 return ui::ER_CONSUMED; | 1691 event->SetHandled(); |
| 1692 return; |
1693 } | 1693 } |
1694 | 1694 |
1695 RenderViewHostDelegate* delegate = NULL; | 1695 RenderViewHostDelegate* delegate = NULL; |
1696 if (popup_type_ == WebKit::WebPopupTypeNone && !is_fullscreen_) | 1696 if (popup_type_ == WebKit::WebPopupTypeNone && !is_fullscreen_) |
1697 delegate = RenderViewHost::From(host_)->GetDelegate(); | 1697 delegate = RenderViewHost::From(host_)->GetDelegate(); |
1698 | 1698 |
1699 if (delegate && event->type() == ui::ET_GESTURE_BEGIN && | 1699 if (delegate && event->type() == ui::ET_GESTURE_BEGIN && |
1700 event->details().touch_points() == 1) { | 1700 event->details().touch_points() == 1) { |
1701 delegate->HandleGestureBegin(); | 1701 delegate->HandleGestureBegin(); |
1702 } | 1702 } |
(...skipping 18 matching lines...) Expand all Loading... |
1721 RecordAction(UserMetricsAction("TouchscreenScrollFling")); | 1721 RecordAction(UserMetricsAction("TouchscreenScrollFling")); |
1722 } | 1722 } |
1723 } | 1723 } |
1724 | 1724 |
1725 if (delegate && event->type() == ui::ET_GESTURE_END && | 1725 if (delegate && event->type() == ui::ET_GESTURE_END && |
1726 event->details().touch_points() == 1) { | 1726 event->details().touch_points() == 1) { |
1727 delegate->HandleGestureEnd(); | 1727 delegate->HandleGestureEnd(); |
1728 } | 1728 } |
1729 | 1729 |
1730 // If a gesture is not processed by the webpage, then WebKit processes it | 1730 // If a gesture is not processed by the webpage, then WebKit processes it |
1731 // (e.g. generates synthetic mouse events). So CONSUMED should be returned | 1731 // (e.g. generates synthetic mouse events). |
1732 // from here to avoid any duplicate synthetic mouse-events being generated | 1732 event->SetHandled(); |
1733 // from aura. | |
1734 return ui::ER_CONSUMED; | |
1735 } | 1733 } |
1736 | 1734 |
1737 //////////////////////////////////////////////////////////////////////////////// | 1735 //////////////////////////////////////////////////////////////////////////////// |
1738 // RenderWidgetHostViewAura, aura::client::ActivationDelegate implementation: | 1736 // RenderWidgetHostViewAura, aura::client::ActivationDelegate implementation: |
1739 | 1737 |
1740 bool RenderWidgetHostViewAura::ShouldActivate() const { | 1738 bool RenderWidgetHostViewAura::ShouldActivate() const { |
1741 const ui::Event* event = window_->GetRootWindow()->current_event(); | 1739 const ui::Event* event = window_->GetRootWindow()->current_event(); |
1742 if (!event) | 1740 if (!event) |
1743 return true; | 1741 return true; |
1744 return is_fullscreen_; | 1742 return is_fullscreen_; |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2007 RenderWidgetHost* widget) { | 2005 RenderWidgetHost* widget) { |
2008 return new RenderWidgetHostViewAura(widget); | 2006 return new RenderWidgetHostViewAura(widget); |
2009 } | 2007 } |
2010 | 2008 |
2011 // static | 2009 // static |
2012 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 2010 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
2013 GetScreenInfoForWindow(results, NULL); | 2011 GetScreenInfoForWindow(results, NULL); |
2014 } | 2012 } |
2015 | 2013 |
2016 } // namespace content | 2014 } // namespace content |
OLD | NEW |