Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 11773007: Add initial support for handling touch events in desktop chrome AURA. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/views/widget/desktop_aura/desktop_root_window_host_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after
1499 if (should_not_forward) { 1499 if (should_not_forward) {
1500 synthetic_move_sent_ = false; 1500 synthetic_move_sent_ = false;
1501 } else { 1501 } else {
1502 // Check if the mouse has reached the border and needs to be centered. 1502 // Check if the mouse has reached the border and needs to be centered.
1503 if (ShouldMoveToCenter()) { 1503 if (ShouldMoveToCenter()) {
1504 synthetic_move_sent_ = true; 1504 synthetic_move_sent_ = true;
1505 window_->MoveCursorTo(center); 1505 window_->MoveCursorTo(center);
1506 } 1506 }
1507 1507
1508 // Forward event to renderer. 1508 // Forward event to renderer.
1509 if (CanRendererHandleEvent(event)) 1509 if (CanRendererHandleEvent(event) &&
1510 !(event->flags() & ui::EF_FROM_TOUCH))
1510 host_->ForwardMouseEvent(mouse_event); 1511 host_->ForwardMouseEvent(mouse_event);
1511 } 1512 }
1512 return; 1513 return;
1513 } 1514 }
1514 1515
1515 // As the overscroll is handled during scroll events from the trackpad, the 1516 // As the overscroll is handled during scroll events from the trackpad, the
1516 // RWHVA window is transformed by the overscroll controller. This transform 1517 // RWHVA window is transformed by the overscroll controller. This transform
1517 // triggers a synthetic mouse-move event to be generated (by the aura 1518 // triggers a synthetic mouse-move event to be generated (by the aura
1518 // RootWindow). But this event interferes with the overscroll gesture. So, 1519 // RootWindow). But this event interferes with the overscroll gesture. So,
1519 // ignore such synthetic mouse-move events if an overscroll gesture is in 1520 // ignore such synthetic mouse-move events if an overscroll gesture is in
1520 // progress. 1521 // progress.
1521 if (host_->overscroll_controller() && 1522 if (host_->overscroll_controller() &&
1522 host_->overscroll_controller()->overscroll_mode() != OVERSCROLL_NONE && 1523 host_->overscroll_controller()->overscroll_mode() != OVERSCROLL_NONE &&
1523 event->flags() & ui::EF_IS_SYNTHESIZED && 1524 event->flags() & ui::EF_IS_SYNTHESIZED &&
1524 (event->type() == ui::ET_MOUSE_ENTERED || 1525 (event->type() == ui::ET_MOUSE_ENTERED ||
1525 event->type() == ui::ET_MOUSE_EXITED || 1526 event->type() == ui::ET_MOUSE_EXITED ||
1526 event->type() == ui::ET_MOUSE_MOVED)) { 1527 event->type() == ui::ET_MOUSE_MOVED)) {
1527 event->StopPropagation(); 1528 event->StopPropagation();
1528 return; 1529 return;
1529 } 1530 }
1530 1531
1531 if (event->type() == ui::ET_MOUSEWHEEL) { 1532 if (event->type() == ui::ET_MOUSEWHEEL) {
1532 WebKit::WebMouseWheelEvent mouse_wheel_event = 1533 WebKit::WebMouseWheelEvent mouse_wheel_event =
1533 MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent*>(event)); 1534 MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent*>(event));
1534 if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0) 1535 if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0)
1535 host_->ForwardWheelEvent(mouse_wheel_event); 1536 host_->ForwardWheelEvent(mouse_wheel_event);
1536 } else if (CanRendererHandleEvent(event)) { 1537 } else if (CanRendererHandleEvent(event) &&
1538 !(event->flags() & ui::EF_FROM_TOUCH)) {
1537 WebKit::WebMouseEvent mouse_event = MakeWebMouseEvent(event); 1539 WebKit::WebMouseEvent mouse_event = MakeWebMouseEvent(event);
1538 ModifyEventMovementAndCoords(&mouse_event); 1540 ModifyEventMovementAndCoords(&mouse_event);
1539 host_->ForwardMouseEvent(mouse_event); 1541 host_->ForwardMouseEvent(mouse_event);
1540 } 1542 }
1541 1543
1542 switch (event->type()) { 1544 switch (event->type()) {
1543 case ui::ET_MOUSE_PRESSED: 1545 case ui::ET_MOUSE_PRESSED:
1544 window_->SetCapture(); 1546 window_->SetCapture();
1545 // Confirm existing composition text on mouse click events, to make sure 1547 // Confirm existing composition text on mouse click events, to make sure
1546 // the input caret won't be moved with an ongoing composition text. 1548 // the input caret won't be moved with an ongoing composition text.
1547 FinishImeCompositionSession(); 1549 FinishImeCompositionSession();
1548 break; 1550 break;
1549 case ui::ET_MOUSE_RELEASED: 1551 case ui::ET_MOUSE_RELEASED:
1550 window_->ReleaseCapture(); 1552 window_->ReleaseCapture();
1551 break; 1553 break;
1552 default: 1554 default:
1553 break; 1555 break;
1554 } 1556 }
1555 1557
1556 // Needed to propagate mouse event to native_tab_contents_view_aura. 1558 // Needed to propagate mouse event to native_tab_contents_view_aura.
1557 // TODO(pkotwicz): Find a better way of doing this. 1559 // TODO(pkotwicz): Find a better way of doing this.
1558 if (window_->parent()->delegate()) 1560 if (window_->parent()->delegate() && !(event->flags() & ui::EF_FROM_TOUCH))
1559 window_->parent()->delegate()->OnMouseEvent(event); 1561 window_->parent()->delegate()->OnMouseEvent(event);
1560 1562
1561 event->SetHandled(); 1563 event->SetHandled();
1562 } 1564 }
1563 1565
1564 void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) { 1566 void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) {
1565 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnScrollEvent"); 1567 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnScrollEvent");
1566 if (event->type() == ui::ET_SCROLL) { 1568 if (event->type() == ui::ET_SCROLL) {
1567 WebKit::WebGestureEvent gesture_event = 1569 WebKit::WebGestureEvent gesture_event =
1568 MakeWebGestureEventFlingCancel(); 1570 MakeWebGestureEventFlingCancel();
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
1971 RenderWidgetHost* widget) { 1973 RenderWidgetHost* widget) {
1972 return new RenderWidgetHostViewAura(widget); 1974 return new RenderWidgetHostViewAura(widget);
1973 } 1975 }
1974 1976
1975 // static 1977 // static
1976 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 1978 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
1977 GetScreenInfoForWindow(results, NULL); 1979 GetScreenInfoForWindow(results, NULL);
1978 } 1980 }
1979 1981
1980 } // namespace content 1982 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | ui/views/widget/desktop_aura/desktop_root_window_host_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698