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" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/string_number_conversions.h" | 13 #include "base/string_number_conversions.h" |
14 #include "content/browser/renderer_host/backing_store_aura.h" | 14 #include "content/browser/renderer_host/backing_store_aura.h" |
15 #include "content/browser/renderer_host/dip_util.h" | 15 #include "content/browser/renderer_host/dip_util.h" |
16 #include "content/browser/renderer_host/render_view_host_delegate.h" | 16 #include "content/browser/renderer_host/render_view_host_delegate.h" |
17 #include "content/browser/renderer_host/render_widget_host_impl.h" | 17 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 18 #include "content/browser/renderer_host/ui_events_helper.h" |
18 #include "content/browser/renderer_host/web_input_event_aura.h" | 19 #include "content/browser/renderer_host/web_input_event_aura.h" |
19 #include "content/common/gpu/client/gl_helper.h" | 20 #include "content/common/gpu/client/gl_helper.h" |
20 #include "content/common/gpu/gpu_messages.h" | 21 #include "content/common/gpu/gpu_messages.h" |
21 #include "content/common/view_messages.h" | 22 #include "content/common/view_messages.h" |
22 #include "content/port/browser/render_widget_host_view_port.h" | 23 #include "content/port/browser/render_widget_host_view_port.h" |
23 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
24 #include "content/public/browser/render_view_host.h" | 25 #include "content/public/browser/render_view_host.h" |
25 #include "content/public/browser/user_metrics.h" | 26 #include "content/public/browser/user_metrics.h" |
26 #include "content/public/common/content_switches.h" | 27 #include "content/public/common/content_switches.h" |
27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli
ne.h" | 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli
ne.h" |
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 GetScreenInfoForWindow(results, window_); | 1003 GetScreenInfoForWindow(results, window_); |
1003 } | 1004 } |
1004 | 1005 |
1005 gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() { | 1006 gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() { |
1006 return window_->GetToplevelWindow()->GetBoundsInRootWindow(); | 1007 return window_->GetToplevelWindow()->GetBoundsInRootWindow(); |
1007 } | 1008 } |
1008 | 1009 |
1009 void RenderWidgetHostViewAura::ProcessAckedTouchEvent( | 1010 void RenderWidgetHostViewAura::ProcessAckedTouchEvent( |
1010 const WebKit::WebTouchEvent& touch_event, | 1011 const WebKit::WebTouchEvent& touch_event, |
1011 bool processed) { | 1012 bool processed) { |
1012 // The ACKs for the touch-events arrive in the same sequence as they were | 1013 ScopedVector<ui::TouchEvent> events; |
1013 // dispatched. | 1014 if (!MakeUITouchEventsFromWebTouchEvents(touch_event, &events)) |
1014 aura::RootWindow* root_window = window_->GetRootWindow(); | 1015 return; |
1015 if (root_window) | 1016 |
1016 root_window->AdvanceQueuedTouchEvent(window_, processed); | 1017 aura::RootWindow* root = window_->GetRootWindow(); |
| 1018 ui::EventResult result = processed ? ui::ER_HANDLED : ui::ER_UNHANDLED; |
| 1019 for (ScopedVector<ui::TouchEvent>::iterator iter = events.begin(), |
| 1020 end = events.end(); iter != end; ++iter) { |
| 1021 root->ProcessedTouchEvent((*iter), window_, result); |
| 1022 } |
1017 } | 1023 } |
1018 | 1024 |
1019 void RenderWidgetHostViewAura::SetHasHorizontalScrollbar( | 1025 void RenderWidgetHostViewAura::SetHasHorizontalScrollbar( |
1020 bool has_horizontal_scrollbar) { | 1026 bool has_horizontal_scrollbar) { |
1021 // Not needed. Mac-only. | 1027 // Not needed. Mac-only. |
1022 } | 1028 } |
1023 | 1029 |
1024 void RenderWidgetHostViewAura::SetScrollOffsetPinning( | 1030 void RenderWidgetHostViewAura::SetScrollOffsetPinning( |
1025 bool is_pinned_to_left, bool is_pinned_to_right) { | 1031 bool is_pinned_to_left, bool is_pinned_to_right) { |
1026 // Not needed. Mac-only. | 1032 // Not needed. Mac-only. |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1542 return ui::ER_HANDLED; | 1548 return ui::ER_HANDLED; |
1543 } | 1549 } |
1544 | 1550 |
1545 ui::EventResult RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) { | 1551 ui::EventResult RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) { |
1546 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnTouchEvent"); | 1552 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnTouchEvent"); |
1547 // Update the touch event first. | 1553 // Update the touch event first. |
1548 WebKit::WebTouchPoint* point = UpdateWebTouchEvent(event, | 1554 WebKit::WebTouchPoint* point = UpdateWebTouchEvent(event, |
1549 &touch_event_); | 1555 &touch_event_); |
1550 | 1556 |
1551 // Forward the touch event only if a touch point was updated, and there's a | 1557 // Forward the touch event only if a touch point was updated, and there's a |
1552 // touch-event handler in the page. | 1558 // touch-event handler in the page, and no other touch-event is in the queue. |
1553 if (point && host_->has_touch_handler()) { | 1559 if (point && host_->ShouldForwardTouchEvent()) { |
1554 host_->ForwardTouchEvent(touch_event_); | 1560 host_->ForwardTouchEvent(touch_event_); |
1555 UpdateWebTouchEventAfterDispatch(&touch_event_, point); | 1561 UpdateWebTouchEventAfterDispatch(&touch_event_, point); |
1556 return ui::ER_ASYNC; | 1562 return ui::ER_CONSUMED; |
1557 } | 1563 } |
1558 | 1564 |
1559 return ui::ER_UNHANDLED; | 1565 return ui::ER_UNHANDLED; |
1560 } | 1566 } |
1561 | 1567 |
1562 ui::EventResult RenderWidgetHostViewAura::OnGestureEvent( | 1568 ui::EventResult RenderWidgetHostViewAura::OnGestureEvent( |
1563 ui::GestureEvent* event) { | 1569 ui::GestureEvent* event) { |
1564 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnGestureEvent"); | 1570 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnGestureEvent"); |
1565 // Pinch gestures are currently disabled by default. See crbug.com/128477. | 1571 // Pinch gestures are currently disabled by default. See crbug.com/128477. |
1566 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN || | 1572 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN || |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1877 RenderWidgetHost* widget) { | 1883 RenderWidgetHost* widget) { |
1878 return new RenderWidgetHostViewAura(widget); | 1884 return new RenderWidgetHostViewAura(widget); |
1879 } | 1885 } |
1880 | 1886 |
1881 // static | 1887 // static |
1882 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 1888 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
1883 GetScreenInfoForWindow(results, NULL); | 1889 GetScreenInfoForWindow(results, NULL); |
1884 } | 1890 } |
1885 | 1891 |
1886 } // namespace content | 1892 } // namespace content |
OLD | NEW |