diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-08 18:05:25 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-08 18:05:25 +0000 |
commit | ca70609833412dd0cdc758724a92681474d62ee2 (patch) | |
tree | 3f101230764f644cd1c0a2b7cb52aa556991aa82 | |
parent | cb3221b804cdad65aaade7faff1f612644dee4a3 (diff) | |
download | chromium_src-ca70609833412dd0cdc758724a92681474d62ee2.zip chromium_src-ca70609833412dd0cdc758724a92681474d62ee2.tar.gz chromium_src-ca70609833412dd0cdc758724a92681474d62ee2.tar.bz2 |
Convert Aura to use ui::Event.
http://crbug.com/125937
TEST=existing
Review URL: https://chromiumcodereview.appspot.com/10827145
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150587 0039d316-1c4b-4281-b951-d872f2087c98
147 files changed, 1314 insertions, 2250 deletions
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc index f5598a2..996de7b 100644 --- a/ash/accelerators/accelerator_controller.cc +++ b/ash/accelerators/accelerator_controller.cc @@ -38,10 +38,10 @@ #include "ash/wm/workspace/snap_sizer.h" #include "base/bind.h" #include "base/command_line.h" -#include "ui/aura/event.h" #include "ui/aura/root_window.h" #include "ui/base/accelerators/accelerator.h" #include "ui/base/accelerators/accelerator_manager.h" +#include "ui/base/event.h" #include "ui/base/keycodes/keyboard_codes.h" #include "ui/compositor/debug_utils.h" #include "ui/compositor/layer.h" diff --git a/ash/accelerators/accelerator_controller_unittest.cc b/ash/accelerators/accelerator_controller_unittest.cc index d6e55e5..8b605f1 100644 --- a/ash/accelerators/accelerator_controller_unittest.cc +++ b/ash/accelerators/accelerator_controller_unittest.cc @@ -15,11 +15,11 @@ #include "ash/test/test_shell_delegate.h" #include "ash/volume_control_delegate.h" #include "ash/wm/window_util.h" -#include "ui/aura/event.h" #include "ui/aura/root_window.h" #include "ui/aura/test/test_window_delegate.h" #include "ui/aura/test/test_windows.h" #include "ui/aura/window.h" +#include "ui/base/event.h" #if defined(USE_X11) #include <X11/Xlib.h> @@ -497,17 +497,17 @@ TEST_F(AcceleratorControllerTest, ProcessOnce) { // The accelerator is processed only once. #if defined(OS_WIN) MSG msg1 = { NULL, WM_KEYDOWN, ui::VKEY_A, 0 }; - aura::TranslatedKeyEvent key_event1(msg1, false); + ui::TranslatedKeyEvent key_event1(msg1, false); EXPECT_TRUE(Shell::GetPrimaryRootWindow()->AsRootWindowHostDelegate()-> OnHostKeyEvent(&key_event1)); MSG msg2 = { NULL, WM_CHAR, L'A', 0 }; - aura::TranslatedKeyEvent key_event2(msg2, true); + ui::TranslatedKeyEvent key_event2(msg2, true); EXPECT_FALSE(Shell::GetPrimaryRootWindow()->AsRootWindowHostDelegate()-> OnHostKeyEvent(&key_event2)); MSG msg3 = { NULL, WM_KEYUP, ui::VKEY_A, 0 }; - aura::TranslatedKeyEvent key_event3(msg3, false); + ui::TranslatedKeyEvent key_event3(msg3, false); EXPECT_FALSE(Shell::GetPrimaryRootWindow()->AsRootWindowHostDelegate()-> OnHostKeyEvent(&key_event3)); #elif defined(USE_X11) @@ -516,11 +516,11 @@ TEST_F(AcceleratorControllerTest, ProcessOnce) { ui::VKEY_A, 0, &key_event); - aura::TranslatedKeyEvent key_event1(&key_event, false); + ui::TranslatedKeyEvent key_event1(&key_event, false); EXPECT_TRUE(Shell::GetPrimaryRootWindow()->AsRootWindowHostDelegate()-> OnHostKeyEvent(&key_event1)); - aura::TranslatedKeyEvent key_event2(&key_event, true); + ui::TranslatedKeyEvent key_event2(&key_event, true); EXPECT_FALSE(Shell::GetPrimaryRootWindow()->AsRootWindowHostDelegate()-> OnHostKeyEvent(&key_event2)); @@ -528,7 +528,7 @@ TEST_F(AcceleratorControllerTest, ProcessOnce) { ui::VKEY_A, 0, &key_event); - aura::TranslatedKeyEvent key_event3(&key_event, false); + ui::TranslatedKeyEvent key_event3(&key_event, false); EXPECT_FALSE(Shell::GetPrimaryRootWindow()->AsRootWindowHostDelegate()-> OnHostKeyEvent(&key_event3)); #endif diff --git a/ash/accelerators/accelerator_dispatcher.cc b/ash/accelerators/accelerator_dispatcher.cc index e435d2d..4fd7948 100644 --- a/ash/accelerators/accelerator_dispatcher.cc +++ b/ash/accelerators/accelerator_dispatcher.cc @@ -17,10 +17,10 @@ #include "ash/shell.h" #include "ash/wm/event_rewriter_event_filter.h" #include "ui/aura/env.h" -#include "ui/aura/event.h" #include "ui/aura/event_filter.h" #include "ui/aura/root_window.h" #include "ui/base/accelerators/accelerator.h" +#include "ui/base/event.h" #include "ui/base/events.h" namespace ash { @@ -70,7 +70,7 @@ bool AcceleratorDispatcher::Dispatch(const base::NativeEvent& event) { if (IsKeyEvent(event)) { // Modifiers can be changed by the user preference, so we need to rewrite // the event explicitly. - aura::KeyEvent key_event(event, false); + ui::KeyEvent key_event(event, false); aura::EventFilter* event_rewriter = ash::Shell::GetInstance()->event_rewriter_filter(); DCHECK(event_rewriter); diff --git a/ash/accelerators/accelerator_filter.cc b/ash/accelerators/accelerator_filter.cc index 01e717f..ffb2c78 100644 --- a/ash/accelerators/accelerator_filter.cc +++ b/ash/accelerators/accelerator_filter.cc @@ -7,8 +7,8 @@ #include "ash/accelerators/accelerator_controller.h" #include "ash/shell.h" #include "ash/wm/window_util.h" -#include "ui/aura/event.h" #include "ui/aura/root_window.h" +#include "ui/base/event.h" #include "ui/base/accelerators/accelerator.h" #include "ui/base/accelerators/accelerator_manager.h" @@ -62,7 +62,7 @@ AcceleratorFilter::~AcceleratorFilter() { // AcceleratorFilter, EventFilter implementation: bool AcceleratorFilter::PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) { + ui::KeyEvent* event) { const ui::EventType type = event->type(); if (type != ui::ET_KEY_PRESSED && type != ui::ET_KEY_RELEASED) return false; @@ -79,19 +79,19 @@ bool AcceleratorFilter::PreHandleKeyEvent(aura::Window* target, } bool AcceleratorFilter::PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) { + ui::MouseEvent* event) { return false; } ui::TouchStatus AcceleratorFilter::PreHandleTouchEvent( aura::Window* target, - aura::TouchEvent* event) { + ui::TouchEventImpl* event) { return ui::TOUCH_STATUS_UNKNOWN; } ui::GestureStatus AcceleratorFilter::PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) { + ui::GestureEventImpl* event) { return ui::GESTURE_STATUS_UNKNOWN; } diff --git a/ash/accelerators/accelerator_filter.h b/ash/accelerators/accelerator_filter.h index 4a1d228..6d5855d 100644 --- a/ash/accelerators/accelerator_filter.h +++ b/ash/accelerators/accelerator_filter.h @@ -22,14 +22,15 @@ class ASH_EXPORT AcceleratorFilter : public aura::EventFilter { // Overridden from aura::EventFilter: virtual bool PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) OVERRIDE; + ui::KeyEvent* event) OVERRIDE; virtual bool PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) OVERRIDE; - virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, - aura::TouchEvent* event) OVERRIDE; + ui::MouseEvent* event) OVERRIDE; + virtual ui::TouchStatus PreHandleTouchEvent( + aura::Window* target, + ui::TouchEventImpl* event) OVERRIDE; virtual ui::GestureStatus PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) OVERRIDE; + ui::GestureEventImpl* event) OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(AcceleratorFilter); diff --git a/ash/accelerators/accelerator_table.cc b/ash/accelerators/accelerator_table.cc index 5306a38..d04c595 100644 --- a/ash/accelerators/accelerator_table.cc +++ b/ash/accelerators/accelerator_table.cc @@ -5,7 +5,6 @@ #include "ash/accelerators/accelerator_table.h" #include "base/basictypes.h" -#include "ui/base/events.h" namespace ash { diff --git a/ash/accelerators/accelerator_table.h b/ash/accelerators/accelerator_table.h index 51e8688f..c5c5462 100644 --- a/ash/accelerators/accelerator_table.h +++ b/ash/accelerators/accelerator_table.h @@ -6,7 +6,7 @@ #define ASH_ACCELERATORS_ACCELERATOR_TABLE_H_ #include "ash/ash_export.h" -#include "ui/aura/event.h" +#include "ui/base/events.h" namespace ash { diff --git a/ash/display/mouse_cursor_event_filter.cc b/ash/display/mouse_cursor_event_filter.cc index c103f08..217fc3a 100644 --- a/ash/display/mouse_cursor_event_filter.cc +++ b/ash/display/mouse_cursor_event_filter.cc @@ -8,9 +8,9 @@ #include "ash/shell.h" #include "ash/wm/cursor_manager.h" #include "ui/aura/env.h" -#include "ui/aura/event.h" #include "ui/aura/root_window.h" #include "ui/aura/window.h" +#include "ui/base/event.h" namespace ash { namespace internal { @@ -25,12 +25,12 @@ MouseCursorEventFilter::~MouseCursorEventFilter() { } bool MouseCursorEventFilter::PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) { + ui::KeyEvent* event) { return false; } bool MouseCursorEventFilter::PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) { + ui::MouseEvent* event) { // Handle both MOVED and DRAGGED events here because when the mouse pointer // enters the other root window while dragging, the underlying window system // (at least X11) stops generating a ui::ET_MOUSE_MOVED event. @@ -41,20 +41,20 @@ bool MouseCursorEventFilter::PreHandleMouseEvent(aura::Window* target, aura::RootWindow* current_root = target->GetRootWindow(); gfx::Point location_in_root(event->location()); - aura::Window::ConvertPointToWindow(target, current_root, &location_in_root); + aura::Window::ConvertPointToTarget(target, current_root, &location_in_root); return display_controller_->WarpMouseCursorIfNecessary( current_root, location_in_root); } ui::TouchStatus MouseCursorEventFilter::PreHandleTouchEvent( aura::Window* target, - aura::TouchEvent* event) { + ui::TouchEventImpl* event) { return ui::TOUCH_STATUS_UNKNOWN; } ui::GestureStatus MouseCursorEventFilter::PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) { + ui::GestureEventImpl* event) { return ui::GESTURE_STATUS_UNKNOWN; } diff --git a/ash/display/mouse_cursor_event_filter.h b/ash/display/mouse_cursor_event_filter.h index 74e6198..3d95843 100644 --- a/ash/display/mouse_cursor_event_filter.h +++ b/ash/display/mouse_cursor_event_filter.h @@ -22,14 +22,15 @@ class ASH_EXPORT MouseCursorEventFilter : public aura::EventFilter { // Overridden from aura::EventFilter: virtual bool PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) OVERRIDE; + ui::KeyEvent* event) OVERRIDE; virtual bool PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) OVERRIDE; - virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, - aura::TouchEvent* event) OVERRIDE; + ui::MouseEvent* event) OVERRIDE; + virtual ui::TouchStatus PreHandleTouchEvent( + aura::Window* target, + ui::TouchEventImpl* event) OVERRIDE; virtual ui::GestureStatus PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) OVERRIDE; + ui::GestureEventImpl* event) OVERRIDE; private: DisplayController* display_controller_; diff --git a/ash/display/screen_position_controller.cc b/ash/display/screen_position_controller.cc index 430a718..124b6d2 100644 --- a/ash/display/screen_position_controller.cc +++ b/ash/display/screen_position_controller.cc @@ -56,7 +56,7 @@ void ScreenPositionController::ConvertPointToScreen( const aura::Window* window, gfx::Point* point) { const aura::RootWindow* root = window->GetRootWindow(); - aura::Window::ConvertPointToWindow(window, root, point); + aura::Window::ConvertPointToTarget(window, root, point); if (DisplayController::IsExtendedDesktopEnabled()) { const gfx::Point display_origin = gfx::Screen::GetDisplayNearestWindow( @@ -75,7 +75,7 @@ void ScreenPositionController::ConvertPointFromScreen( const_cast<aura::RootWindow*>(root)).bounds().origin(); point->Offset(-display_origin.x(), -display_origin.y()); } - aura::Window::ConvertPointToWindow(root, window, point); + aura::Window::ConvertPointToTarget(root, window, point); } void ScreenPositionController::SetBounds( diff --git a/ash/drag_drop/drag_drop_controller.cc b/ash/drag_drop/drag_drop_controller.cc index 693472d..5657cf2 100644 --- a/ash/drag_drop/drag_drop_controller.cc +++ b/ash/drag_drop/drag_drop_controller.cc @@ -14,6 +14,7 @@ #include "ui/aura/env.h" #include "ui/aura/root_window.h" #include "ui/aura/window.h" +#include "ui/base/event.h" #include "ui/base/dragdrop/drag_drop_types.h" #include "ui/base/dragdrop/os_exchange_data_provider_aura.h" #include "ui/compositor/layer.h" @@ -96,7 +97,7 @@ int DragDropController::StartDragAndDrop(const ui::OSExchangeData& data, } void DragDropController::DragUpdate(aura::Window* target, - const aura::LocatedEvent& event) { + const ui::LocatedEvent& event) { aura::client::DragDropDelegate* delegate = NULL; if (target != drag_window_) { if (drag_window_) { @@ -107,19 +108,19 @@ void DragDropController::DragUpdate(aura::Window* target, drag_window_ = target; drag_window_->AddObserver(this); if ((delegate = aura::client::GetDragDropDelegate(drag_window_))) { - aura::DropTargetEvent e(*drag_data_, - event.location(), - event.root_location(), - drag_operation_); + ui::DropTargetEvent e(*drag_data_, + event.location(), + event.root_location(), + drag_operation_); e.set_flags(event.flags()); delegate->OnDragEntered(e); } } else { if ((delegate = aura::client::GetDragDropDelegate(drag_window_))) { - aura::DropTargetEvent e(*drag_data_, - event.location(), - event.root_location(), - drag_operation_); + ui::DropTargetEvent e(*drag_data_, + event.location(), + event.root_location(), + drag_operation_); e.set_flags(event.flags()); int op = delegate->OnDragUpdated(e); gfx::NativeCursor cursor = ui::kCursorNoDrop; @@ -142,7 +143,7 @@ void DragDropController::DragUpdate(aura::Window* target, } void DragDropController::Drop(aura::Window* target, - const aura::LocatedEvent& event) { + const ui::LocatedEvent& event) { drag_cursor_ = ui::kCursorPointer; ash::Shell::GetInstance()->cursor_manager()->SetCursor(ui::kCursorPointer); aura::client::DragDropDelegate* delegate = NULL; @@ -155,7 +156,7 @@ void DragDropController::Drop(aura::Window* target, DCHECK(target == drag_window_); if ((delegate = aura::client::GetDragDropDelegate(target))) { - aura::DropTargetEvent e( + ui::DropTargetEvent e( *drag_data_, event.location(), event.root_location(), drag_operation_); e.set_flags(event.flags()); drag_operation_ = delegate->OnPerformDrop(e); @@ -200,7 +201,7 @@ gfx::NativeCursor DragDropController::GetDragCursor() { } bool DragDropController::PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) { + ui::KeyEvent* event) { if (drag_drop_in_progress_ && event->key_code() == ui::VKEY_ESCAPE) { DragCancel(); return true; @@ -209,7 +210,7 @@ bool DragDropController::PreHandleKeyEvent(aura::Window* target, } bool DragDropController::PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) { + ui::MouseEvent* event) { if (!drag_drop_in_progress_) return false; switch (event->type()) { @@ -231,7 +232,7 @@ bool DragDropController::PreHandleMouseEvent(aura::Window* target, ui::TouchStatus DragDropController::PreHandleTouchEvent( aura::Window* target, - aura::TouchEvent* event) { + ui::TouchEventImpl* event) { // TODO(sad): Also check for the touch-id. if (!drag_drop_in_progress_) return ui::TOUCH_STATUS_UNKNOWN; @@ -253,7 +254,7 @@ ui::TouchStatus DragDropController::PreHandleTouchEvent( ui::GestureStatus DragDropController::PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) { + ui::GestureEventImpl* event) { return ui::GESTURE_STATUS_UNKNOWN; } diff --git a/ash/drag_drop/drag_drop_controller.h b/ash/drag_drop/drag_drop_controller.h index 49c1aea..f3f0985 100644 --- a/ash/drag_drop/drag_drop_controller.h +++ b/ash/drag_drop/drag_drop_controller.h @@ -8,7 +8,6 @@ #include "ash/ash_export.h" #include "base/callback.h" #include "ui/aura/client/drag_drop_client.h" -#include "ui/aura/event.h" #include "ui/aura/event_filter.h" #include "ui/aura/window_observer.h" #include "ui/base/dragdrop/os_exchange_data.h" @@ -52,23 +51,24 @@ class ASH_EXPORT DragDropController const gfx::Point& root_location, int operation) OVERRIDE; virtual void DragUpdate(aura::Window* target, - const aura::LocatedEvent& event) OVERRIDE; + const ui::LocatedEvent& event) OVERRIDE; virtual void Drop(aura::Window* target, - const aura::LocatedEvent& event) OVERRIDE; + const ui::LocatedEvent& event) OVERRIDE; virtual void DragCancel() OVERRIDE; virtual bool IsDragDropInProgress() OVERRIDE; virtual gfx::NativeCursor GetDragCursor() OVERRIDE; // Overridden from aura::EventFilter: virtual bool PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) OVERRIDE; + ui::KeyEvent* event) OVERRIDE; virtual bool PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) OVERRIDE; - virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, - aura::TouchEvent* event) OVERRIDE; + ui::MouseEvent* event) OVERRIDE; + virtual ui::TouchStatus PreHandleTouchEvent( + aura::Window* target, + ui::TouchEventImpl* event) OVERRIDE; virtual ui::GestureStatus PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) OVERRIDE; + ui::GestureEventImpl* event) OVERRIDE; // Overridden from aura::WindowObserver. virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; diff --git a/ash/drag_drop/drag_drop_controller_unittest.cc b/ash/drag_drop/drag_drop_controller_unittest.cc index b56c1a3..e1f4ebd 100644 --- a/ash/drag_drop/drag_drop_controller_unittest.cc +++ b/ash/drag_drop/drag_drop_controller_unittest.cc @@ -8,13 +8,13 @@ #include "ash/test/ash_test_base.h" #include "base/location.h" #include "base/utf_string_conversions.h" -#include "ui/aura/event.h" #include "ui/aura/root_window.h" #include "ui/aura/test/event_generator.h" #include "ui/base/clipboard/clipboard.h" #include "ui/base/clipboard/scoped_clipboard_writer.h" #include "ui/base/dragdrop/drag_drop_types.h" #include "ui/base/dragdrop/os_exchange_data.h" +#include "ui/base/event.h" #include "ui/views/events/event.h" #include "ui/views/test/test_views_delegate.h" #include "ui/views/view.h" @@ -136,12 +136,12 @@ class TestDragDropController : public internal::DragDropController { } void DragUpdate(aura::Window* target, - const aura::LocatedEvent& event) OVERRIDE { + const ui::LocatedEvent& event) OVERRIDE { DragDropController::DragUpdate(target, event); num_drag_updates_++; } - void Drop(aura::Window* target, const aura::LocatedEvent& event) OVERRIDE { + void Drop(aura::Window* target, const ui::LocatedEvent& event) OVERRIDE { DragDropController::Drop(target, event); drop_received_ = true; } @@ -606,8 +606,8 @@ TEST_F(DragDropControllerTest, SyntheticEventsDuringDragDrop) { // EventGenerator since it implicitly turns these into mouse drag events. // The DragDropController should simply ignore these events. gfx::Point mouse_move_location = drag_view->bounds().CenterPoint(); - aura::MouseEvent mouse_move(ui::ET_MOUSE_MOVED, - mouse_move_location, mouse_move_location, 0); + ui::MouseEvent mouse_move(ui::ET_MOUSE_MOVED, mouse_move_location, + mouse_move_location, 0); Shell::GetPrimaryRootWindow()->AsRootWindowHostDelegate()->OnHostMouseEvent( &mouse_move); } diff --git a/ash/event_rewriter_delegate.h b/ash/event_rewriter_delegate.h index 340f283..c54c9a3 100644 --- a/ash/event_rewriter_delegate.h +++ b/ash/event_rewriter_delegate.h @@ -5,7 +5,7 @@ #ifndef ASH_EVENT_REWRITER_DELEGATE_H_ #define ASH_EVENT_REWRITER_DELEGATE_H_ -namespace aura { +namespace ui { class KeyEvent; class LocatedEvent; } // namespace aura @@ -25,8 +25,8 @@ class EventRewriterDelegate { // A derived class can do either of the following: // 1) Just return ACTION_DROP_EVENT to drop the |event|. // 2) Rewrite the |event| and return ACTION_REWRITE_EVENT. - virtual Action RewriteOrFilterKeyEvent(aura::KeyEvent* event) = 0; - virtual Action RewriteOrFilterLocatedEvent(aura::LocatedEvent* event) = 0; + virtual Action RewriteOrFilterKeyEvent(ui::KeyEvent* event) = 0; + virtual Action RewriteOrFilterLocatedEvent(ui::LocatedEvent* event) = 0; }; } // namespace ash diff --git a/ash/extended_desktop_unittest.cc b/ash/extended_desktop_unittest.cc index 63c2c36..fdfd789 100644 --- a/ash/extended_desktop_unittest.cc +++ b/ash/extended_desktop_unittest.cc @@ -457,7 +457,7 @@ TEST_F(ExtendedDesktopTest, MoveWindowWithTransient) { } namespace internal { -// Test if the Window::ConvertPointToWindow works across root windows. +// Test if the Window::ConvertPointToTarget works across root windows. // TODO(oshima): Move multiple display suport and this test to aura. TEST_F(ExtendedDesktopTest, ConvertPoint) { UpdateDisplay("1000x600,600x400"); @@ -478,18 +478,18 @@ TEST_F(ExtendedDesktopTest, ConvertPoint) { // Convert point in the Root2's window to the Root1's window Coord. gfx::Point p(0, 0); - aura::Window::ConvertPointToWindow(root_windows[1], root_windows[0], &p); + aura::Window::ConvertPointToTarget(root_windows[1], root_windows[0], &p); EXPECT_EQ("1000,0", p.ToString()); p.SetPoint(0, 0); - aura::Window::ConvertPointToWindow(d2, d1, &p); + aura::Window::ConvertPointToTarget(d2, d1, &p); EXPECT_EQ("1010,10", p.ToString()); // Convert point in the Root1's window to the Root2's window Coord. p.SetPoint(0, 0); - aura::Window::ConvertPointToWindow(root_windows[0], root_windows[1], &p); + aura::Window::ConvertPointToTarget(root_windows[0], root_windows[1], &p); EXPECT_EQ("-1000,0", p.ToString()); p.SetPoint(0, 0); - aura::Window::ConvertPointToWindow(d1, d2, &p); + aura::Window::ConvertPointToTarget(d1, d2, &p); EXPECT_EQ("-1010,-10", p.ToString()); // Move the 2nd display to the bottom and test again. @@ -501,18 +501,18 @@ TEST_F(ExtendedDesktopTest, ConvertPoint) { // Convert point in Root2's window to Root1's window Coord. p.SetPoint(0, 0); - aura::Window::ConvertPointToWindow(root_windows[1], root_windows[0], &p); + aura::Window::ConvertPointToTarget(root_windows[1], root_windows[0], &p); EXPECT_EQ("0,600", p.ToString()); p.SetPoint(0, 0); - aura::Window::ConvertPointToWindow(d2, d1, &p); + aura::Window::ConvertPointToTarget(d2, d1, &p); EXPECT_EQ("10,610", p.ToString()); // Convert point in Root1's window to Root2's window Coord. p.SetPoint(0, 0); - aura::Window::ConvertPointToWindow(root_windows[0], root_windows[1], &p); + aura::Window::ConvertPointToTarget(root_windows[0], root_windows[1], &p); EXPECT_EQ("0,-600", p.ToString()); p.SetPoint(0, 0); - aura::Window::ConvertPointToWindow(d1, d2, &p); + aura::Window::ConvertPointToTarget(d1, d2, &p); EXPECT_EQ("-10,-610", p.ToString()); } diff --git a/ash/keyboard_overlay/keyboard_overlay_view.cc b/ash/keyboard_overlay/keyboard_overlay_view.cc index 1831dcb..6545c0e 100644 --- a/ash/keyboard_overlay/keyboard_overlay_view.cc +++ b/ash/keyboard_overlay/keyboard_overlay_view.cc @@ -9,6 +9,7 @@ #include "base/utf_string_conversions.h" #include "content/public/browser/browser_context.h" #include "grit/ash_strings.h" +#include "ui/base/event.h" #include "ui/base/l10n/l10n_util.h" #include "ui/gfx/screen.h" #include "ui/views/widget/widget.h" @@ -47,7 +48,7 @@ void KeyboardOverlayView::Cancel() { widget->Close(); } -bool KeyboardOverlayView::IsCancelingKeyEvent(aura::KeyEvent* event) { +bool KeyboardOverlayView::IsCancelingKeyEvent(ui::KeyEvent* event) { if (event->type() != ui::ET_KEY_PRESSED) return false; for (size_t i = 0; i < arraysize(kCancelKeys); ++i) { diff --git a/ash/keyboard_overlay/keyboard_overlay_view.h b/ash/keyboard_overlay/keyboard_overlay_view.h index fc9fe89..0409d8b 100644 --- a/ash/keyboard_overlay/keyboard_overlay_view.h +++ b/ash/keyboard_overlay/keyboard_overlay_view.h @@ -32,7 +32,7 @@ class ASH_EXPORT KeyboardOverlayView // Overridden from ash::internal::OverlayEventFilter::Delegate: virtual void Cancel() OVERRIDE; - virtual bool IsCancelingKeyEvent(aura::KeyEvent* event) OVERRIDE; + virtual bool IsCancelingKeyEvent(ui::KeyEvent* event) OVERRIDE; virtual aura::Window* GetWindow() OVERRIDE; // Shows the keyboard overlay. diff --git a/ash/launcher/launcher_button.cc b/ash/launcher/launcher_button.cc index 00bd697..af9b0e1 100644 --- a/ash/launcher/launcher_button.cc +++ b/ash/launcher/launcher_button.cc @@ -10,7 +10,6 @@ #include "ash/launcher/launcher_button_host.h" #include "grit/ui_resources.h" #include "skia/ext/image_operations.h" -#include "ui/aura/event.h" #include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/animation/animation_delegate.h" #include "ui/base/animation/throb_animation.h" diff --git a/ash/launcher/launcher_tooltip_manager.cc b/ash/launcher/launcher_tooltip_manager.cc index 2065d3a..e83407f 100644 --- a/ash/launcher/launcher_tooltip_manager.cc +++ b/ash/launcher/launcher_tooltip_manager.cc @@ -12,9 +12,9 @@ #include "base/message_loop.h" #include "base/time.h" #include "base/timer.h" -#include "ui/aura/event.h" #include "ui/aura/root_window.h" #include "ui/aura/window.h" +#include "ui/base/event.h" #include "ui/base/events.h" #include "ui/gfx/insets.h" #include "ui/views/bubble/bubble_delegate.h" @@ -290,13 +290,13 @@ bool LauncherTooltipManager::IsVisible() { } bool LauncherTooltipManager::PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) { + ui::KeyEvent* event) { // Not handled. return false; } bool LauncherTooltipManager::PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) { + ui::MouseEvent* event) { DCHECK(target); DCHECK(event); if (!widget_ || !widget_->IsVisible()) @@ -311,12 +311,12 @@ bool LauncherTooltipManager::PreHandleMouseEvent(aura::Window* target, } gfx::Point location_in_launcher_view = event->location(); - aura::Window::ConvertPointToWindow( + aura::Window::ConvertPointToTarget( target, launcher_view_->GetWidget()->GetNativeWindow(), &location_in_launcher_view); gfx::Point location_on_screen = event->location(); - aura::Window::ConvertPointToWindow( + aura::Window::ConvertPointToTarget( target, target->GetRootWindow(), &location_on_screen); gfx::Rect bubble_rect = widget_->GetWindowBoundsInScreen(); @@ -331,14 +331,14 @@ bool LauncherTooltipManager::PreHandleMouseEvent(aura::Window* target, } ui::TouchStatus LauncherTooltipManager::PreHandleTouchEvent( - aura::Window* target, aura::TouchEvent* event) { + aura::Window* target, ui::TouchEventImpl* event) { if (widget_ && widget_->IsVisible() && widget_->GetNativeWindow() != target) Close(); return ui::TOUCH_STATUS_UNKNOWN; } ui::GestureStatus LauncherTooltipManager::PreHandleGestureEvent( - aura::Window* target, aura::GestureEvent* event) { + aura::Window* target, ui::GestureEventImpl* event) { if (widget_ && widget_->IsVisible()) { // Because this mouse event may arrive to |view_|, here we just schedule // the closing event rather than directly calling Close(). diff --git a/ash/launcher/launcher_tooltip_manager.h b/ash/launcher/launcher_tooltip_manager.h index 4e50118..95c9fcf 100644 --- a/ash/launcher/launcher_tooltip_manager.h +++ b/ash/launcher/launcher_tooltip_manager.h @@ -72,14 +72,15 @@ class ASH_EXPORT LauncherTooltipManager : public aura::EventFilter, protected: // aura::EventFilter overrides: virtual bool PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) OVERRIDE; + ui::KeyEvent* event) OVERRIDE; virtual bool PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) OVERRIDE; - virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, - aura::TouchEvent* event) OVERRIDE; + ui::MouseEvent* event) OVERRIDE; + virtual ui::TouchStatus PreHandleTouchEvent( + aura::Window* target, + ui::TouchEventImpl* event) OVERRIDE; virtual ui::GestureStatus PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) OVERRIDE; + ui::GestureEventImpl* event) OVERRIDE; // ShelfLayoutManager::Observer overrides: virtual void WillDeleteShelf() OVERRIDE; diff --git a/ash/launcher/launcher_tooltip_manager_unittest.cc b/ash/launcher/launcher_tooltip_manager_unittest.cc index 6d14c89..391d948 100644 --- a/ash/launcher/launcher_tooltip_manager_unittest.cc +++ b/ash/launcher/launcher_tooltip_manager_unittest.cc @@ -9,9 +9,9 @@ #include "ash/wm/window_util.h" #include "base/string16.h" #include "base/time.h" -#include "ui/aura/event.h" #include "ui/aura/event_filter.h" #include "ui/aura/root_window.h" +#include "ui/base/event.h" #include "ui/base/events.h" #include "ui/base/keycodes/keyboard_codes.h" #include "ui/views/widget/widget.h" @@ -141,12 +141,12 @@ TEST_F(LauncherTooltipManagerTest, ShouldHideForEvents) { aura::EventFilter* event_filter = GetEventFilter(); // Should not hide for key events. - aura::KeyEvent key_event(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE); + ui::KeyEvent key_event(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE); EXPECT_FALSE(event_filter->PreHandleKeyEvent(root_window, &key_event)); EXPECT_TRUE(TooltipIsVisible()); // Should hide for touch events. - aura::TouchEvent touch_event( + ui::TouchEventImpl touch_event( ui::ET_TOUCH_PRESSED, gfx::Point(), 0, base::TimeDelta()); EXPECT_EQ(ui::TOUCH_STATUS_UNKNOWN, event_filter->PreHandleTouchEvent(root_window, &touch_event)); @@ -161,7 +161,7 @@ TEST_F(LauncherTooltipManagerTest, ShouldHideForEvents) { EXPECT_TRUE(TooltipIsVisible()); // Should hide for gesture events. - aura::GestureEvent gesture_event( + ui::GestureEventImpl gesture_event( ui::ET_GESTURE_BEGIN, 0, 0, ui::EF_NONE, base::Time(), ui::GestureEventDetails(ui::ET_GESTURE_BEGIN, 0.0f, 0.0f), 0); EXPECT_EQ(ui::GESTURE_STATUS_UNKNOWN, @@ -181,9 +181,9 @@ TEST_F(LauncherTooltipManagerTest, HideForMouseEvent) { ASSERT_FALSE(tooltip_rect.IsEmpty()); // Shouldn't hide if the mouse is in the tooltip. - aura::MouseEvent mouse_event(ui::ET_MOUSE_MOVED, tooltip_rect.CenterPoint(), - tooltip_rect.CenterPoint(), ui::EF_NONE); - aura::LocatedEvent::TestApi test_api(&mouse_event); + ui::MouseEvent mouse_event(ui::ET_MOUSE_MOVED, tooltip_rect.CenterPoint(), + tooltip_rect.CenterPoint(), ui::EF_NONE); + ui::LocatedEvent::TestApi test_api(&mouse_event); EXPECT_FALSE(event_filter->PreHandleMouseEvent(root_window, &mouse_event)); EXPECT_TRUE(TooltipIsVisible()); diff --git a/ash/launcher/launcher_view_unittest.cc b/ash/launcher/launcher_view_unittest.cc index 5868352..8e48067 100644 --- a/ash/launcher/launcher_view_unittest.cc +++ b/ash/launcher/launcher_view_unittest.cc @@ -20,9 +20,9 @@ #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" #include "grit/ui_resources.h" -#include "ui/aura/event.h" #include "ui/aura/test/aura_test_base.h" #include "ui/aura/window.h" +#include "ui/base/event.h" #include "ui/base/events.h" #include "ui/compositor/layer.h" #include "ui/views/widget/widget.h" @@ -268,17 +268,17 @@ class LauncherViewTest : public AshTestBase { // Mouse down. views::View* button = test_api_->GetButton(button_index); - aura::MouseEvent click_event(ui::ET_MOUSE_PRESSED, - button->bounds().origin(), - button->bounds().origin(), 0); + ui::MouseEvent click_event(ui::ET_MOUSE_PRESSED, + button->bounds().origin(), + button->bounds().origin(), 0); views::MouseEvent views_click_event(&click_event); button_host->PointerPressedOnButton(button, pointer, views_click_event); // Drag. views::View* destination = test_api_->GetButton(destination_index); - aura::MouseEvent drag_event(ui::ET_MOUSE_DRAGGED, - destination->bounds().origin(), - destination->bounds().origin(), 0); + ui::MouseEvent drag_event(ui::ET_MOUSE_DRAGGED, + destination->bounds().origin(), + destination->bounds().origin(), 0); views::MouseEvent views_drag_event(&drag_event); button_host->PointerDraggedOnButton(button, pointer, views_drag_event); return button; diff --git a/ash/magnifier/magnification_controller.cc b/ash/magnifier/magnification_controller.cc index 056ea7b..22785d3 100644 --- a/ash/magnifier/magnification_controller.cc +++ b/ash/magnifier/magnification_controller.cc @@ -5,12 +5,12 @@ #include "ash/magnifier/magnification_controller.h" #include "ash/shell.h" -#include "ui/aura/event.h" #include "ui/aura/event_filter.h" #include "ui/aura/root_window.h" #include "ui/aura/shared/compound_event_filter.h" #include "ui/aura/window.h" #include "ui/aura/window_property.h" +#include "ui/base/event.h" #include "ui/gfx/point3.h" #include "ui/gfx/screen.h" #include "ui/compositor/dip_util.h" @@ -99,14 +99,15 @@ class MagnificationControllerImpl : virtual public MagnificationController, // aura::EventFilter overrides: virtual bool PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) OVERRIDE; + ui::KeyEvent* event) OVERRIDE; virtual bool PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) OVERRIDE; - virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, - aura::TouchEvent* event) OVERRIDE; + ui::MouseEvent* event) OVERRIDE; + virtual ui::TouchStatus PreHandleTouchEvent( + aura::Window* target, + ui::TouchEventImpl* event) OVERRIDE; virtual ui::GestureStatus PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) OVERRIDE; + ui::GestureEventImpl* event) OVERRIDE; aura::RootWindow* root_window_; @@ -416,14 +417,14 @@ void MagnificationControllerImpl::SetEnabled(bool enabled) { // MagnificationControllerImpl: aura::EventFilter implementation bool MagnificationControllerImpl::PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) { + ui::KeyEvent* event) { return false; } bool MagnificationControllerImpl::PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) { + ui::MouseEvent* event) { if (event->type() == ui::ET_SCROLL && event->IsAltDown()) { - aura::ScrollEvent* scroll_event = static_cast<aura::ScrollEvent*>(event); + ui::ScrollEvent* scroll_event = static_cast<ui::ScrollEvent*>(event); float scale = GetScale(); scale += scroll_event->y_offset() * kScrollScaleChangeFactor; SetScale(scale, true); @@ -447,13 +448,13 @@ bool MagnificationControllerImpl::PreHandleMouseEvent(aura::Window* target, ui::TouchStatus MagnificationControllerImpl::PreHandleTouchEvent( aura::Window* target, - aura::TouchEvent* event) { + ui::TouchEventImpl* event) { return ui::TOUCH_STATUS_UNKNOWN; } ui::GestureStatus MagnificationControllerImpl::PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) { + ui::GestureEventImpl* event) { return ui::GESTURE_STATUS_UNKNOWN; } diff --git a/ash/system/tray/tray_bubble_view.cc b/ash/system/tray/tray_bubble_view.cc index 632b070..7a6fa10 100644 --- a/ash/system/tray/tray_bubble_view.cc +++ b/ash/system/tray/tray_bubble_view.cc @@ -15,9 +15,9 @@ #include "third_party/skia/include/core/SkPaint.h" #include "third_party/skia/include/core/SkPath.h" #include "third_party/skia/include/effects/SkBlurImageFilter.h" -#include "ui/aura/event.h" #include "ui/aura/window.h" #include "ui/base/accessibility/accessible_view_state.h" +#include "ui/base/event.h" #include "ui/base/l10n/l10n_util.h" #include "ui/gfx/canvas.h" #include "ui/gfx/insets.h" @@ -456,12 +456,12 @@ void TrayBubbleView::Host::InitializeAndShowBubble(views::Widget* widget, } bool TrayBubbleView::Host::PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) { + ui::KeyEvent* event) { return false; } bool TrayBubbleView::Host::PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) { + ui::MouseEvent* event) { if (event->type() == ui::ET_MOUSE_PRESSED) ProcessLocatedEvent(*event); return false; @@ -469,7 +469,7 @@ bool TrayBubbleView::Host::PreHandleMouseEvent(aura::Window* target, ui::TouchStatus TrayBubbleView::Host::PreHandleTouchEvent( aura::Window* target, - aura::TouchEvent* event) { + ui::TouchEventImpl* event) { if (event->type() == ui::ET_TOUCH_PRESSED) ProcessLocatedEvent(*event); return ui::TOUCH_STATUS_UNKNOWN; @@ -477,12 +477,12 @@ ui::TouchStatus TrayBubbleView::Host::PreHandleTouchEvent( ui::GestureStatus TrayBubbleView::Host::PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) { + ui::GestureEventImpl* event) { return ui::GESTURE_STATUS_UNKNOWN; } void TrayBubbleView::Host::ProcessLocatedEvent( - const aura::LocatedEvent& event) { + const ui::LocatedEvent& event) { if (!widget_) return; gfx::Rect bounds = widget_->GetNativeWindow()->GetBoundsInRootWindow(); diff --git a/ash/system/tray/tray_bubble_view.h b/ash/system/tray/tray_bubble_view.h index 35fd362..5a10f9c 100644 --- a/ash/system/tray/tray_bubble_view.h +++ b/ash/system/tray/tray_bubble_view.h @@ -9,7 +9,7 @@ #include "ui/aura/event_filter.h" #include "ui/views/bubble/bubble_delegate.h" -namespace aura { +namespace ui { class LocatedEvent; } @@ -48,18 +48,18 @@ class TrayBubbleView : public views::BubbleDelegateView { // Overridden from aura::EventFilter. virtual bool PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) OVERRIDE; + ui::KeyEvent* event) OVERRIDE; virtual bool PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) OVERRIDE; + ui::MouseEvent* event) OVERRIDE; virtual ui::TouchStatus PreHandleTouchEvent( aura::Window* target, - aura::TouchEvent* event) OVERRIDE; + ui::TouchEventImpl* event) OVERRIDE; virtual ui::GestureStatus PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) OVERRIDE; + ui::GestureEventImpl* event) OVERRIDE; private: - void ProcessLocatedEvent(const aura::LocatedEvent& event); + void ProcessLocatedEvent(const ui::LocatedEvent& event); views::Widget* widget_; views::View* tray_view_; diff --git a/ash/test/test_activation_delegate.cc b/ash/test/test_activation_delegate.cc index 0e6e5ce..42711eb 100644 --- a/ash/test/test_activation_delegate.cc +++ b/ash/test/test_activation_delegate.cc @@ -7,6 +7,7 @@ #include "ash/wm/window_util.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/window.h" +#include "ui/base/event.h" namespace ash { namespace test { @@ -37,7 +38,7 @@ void TestActivationDelegate::SetWindow(aura::Window* window) { aura::client::SetActivationDelegate(window, this); } -bool TestActivationDelegate::ShouldActivate(const aura::Event* event) { +bool TestActivationDelegate::ShouldActivate(const ui::Event* event) { should_activate_count_++; return activate_; } diff --git a/ash/test/test_activation_delegate.h b/ash/test/test_activation_delegate.h index 442b2fd..296c903 100644 --- a/ash/test/test_activation_delegate.h +++ b/ash/test/test_activation_delegate.h @@ -37,7 +37,7 @@ class TestActivationDelegate : public aura::client::ActivationDelegate { } // Overridden from client::ActivationDelegate: - virtual bool ShouldActivate(const aura::Event* event) OVERRIDE; + virtual bool ShouldActivate(const ui::Event* event) OVERRIDE; virtual void OnActivated() OVERRIDE; virtual void OnLostActive() OVERRIDE; diff --git a/ash/tooltips/tooltip_controller.cc b/ash/tooltips/tooltip_controller.cc index 0274518..a73f119 100644 --- a/ash/tooltips/tooltip_controller.cc +++ b/ash/tooltips/tooltip_controller.cc @@ -15,9 +15,9 @@ #include "base/time.h" #include "ui/aura/client/drag_drop_client.h" #include "ui/aura/env.h" -#include "ui/aura/event.h" #include "ui/aura/root_window.h" #include "ui/aura/window.h" +#include "ui/base/event.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/text/text_elider.h" #include "ui/gfx/font.h" @@ -238,7 +238,7 @@ void TooltipController::SetTooltipsEnabled(bool enable) { } bool TooltipController::PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) { + ui::KeyEvent* event) { // On key press, we want to hide the tooltip and not show it until change. // This is the same behavior as hiding tooltips on timeout. Hence, we can // simply simulate a timeout. @@ -250,7 +250,7 @@ bool TooltipController::PreHandleKeyEvent(aura::Window* target, } bool TooltipController::PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) { + ui::MouseEvent* event) { switch (event->type()) { case ui::ET_MOUSE_MOVED: case ui::ET_MOUSE_DRAGGED: @@ -295,7 +295,7 @@ bool TooltipController::PreHandleMouseEvent(aura::Window* target, ui::TouchStatus TooltipController::PreHandleTouchEvent( aura::Window* target, - aura::TouchEvent* event) { + ui::TouchEventImpl* event) { // TODO(varunjain): need to properly implement tooltips for // touch events. // Hide the tooltip for touch events. @@ -309,7 +309,7 @@ ui::TouchStatus TooltipController::PreHandleTouchEvent( ui::GestureStatus TooltipController::PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) { + ui::GestureEventImpl* event) { return ui::GESTURE_STATUS_UNKNOWN; } diff --git a/ash/tooltips/tooltip_controller.h b/ash/tooltips/tooltip_controller.h index 68ddd7f..e623701 100644 --- a/ash/tooltips/tooltip_controller.h +++ b/ash/tooltips/tooltip_controller.h @@ -15,9 +15,6 @@ #include "ui/gfx/point.h" namespace aura { -class KeyEvent; -class MouseEvent; -class TouchEvent; class Window; namespace client { class DragDropClient; @@ -46,13 +43,14 @@ class ASH_EXPORT TooltipController : public aura::client::TooltipClient, // Overridden from aura::EventFilter. virtual bool PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) OVERRIDE; + ui::KeyEvent* event) OVERRIDE; virtual bool PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) OVERRIDE; - virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, - aura::TouchEvent* event) OVERRIDE; + ui::MouseEvent* event) OVERRIDE; + virtual ui::TouchStatus PreHandleTouchEvent( + aura::Window* target, + ui::TouchEventImpl* event) OVERRIDE; virtual ui::GestureStatus PreHandleGestureEvent(aura::Window* target, - aura::GestureEvent* event) OVERRIDE; + ui::GestureEventImpl* event) OVERRIDE; // Overridden from aura::WindowObserver. virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; diff --git a/ash/touch/touch_observer_hud.cc b/ash/touch/touch_observer_hud.cc index 08961ba..31d3910 100644 --- a/ash/touch/touch_observer_hud.cc +++ b/ash/touch/touch_observer_hud.cc @@ -9,7 +9,7 @@ #include "base/utf_string_conversions.h" #include "third_party/skia/include/core/SkPath.h" #include "third_party/skia/include/core/SkXfermode.h" -#include "ui/aura/event.h" +#include "ui/base/event.h" #include "ui/gfx/canvas.h" #include "ui/gfx/display.h" #include "ui/gfx/rect.h" @@ -183,18 +183,18 @@ void TouchObserverHUD::UpdateTouchPointLabel(int index) { } bool TouchObserverHUD::PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) { + ui::KeyEvent* event) { return false; } bool TouchObserverHUD::PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) { + ui::MouseEvent* event) { return false; } ui::TouchStatus TouchObserverHUD::PreHandleTouchEvent( aura::Window* target, - aura::TouchEvent* event) { + ui::TouchEventImpl* event) { if (event->touch_id() >= kMaxTouchPoints) return ui::TOUCH_STATUS_UNKNOWN; @@ -215,7 +215,7 @@ ui::TouchStatus TouchObserverHUD::PreHandleTouchEvent( ui::GestureStatus TouchObserverHUD::PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) { + ui::GestureEventImpl* event) { return ui::GESTURE_STATUS_UNKNOWN; } diff --git a/ash/touch/touch_observer_hud.h b/ash/touch/touch_observer_hud.h index 9c8ca6e..cdb2493 100644 --- a/ash/touch/touch_observer_hud.h +++ b/ash/touch/touch_observer_hud.h @@ -11,8 +11,6 @@ #include "ui/views/widget/widget_observer.h" namespace aura { -class MouseEvent; -class KeyEvent; class Window; } @@ -38,14 +36,15 @@ class TouchObserverHUD : public aura::EventFilter, // Overriden from aura::EventFilter: virtual bool PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) OVERRIDE; + ui::KeyEvent* event) OVERRIDE; virtual bool PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) OVERRIDE; - virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, - aura::TouchEvent* event) OVERRIDE; + ui::MouseEvent* event) OVERRIDE; + virtual ui::TouchStatus PreHandleTouchEvent( + aura::Window* target, + ui::TouchEventImpl* event) OVERRIDE; virtual ui::GestureStatus PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) OVERRIDE; + ui::GestureEventImpl* event) OVERRIDE; // Overridden from views::WidgetObserver: virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; diff --git a/ash/touch/touch_uma.cc b/ash/touch/touch_uma.cc index ae71ceb..3acd93d 100644 --- a/ash/touch/touch_uma.cc +++ b/ash/touch/touch_uma.cc @@ -7,10 +7,10 @@ #include "ash/shell_delegate.h" #include "base/metrics/histogram.h" #include "base/stringprintf.h" -#include "ui/aura/event.h" #include "ui/aura/root_window.h" #include "ui/aura/window.h" #include "ui/aura/window_property.h" +#include "ui/base/event.h" namespace { @@ -89,7 +89,7 @@ DEFINE_OWNED_WINDOW_PROPERTY_KEY(WindowTouchDetails, NULL); GestureActionType FindGestureActionType(aura::Window* window, - const aura::GestureEvent& event) { + const ui::GestureEventImpl& event) { if (!window || window->GetRootWindow() == window) { if (event.type() == ui::ET_GESTURE_SCROLL_BEGIN) return GESTURE_BEZEL_SCROLL; @@ -149,7 +149,7 @@ GestureActionType FindGestureActionType(aura::Window* window, return GESTURE_UNKNOWN; } -UMAEventType UMAEventTypeFromEvent(const aura::Event& event) { +UMAEventType UMAEventTypeFromEvent(const ui::Event& event) { switch (event.type()) { case ui::ET_TOUCH_RELEASED: return UMA_ET_TOUCH_RELEASED; @@ -166,8 +166,8 @@ UMAEventType UMAEventTypeFromEvent(const aura::Event& event) { case ui::ET_GESTURE_SCROLL_END: return UMA_ET_GESTURE_SCROLL_END; case ui::ET_GESTURE_SCROLL_UPDATE: { - const aura::GestureEvent& gesture = - static_cast<const aura::GestureEvent&>(event); + const ui::GestureEventImpl& gesture = + static_cast<const ui::GestureEventImpl&>(event); if (gesture.details().touch_points() >= 4) return UMA_ET_GESTURE_SCROLL_UPDATE_4P; else if (gesture.details().touch_points() == 3) @@ -193,8 +193,8 @@ UMAEventType UMAEventTypeFromEvent(const aura::Event& event) { case ui::ET_GESTURE_PINCH_END: return UMA_ET_GESTURE_PINCH_END; case ui::ET_GESTURE_PINCH_UPDATE: { - const aura::GestureEvent& gesture = - static_cast<const aura::GestureEvent&>(event); + const ui::GestureEventImpl& gesture = + static_cast<const ui::GestureEventImpl&>(event); if (gesture.details().touch_points() >= 4) return UMA_ET_GESTURE_PINCH_UPDATE_4P; else if (gesture.details().touch_points() == 3) @@ -204,8 +204,8 @@ UMAEventType UMAEventTypeFromEvent(const aura::Event& event) { case ui::ET_GESTURE_LONG_PRESS: return UMA_ET_GESTURE_LONG_PRESS; case ui::ET_GESTURE_MULTIFINGER_SWIPE: { - const aura::GestureEvent& gesture = - static_cast<const aura::GestureEvent&>(event); + const ui::GestureEventImpl& gesture = + static_cast<const ui::GestureEventImpl&>(event); if (gesture.details().touch_points() >= 4) return UMA_ET_GESTURE_MULTIFINGER_SWIPE_4P; else if (gesture.details().touch_points() == 3) @@ -235,7 +235,7 @@ TouchUMA::~TouchUMA() { } void TouchUMA::RecordGestureEvent(aura::Window* target, - const aura::GestureEvent& event) { + const ui::GestureEventImpl& event) { UMA_HISTOGRAM_ENUMERATION("Ash.GestureCreated", UMAEventTypeFromEvent(event), UMA_ET_COUNT); @@ -256,7 +256,7 @@ void TouchUMA::RecordGestureEvent(aura::Window* target, } void TouchUMA::RecordTouchEvent(aura::Window* target, - const aura::TouchEvent& event) { + const ui::TouchEventImpl& event) { UMA_HISTOGRAM_CUSTOM_COUNTS("Ash.TouchRadius", static_cast<int>(std::max(event.radius_x(), event.radius_y())), 1, 500, 100); diff --git a/ash/touch/touch_uma.h b/ash/touch/touch_uma.h index 01a8055..72daed9 100644 --- a/ash/touch/touch_uma.h +++ b/ash/touch/touch_uma.h @@ -13,8 +13,6 @@ #include "ui/views/widget/widget.h" namespace aura { -class GestureEvent; -class TouchEvent; class Window; } @@ -29,9 +27,9 @@ class TouchUMA { ~TouchUMA(); void RecordGestureEvent(aura::Window* target, - const aura::GestureEvent& event); + const ui::GestureEventImpl& event); void RecordTouchEvent(aura::Window* target, - const aura::TouchEvent& event); + const ui::TouchEventImpl& event); private: DISALLOW_COPY_AND_ASSIGN(TouchUMA); diff --git a/ash/wm/activation_controller.cc b/ash/wm/activation_controller.cc index 668271b..3685d79 100644 --- a/ash/wm/activation_controller.cc +++ b/ash/wm/activation_controller.cc @@ -85,7 +85,7 @@ bool VisibilityMatches(aura::Window* window, ActivateVisibilityType type) { // A window manager typically defines some notion of "top level window" that // supports activation/deactivation. bool CanActivateWindowWithEvent(aura::Window* window, - const aura::Event* event, + const ui::Event* event, ActivateVisibilityType visibility_type) { return window && VisibilityMatches(window, visibility_type) && @@ -130,7 +130,7 @@ ActivationController::~ActivationController() { // static aura::Window* ActivationController::GetActivatableWindow( aura::Window* window, - const aura::Event* event) { + const ui::Event* event) { aura::Window* parent = window->parent(); aura::Window* child = window; while (parent) { @@ -178,7 +178,7 @@ aura::Window* ActivationController::GetActiveWindow() { } bool ActivationController::OnWillFocusWindow(aura::Window* window, - const aura::Event* event) { + const ui::Event* event) { return CanActivateWindowWithEvent( GetActivatableWindow(window, event), event, CURRENT_VISIBILITY); } @@ -230,7 +230,7 @@ void ActivationController::OnWindowFocused(aura::Window* window) { // ActivationController, private: void ActivationController::ActivateWindowWithEvent(aura::Window* window, - const aura::Event* event) { + const ui::Event* event) { aura::Window* window_modal_transient = wm::GetWindowModalTransient(window); if (window_modal_transient) { ActivateWindow(window_modal_transient); diff --git a/ash/wm/activation_controller.h b/ash/wm/activation_controller.h index 30b08cc..6d8f870 100644 --- a/ash/wm/activation_controller.h +++ b/ash/wm/activation_controller.h @@ -38,7 +38,7 @@ class ASH_EXPORT ActivationController // activation. |event| is the revent responsible for initiating the change, or // NULL if there is no event. static aura::Window* GetActivatableWindow(aura::Window* window, - const aura::Event* event); + const ui::Event* event); // Overridden from aura::client::ActivationClient: virtual void AddObserver( @@ -49,7 +49,7 @@ class ASH_EXPORT ActivationController virtual void DeactivateWindow(aura::Window* window) OVERRIDE; virtual aura::Window* GetActiveWindow() OVERRIDE; virtual bool OnWillFocusWindow(aura::Window* window, - const aura::Event* event) OVERRIDE; + const ui::Event* event) OVERRIDE; virtual bool CanActivateWindow(aura::Window* window) const OVERRIDE; // Overridden from aura::WindowObserver: @@ -66,7 +66,7 @@ class ASH_EXPORT ActivationController private: // Implementation of ActivateWindow() with an Event. void ActivateWindowWithEvent(aura::Window* window, - const aura::Event* event); + const ui::Event* event); // Shifts activation to the next window, ignoring |window|. Returns the next // window. diff --git a/ash/wm/app_list_controller.cc b/ash/wm/app_list_controller.cc index b7cc863..19eb91f 100644 --- a/ash/wm/app_list_controller.cc +++ b/ash/wm/app_list_controller.cc @@ -14,10 +14,10 @@ #include "ui/app_list/app_list_view.h" #include "ui/app_list/icon_cache.h" #include "ui/app_list/pagination_model.h" -#include "ui/aura/event.h" #include "ui/aura/focus_manager.h" #include "ui/aura/root_window.h" #include "ui/aura/window.h" +#include "ui/base/event.h" #include "ui/compositor/layer.h" #include "ui/compositor/scoped_layer_animation_settings.h" #include "ui/gfx/transform_util.h" @@ -202,7 +202,7 @@ void AppListController::ScheduleAnimation() { } void AppListController::ProcessLocatedEvent(aura::Window* target, - const aura::LocatedEvent& event) { + const ui::LocatedEvent& event) { // If the event happened on a menu, then the event should not close the app // list. if (target) { @@ -234,12 +234,12 @@ void AppListController::UpdateBounds() { // AppListController, aura::EventFilter implementation: bool AppListController::PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) { + ui::KeyEvent* event) { return false; } bool AppListController::PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) { + ui::MouseEvent* event) { if (event->type() == ui::ET_MOUSE_PRESSED) ProcessLocatedEvent(target, *event); return false; @@ -247,13 +247,13 @@ bool AppListController::PreHandleMouseEvent(aura::Window* target, ui::TouchStatus AppListController::PreHandleTouchEvent( aura::Window* target, - aura::TouchEvent* event) { + ui::TouchEventImpl* event) { return ui::TOUCH_STATUS_UNKNOWN; } ui::GestureStatus AppListController::PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) { + ui::GestureEventImpl* event) { if (event->type() == ui::ET_GESTURE_TAP) ProcessLocatedEvent(target, *event); return ui::GESTURE_STATUS_UNKNOWN; diff --git a/ash/wm/app_list_controller.h b/ash/wm/app_list_controller.h index 39ae2e43..32fdb6a 100644 --- a/ash/wm/app_list_controller.h +++ b/ash/wm/app_list_controller.h @@ -21,7 +21,7 @@ class AppListView; class PaginationModel; } -namespace aura { +namespace ui { class LocatedEvent; } @@ -68,21 +68,22 @@ class AppListController : public aura::EventFilter, void ScheduleAnimation(); void ProcessLocatedEvent(aura::Window* target, - const aura::LocatedEvent& event); + const ui::LocatedEvent& event); // Makes app list bubble update its bounds. void UpdateBounds(); // aura::EventFilter overrides: virtual bool PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) OVERRIDE; + ui::KeyEvent* event) OVERRIDE; virtual bool PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) OVERRIDE; - virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, - aura::TouchEvent* event) OVERRIDE; + ui::MouseEvent* event) OVERRIDE; + virtual ui::TouchStatus PreHandleTouchEvent( + aura::Window* target, + ui::TouchEventImpl* event) OVERRIDE; virtual ui::GestureStatus PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) OVERRIDE; + ui::GestureEventImpl* event) OVERRIDE; // aura::FocusChangeObserver overrides: virtual void OnWindowFocused(aura::Window* window) OVERRIDE; diff --git a/ash/wm/coordinate_conversion.cc b/ash/wm/coordinate_conversion.cc index 55dd25a..f2588ce 100644 --- a/ash/wm/coordinate_conversion.cc +++ b/ash/wm/coordinate_conversion.cc @@ -35,7 +35,7 @@ std::pair<aura::RootWindow*, gfx::Point> GetRootWindowRelativeToWindow( const gfx::Point& location) { aura::RootWindow* root_window = window->GetRootWindow(); gfx::Point location_in_root(location); - aura::Window::ConvertPointToWindow(window, root_window, &location_in_root); + aura::Window::ConvertPointToTarget(window, root_window, &location_in_root); #if defined(USE_X11) // This conversion is necessary for dealing with the "pointer warp" feature in diff --git a/ash/wm/event_rewriter_event_filter.cc b/ash/wm/event_rewriter_event_filter.cc index 5f982b5..acab56c 100644 --- a/ash/wm/event_rewriter_event_filter.cc +++ b/ash/wm/event_rewriter_event_filter.cc @@ -6,7 +6,7 @@ #include "ash/event_rewriter_delegate.h" #include "base/logging.h" -#include "ui/aura/event.h" +#include "ui/base/event.h" namespace ash { namespace internal { @@ -21,7 +21,7 @@ void EventRewriterEventFilter::SetEventRewriterDelegate( } bool EventRewriterEventFilter::PreHandleKeyEvent( - aura::Window* target, aura::KeyEvent* event) { + aura::Window* target, ui::KeyEvent* event) { if (!delegate_.get()) return false; @@ -43,7 +43,7 @@ bool EventRewriterEventFilter::PreHandleKeyEvent( } bool EventRewriterEventFilter::PreHandleMouseEvent( - aura::Window* target, aura::MouseEvent* event) { + aura::Window* target, ui::MouseEvent* event) { if (!delegate_.get()) return false; @@ -59,12 +59,12 @@ bool EventRewriterEventFilter::PreHandleMouseEvent( } ui::TouchStatus EventRewriterEventFilter::PreHandleTouchEvent( - aura::Window* target, aura::TouchEvent* event) { + aura::Window* target, ui::TouchEventImpl* event) { return ui::TOUCH_STATUS_UNKNOWN; // Not handled. } ui::GestureStatus EventRewriterEventFilter::PreHandleGestureEvent( - aura::Window* target, aura::GestureEvent* event) { + aura::Window* target, ui::GestureEventImpl* event) { return ui::GESTURE_STATUS_UNKNOWN; // Not handled. } diff --git a/ash/wm/event_rewriter_event_filter.h b/ash/wm/event_rewriter_event_filter.h index 5d7beb1..51f5a9c 100644 --- a/ash/wm/event_rewriter_event_filter.h +++ b/ash/wm/event_rewriter_event_filter.h @@ -28,15 +28,15 @@ class ASH_EXPORT EventRewriterEventFilter : public aura::EventFilter { private: // Overridden from aura::EventFilter: virtual bool PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) OVERRIDE; + ui::KeyEvent* event) OVERRIDE; virtual bool PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) OVERRIDE; + ui::MouseEvent* event) OVERRIDE; virtual ui::TouchStatus PreHandleTouchEvent( aura::Window* target, - aura::TouchEvent* event) OVERRIDE; + ui::TouchEventImpl* event) OVERRIDE; virtual ui::GestureStatus PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) OVERRIDE; + ui::GestureEventImpl* event) OVERRIDE; scoped_ptr<EventRewriterDelegate> delegate_; diff --git a/ash/wm/maximize_bubble_controller.cc b/ash/wm/maximize_bubble_controller.cc index 601a999..2746aec 100644 --- a/ash/wm/maximize_bubble_controller.cc +++ b/ash/wm/maximize_bubble_controller.cc @@ -11,7 +11,6 @@ #include "base/timer.h" #include "grit/ash_strings.h" #include "grit/ui_resources.h" -#include "ui/aura/event.h" #include "ui/aura/focus_manager.h" #include "ui/aura/window.h" #include "ui/base/l10n/l10n_util.h" diff --git a/ash/wm/overlay_event_filter.cc b/ash/wm/overlay_event_filter.cc index f575fe4..f977f3e 100644 --- a/ash/wm/overlay_event_filter.cc +++ b/ash/wm/overlay_event_filter.cc @@ -7,6 +7,7 @@ #include "ash/wm/partial_screenshot_view.h" #include "ui/aura/window.h" #include "ui/aura/window_delegate.h" +#include "ui/base/event.h" #include "ui/views/widget/widget.h" namespace ash { @@ -21,7 +22,7 @@ OverlayEventFilter::~OverlayEventFilter() { } bool OverlayEventFilter::PreHandleKeyEvent( - aura::Window* target, aura::KeyEvent* event) { + aura::Window* target, ui::KeyEvent* event) { if (!delegate_) return false; @@ -48,7 +49,7 @@ bool OverlayEventFilter::PreHandleKeyEvent( } bool OverlayEventFilter::PreHandleMouseEvent( - aura::Window* target, aura::MouseEvent* event) { + aura::Window* target, ui::MouseEvent* event) { if (delegate_) { DCHECK_EQ(target, delegate_->GetWindow()); target->delegate()->OnMouseEvent(event); @@ -58,12 +59,12 @@ bool OverlayEventFilter::PreHandleMouseEvent( } ui::TouchStatus OverlayEventFilter::PreHandleTouchEvent( - aura::Window* target, aura::TouchEvent* event) { + aura::Window* target, ui::TouchEventImpl* event) { return ui::TOUCH_STATUS_UNKNOWN; // Not handled. } ui::GestureStatus OverlayEventFilter::PreHandleGestureEvent( - aura::Window* target, aura::GestureEvent* event) { + aura::Window* target, ui::GestureEventImpl* event) { return ui::GESTURE_STATUS_UNKNOWN; // Not handled. } diff --git a/ash/wm/overlay_event_filter.h b/ash/wm/overlay_event_filter.h index 9390d80..ed1456c 100644 --- a/ash/wm/overlay_event_filter.h +++ b/ash/wm/overlay_event_filter.h @@ -7,7 +7,6 @@ #include "ash/shell_observer.h" #include "base/compiler_specific.h" -#include "ui/aura/event.h" #include "ui/aura/event_filter.h" namespace ash { @@ -29,7 +28,7 @@ class OverlayEventFilter : public aura::EventFilter, virtual void Cancel() = 0; // Returns true if the overlay should be canceled in response to |event|. - virtual bool IsCancelingKeyEvent(aura::KeyEvent* event) = 0; + virtual bool IsCancelingKeyEvent(ui::KeyEvent* event) = 0; // Returns the window that needs to receive events. virtual aura::Window* GetWindow() = 0; @@ -52,13 +51,13 @@ class OverlayEventFilter : public aura::EventFilter, // aura::EventFilter overrides: virtual bool PreHandleKeyEvent( - aura::Window* target, aura::KeyEvent* event) OVERRIDE; + aura::Window* target, ui::KeyEvent* event) OVERRIDE; virtual bool PreHandleMouseEvent( - aura::Window* target, aura::MouseEvent* event) OVERRIDE; + aura::Window* target, ui::MouseEvent* event) OVERRIDE; virtual ui::TouchStatus PreHandleTouchEvent( - aura::Window* target, aura::TouchEvent* event) OVERRIDE; + aura::Window* target, ui::TouchEventImpl* event) OVERRIDE; virtual ui::GestureStatus PreHandleGestureEvent( - aura::Window* target, aura::GestureEvent* event) OVERRIDE; + aura::Window* target, ui::GestureEventImpl* event) OVERRIDE; // ShellObserver overrides: virtual void OnLoginStateChanged(user::LoginStatus status) OVERRIDE; diff --git a/ash/wm/panel_layout_manager.cc b/ash/wm/panel_layout_manager.cc index 52599f3..e1f600f 100644 --- a/ash/wm/panel_layout_manager.cc +++ b/ash/wm/panel_layout_manager.cc @@ -274,7 +274,7 @@ void PanelLayoutManager::Relayout() { } gfx::Point icon_origin = icon_bounds.origin(); - aura::Window::ConvertPointToWindow(panel_container_->GetRootWindow(), + aura::Window::ConvertPointToTarget(panel_container_->GetRootWindow(), panel_container_, &icon_origin); // TODO(dcheng): Need to clamp to screen edges. diff --git a/ash/wm/panel_window_event_filter.cc b/ash/wm/panel_window_event_filter.cc index e8caa17..461ced0 100644 --- a/ash/wm/panel_window_event_filter.cc +++ b/ash/wm/panel_window_event_filter.cc @@ -7,11 +7,11 @@ #include "ash/wm/window_util.h" #include "base/message_loop.h" #include "ui/aura/client/aura_constants.h" -#include "ui/aura/event.h" #include "ui/aura/root_window.h" #include "ui/aura/window.h" #include "ui/aura/window_delegate.h" #include "ui/base/cursor/cursor.h" +#include "ui/base/event.h" #include "ui/base/hit_test.h" #include "ui/base/ui_base_types.h" #include "ui/compositor/scoped_layer_animation_settings.h" @@ -34,12 +34,12 @@ PanelWindowEventFilter::~PanelWindowEventFilter() { } bool PanelWindowEventFilter::PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) { + ui::KeyEvent* event) { return false; } bool PanelWindowEventFilter::PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) { + ui::MouseEvent* event) { switch (event->type()) { case ui::ET_MOUSE_PRESSED: { int hitResult = target->delegate()-> @@ -97,21 +97,21 @@ bool PanelWindowEventFilter::PreHandleMouseEvent(aura::Window* target, ui::TouchStatus PanelWindowEventFilter::PreHandleTouchEvent( aura::Window* target, - aura::TouchEvent* event) { + ui::TouchEventImpl* event) { return ui::TOUCH_STATUS_UNKNOWN; } ui::GestureStatus PanelWindowEventFilter::PreHandleGestureEvent( - aura::Window* target, aura::GestureEvent* event) { + aura::Window* target, ui::GestureEventImpl* event) { return ui::GESTURE_STATUS_UNKNOWN; } bool PanelWindowEventFilter::HandleDrag(aura::Window* target, - aura::LocatedEvent* event) { + ui::LocatedEvent* event) { gfx::Rect target_bounds = dragged_panel_->bounds(); gfx::Point event_location_in_parent(event->location()); - aura::Window::ConvertPointToWindow(target, + aura::Window::ConvertPointToTarget(target, target->parent(), &event_location_in_parent); target_bounds.set_x( diff --git a/ash/wm/panel_window_event_filter.h b/ash/wm/panel_window_event_filter.h index 5234bc9..ba40003 100644 --- a/ash/wm/panel_window_event_filter.h +++ b/ash/wm/panel_window_event_filter.h @@ -11,11 +11,13 @@ #include "ui/gfx/rect.h" namespace aura { -class LocatedEvent; -class MouseEvent; class Window; } +namespace ui { +class LocatedEvent; +} + namespace ash { namespace internal { @@ -27,14 +29,15 @@ class PanelWindowEventFilter : public aura::EventFilter { // Overriden from aura::EventFilter: virtual bool PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) OVERRIDE; + ui::KeyEvent* event) OVERRIDE; virtual bool PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) OVERRIDE; - virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, - aura::TouchEvent* event) OVERRIDE; + ui::MouseEvent* event) OVERRIDE; + virtual ui::TouchStatus PreHandleTouchEvent( + aura::Window* target, + ui::TouchEventImpl* event) OVERRIDE; virtual ui::GestureStatus PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) OVERRIDE; + ui::GestureEventImpl* event) OVERRIDE; private: enum DragState { @@ -43,7 +46,7 @@ class PanelWindowEventFilter : public aura::EventFilter { DRAG_STARTED }; - bool HandleDrag(aura::Window* target, aura::LocatedEvent* event); + bool HandleDrag(aura::Window* target, ui::LocatedEvent* event); void FinishDrag(); aura::Window* panel_container_; diff --git a/ash/wm/partial_screenshot_view.cc b/ash/wm/partial_screenshot_view.cc index 868bdc9..3c7c321 100644 --- a/ash/wm/partial_screenshot_view.cc +++ b/ash/wm/partial_screenshot_view.cc @@ -10,6 +10,7 @@ #include "ash/wm/overlay_event_filter.h" #include "ui/aura/root_window.h" #include "ui/base/cursor/cursor.h" +#include "ui/base/event.h" #include "ui/gfx/canvas.h" #include "ui/gfx/rect.h" #include "ui/views/view.h" @@ -70,7 +71,7 @@ void PartialScreenshotView::Cancel() { widget->Close(); } -bool PartialScreenshotView::IsCancelingKeyEvent(aura::KeyEvent* event) { +bool PartialScreenshotView::IsCancelingKeyEvent(ui::KeyEvent* event) { return event->key_code() == ui::VKEY_ESCAPE; } diff --git a/ash/wm/partial_screenshot_view.h b/ash/wm/partial_screenshot_view.h index b431e27..c00d90d 100644 --- a/ash/wm/partial_screenshot_view.h +++ b/ash/wm/partial_screenshot_view.h @@ -32,7 +32,7 @@ class ASH_EXPORT PartialScreenshotView // Overridden from internal::OverlayEventFilter::Delegate: virtual void Cancel() OVERRIDE; - virtual bool IsCancelingKeyEvent(aura::KeyEvent* event) OVERRIDE; + virtual bool IsCancelingKeyEvent(ui::KeyEvent* event) OVERRIDE; virtual aura::Window* GetWindow() OVERRIDE; private: diff --git a/ash/wm/shelf_layout_manager.cc b/ash/wm/shelf_layout_manager.cc index 81d6e39..6c0d9e6 100644 --- a/ash/wm/shelf_layout_manager.cc +++ b/ash/wm/shelf_layout_manager.cc @@ -18,9 +18,9 @@ #include "base/auto_reset.h" #include "base/i18n/rtl.h" #include "ui/aura/client/activation_client.h" -#include "ui/aura/event.h" #include "ui/aura/event_filter.h" #include "ui/aura/root_window.h" +#include "ui/base/event.h" #include "ui/compositor/layer.h" #include "ui/compositor/layer_animation_observer.h" #include "ui/compositor/layer_animator.h" @@ -59,14 +59,15 @@ class ShelfLayoutManager::AutoHideEventFilter : public aura::EventFilter { // Overridden from aura::EventFilter: virtual bool PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) OVERRIDE; + ui::KeyEvent* event) OVERRIDE; virtual bool PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) OVERRIDE; - virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, - aura::TouchEvent* event) OVERRIDE; + ui::MouseEvent* event) OVERRIDE; + virtual ui::TouchStatus PreHandleTouchEvent( + aura::Window* target, + ui::TouchEventImpl* event) OVERRIDE; virtual ui::GestureStatus PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) OVERRIDE; + ui::GestureEventImpl* event) OVERRIDE; private: ShelfLayoutManager* shelf_; @@ -88,13 +89,13 @@ ShelfLayoutManager::AutoHideEventFilter::~AutoHideEventFilter() { bool ShelfLayoutManager::AutoHideEventFilter::PreHandleKeyEvent( aura::Window* target, - aura::KeyEvent* event) { + ui::KeyEvent* event) { return false; // Always let the event propagate. } bool ShelfLayoutManager::AutoHideEventFilter::PreHandleMouseEvent( aura::Window* target, - aura::MouseEvent* event) { + ui::MouseEvent* event) { // This also checks IsShelfWindow() to make sure we don't attempt to hide the // shelf if the mouse down occurs on the shelf. in_mouse_drag_ = (event->type() == ui::ET_MOUSE_DRAGGED || @@ -108,14 +109,14 @@ bool ShelfLayoutManager::AutoHideEventFilter::PreHandleMouseEvent( ui::TouchStatus ShelfLayoutManager::AutoHideEventFilter::PreHandleTouchEvent( aura::Window* target, - aura::TouchEvent* event) { + ui::TouchEventImpl* event) { return ui::TOUCH_STATUS_UNKNOWN; // Not handled. } ui::GestureStatus ShelfLayoutManager::AutoHideEventFilter::PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) { + ui::GestureEventImpl* event) { return ui::GESTURE_STATUS_UNKNOWN; // Not handled. } diff --git a/ash/wm/system_gesture_event_filter.cc b/ash/wm/system_gesture_event_filter.cc index c0b764c..6bb5d8a 100644 --- a/ash/wm/system_gesture_event_filter.cc +++ b/ash/wm/system_gesture_event_filter.cc @@ -25,8 +25,8 @@ #include "third_party/skia/include/core/SkPath.h" #include "third_party/skia/include/core/SkRect.h" #include "third_party/skia/include/effects/SkGradientShader.h" -#include "ui/aura/event.h" #include "ui/aura/root_window.h" +#include "ui/base/event.h" #include "ui/base/gestures/gesture_configuration.h" #include "ui/base/gestures/gesture_util.h" #include "ui/compositor/scoped_layer_animation_settings.h" @@ -291,7 +291,7 @@ LongPressAffordanceAnimation::LongPressAffordanceAnimation() LongPressAffordanceAnimation::~LongPressAffordanceAnimation() {} void LongPressAffordanceAnimation::ProcessEvent(aura::Window* target, - aura::LocatedEvent* event) { + ui::LocatedEvent* event) { // Once we have a target, we are only interested in events on that target. if (tap_down_target_ && tap_down_target_ != target) return; @@ -374,7 +374,7 @@ class SystemPinchHandler { ~SystemPinchHandler() { } - SystemGestureStatus ProcessGestureEvent(const aura::GestureEvent& event) { + SystemGestureStatus ProcessGestureEvent(const ui::GestureEventImpl& event) { // The target has changed, somehow. Let's bale. if (!widget_ || !widget_->widget_delegate()->CanResize()) return SYSTEM_GESTURE_END; @@ -526,12 +526,12 @@ SystemGestureEventFilter::~SystemGestureEventFilter() { } bool SystemGestureEventFilter::PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) { + ui::KeyEvent* event) { return false; } bool SystemGestureEventFilter::PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) { + ui::MouseEvent* event) { #if defined(OS_CHROMEOS) if (event->type() == ui::ET_MOUSE_PRESSED && event->native_event() && ui::TouchFactory::GetInstance()->IsTouchDevicePresent()) { @@ -544,14 +544,14 @@ bool SystemGestureEventFilter::PreHandleMouseEvent(aura::Window* target, ui::TouchStatus SystemGestureEventFilter::PreHandleTouchEvent( aura::Window* target, - aura::TouchEvent* event) { + ui::TouchEventImpl* event) { touch_uma_.RecordTouchEvent(target, *event); long_press_affordance_->ProcessEvent(target, event); return ui::TOUCH_STATUS_UNKNOWN; } ui::GestureStatus SystemGestureEventFilter::PreHandleGestureEvent( - aura::Window* target, aura::GestureEvent* event) { + aura::Window* target, ui::GestureEventImpl* event) { touch_uma_.RecordGestureEvent(target, *event); long_press_affordance_->ProcessEvent(target, event); if (!target || target == target->GetRootWindow()) { @@ -675,8 +675,9 @@ void SystemGestureEventFilter::ClearGestureHandlerForWindow( window->RemoveObserver(this); } -bool SystemGestureEventFilter::HandleDeviceControl(aura::Window* target, - aura::GestureEvent* event) { +bool SystemGestureEventFilter::HandleDeviceControl( + aura::Window* target, + ui::GestureEventImpl* event) { gfx::Rect screen = gfx::Screen::GetDisplayNearestWindow(target).bounds(); double percent = 100.0 * (event->y() - screen.y()) / screen.height(); if (percent > 100.0) @@ -703,7 +704,7 @@ bool SystemGestureEventFilter::HandleDeviceControl(aura::Window* target, } bool SystemGestureEventFilter::HandleLauncherControl( - aura::GestureEvent* event) { + ui::GestureEventImpl* event) { if (start_location_ == BEZEL_START_BOTTOM && event->details().scroll_y() < 0) { ash::AcceleratorController* accelerator = @@ -716,7 +717,7 @@ bool SystemGestureEventFilter::HandleLauncherControl( } bool SystemGestureEventFilter::HandleApplicationControl( - aura::GestureEvent* event) { + ui::GestureEventImpl* event) { ash::AcceleratorController* accelerator = ash::Shell::GetInstance()->accelerator_controller(); if (start_location_ == BEZEL_START_LEFT && event->details().scroll_x() > 0) diff --git a/ash/wm/system_gesture_event_filter.h b/ash/wm/system_gesture_event_filter.h index 05d1562..466ec04 100644 --- a/ash/wm/system_gesture_event_filter.h +++ b/ash/wm/system_gesture_event_filter.h @@ -17,12 +17,13 @@ #include <map> namespace aura { -class KeyEvent; -class LocatedEvent; -class MouseEvent; class Window; } +namespace ui { +class LocatedEvent; +} + namespace ash { namespace test { @@ -58,7 +59,7 @@ class LongPressAffordanceAnimation : public ui::AnimationDelegate, virtual ~LongPressAffordanceAnimation(); // Display or removes long press affordance according to the |event|. - void ProcessEvent(aura::Window* target, aura::LocatedEvent* event); + void ProcessEvent(aura::Window* target, ui::LocatedEvent* event); private: friend class ash::test::SystemGestureEventFilterTest; @@ -92,14 +93,15 @@ class SystemGestureEventFilter : public aura::EventFilter, // Overridden from aura::EventFilter: virtual bool PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) OVERRIDE; + ui::KeyEvent* event) OVERRIDE; virtual bool PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) OVERRIDE; - virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, - aura::TouchEvent* event) OVERRIDE; + ui::MouseEvent* event) OVERRIDE; + virtual ui::TouchStatus PreHandleTouchEvent( + aura::Window* target, + ui::TouchEventImpl* event) OVERRIDE; virtual ui::GestureStatus PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) OVERRIDE; + ui::GestureEventImpl* event) OVERRIDE; // Overridden from aura::WindowObserver. virtual void OnWindowVisibilityChanged(aura::Window* window, @@ -114,15 +116,15 @@ class SystemGestureEventFilter : public aura::EventFilter, // Handle events meant for volume / brightness. Returns true when no further // events from this gesture should be sent. - bool HandleDeviceControl(aura::Window* target, aura::GestureEvent* event); + bool HandleDeviceControl(aura::Window* target, ui::GestureEventImpl* event); // Handle events meant for showing the launcher. Returns true when no further // events from this gesture should be sent. - bool HandleLauncherControl(aura::GestureEvent* event); + bool HandleLauncherControl(ui::GestureEventImpl* event); // Handle events meant to switch through applications. Returns true when no // further events from this gesture should be sent. - bool HandleApplicationControl(aura::GestureEvent* event); + bool HandleApplicationControl(ui::GestureEventImpl* event); typedef std::map<aura::Window*, SystemPinchHandler*> WindowPinchHandlerMap; // Created on demand when a system-level pinch gesture is initiated. Destroyed diff --git a/ash/wm/system_gesture_event_filter_unittest.cc b/ash/wm/system_gesture_event_filter_unittest.cc index 169bbe3..ed83863 100644 --- a/ash/wm/system_gesture_event_filter_unittest.cc +++ b/ash/wm/system_gesture_event_filter_unittest.cc @@ -15,10 +15,10 @@ #include "ash/volume_control_delegate.h" #include "ash/wm/window_util.h" #include "base/time.h" -#include "ui/aura/event.h" #include "ui/aura/root_window.h" #include "ui/aura/test/event_generator.h" #include "ui/aura/test/test_windows.h" +#include "ui/base/event.h" #include "ui/gfx/screen.h" #include "ui/views/widget/widget_delegate.h" @@ -138,13 +138,13 @@ class SystemGestureEventFilterTest : public AshTestBase { DISALLOW_COPY_AND_ASSIGN(SystemGestureEventFilterTest); }; -aura::GestureEvent* CreateGesture(ui::EventType type, - int x, - int y, - float delta_x, - float delta_y, - int touch_id) { - return new aura::GestureEvent(type, x, y, 0, base::Time::Now(), +ui::GestureEventImpl* CreateGesture(ui::EventType type, + int x, + int y, + float delta_x, + float delta_y, + int touch_id) { + return new ui::GestureEventImpl(type, x, y, 0, base::Time::Now(), ui::GestureEventDetails(type, delta_x, delta_y), 1 << touch_id); } @@ -158,11 +158,11 @@ TEST_F(SystemGestureEventFilterTest, TapOutsideRootWindow) { const int kTouchId = 5; // A touch outside the root window will be associated with the root window - aura::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(-10, -10), kTouchId, + ui::TouchEventImpl press(ui::ET_TOUCH_PRESSED, gfx::Point(-10, -10), kTouchId, base::Time::NowFromSystemTime() - base::Time()); root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); - aura::GestureEvent* event = CreateGesture( + ui::GestureEventImpl* event = CreateGesture( ui::ET_GESTURE_TAP, 0, 0, 0, 0, kTouchId); bool consumed = root_window->DispatchGestureEvent(event); @@ -173,7 +173,7 @@ TEST_F(SystemGestureEventFilterTest, TapOutsideRootWindow) { Shell::GetInstance()->RemoveEnvEventFilter( shell_test.system_gesture_event_filter()); - aura::GestureEvent* event2 = CreateGesture( + ui::GestureEventImpl* event2 = CreateGesture( ui::ET_GESTURE_TAP, 0, 0, 0, 0, kTouchId); consumed = root_window->DispatchGestureEvent(event2); @@ -214,13 +214,13 @@ TEST_F(SystemGestureEventFilterTest, DeviceControl) { xpos = screen.right() + 40; // Make sure it is out of the screen. } // Get a target for kTouchId - aura::TouchEvent press1(ui::ET_TOUCH_PRESSED, - gfx::Point(-10, ypos + ypos_half), - kTouchId, - base::Time::NowFromSystemTime() - base::Time()); + ui::TouchEventImpl press1(ui::ET_TOUCH_PRESSED, + gfx::Point(-10, ypos + ypos_half), + kTouchId, + base::Time::NowFromSystemTime() - base::Time()); root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); - aura::GestureEvent* event1 = CreateGesture( + ui::GestureEventImpl* event1 = CreateGesture( ui::ET_GESTURE_SCROLL_BEGIN, xpos, ypos, 0, 0, kTouchId); bool consumed = root_window->DispatchGestureEvent(event1); @@ -229,7 +229,7 @@ TEST_F(SystemGestureEventFilterTest, DeviceControl) { EXPECT_EQ(0, delegate->handle_percent_count()); // No move at the beginning will produce no events. - aura::GestureEvent* event2 = CreateGesture( + ui::GestureEventImpl* event2 = CreateGesture( ui::ET_GESTURE_SCROLL_UPDATE, xpos, ypos, 0, 0, kTouchId); consumed = root_window->DispatchGestureEvent(event2); @@ -238,7 +238,7 @@ TEST_F(SystemGestureEventFilterTest, DeviceControl) { EXPECT_EQ(0, delegate->handle_percent_count()); // A move to a new Y location will produce an event. - aura::GestureEvent* event3 = CreateGesture( + ui::GestureEventImpl* event3 = CreateGesture( ui::ET_GESTURE_SCROLL_UPDATE, xpos, ypos + ypos_half, 0, ypos_half, kTouchId); consumed = root_window->DispatchGestureEvent(event3); @@ -248,7 +248,7 @@ TEST_F(SystemGestureEventFilterTest, DeviceControl) { EXPECT_EQ(50.0, delegate->handle_percent()); // A move to an illegal Y location will produce legal results. - aura::GestureEvent* event4 = CreateGesture( + ui::GestureEventImpl* event4 = CreateGesture( ui::ET_GESTURE_SCROLL_UPDATE, xpos, ypos - 100, 0, -ypos_half - 100, kTouchId); consumed = root_window->DispatchGestureEvent(event4); @@ -257,7 +257,7 @@ TEST_F(SystemGestureEventFilterTest, DeviceControl) { EXPECT_EQ(2, delegate->handle_percent_count()); EXPECT_EQ(100.0, delegate->handle_percent()); - aura::GestureEvent* event5 = CreateGesture( + ui::GestureEventImpl* event5 = CreateGesture( ui::ET_GESTURE_SCROLL_UPDATE, xpos, ypos + 2 * screen.height(), 0, 2 * screen.height() + 100, kTouchId); consumed = root_window->DispatchGestureEvent(event5); @@ -267,7 +267,7 @@ TEST_F(SystemGestureEventFilterTest, DeviceControl) { EXPECT_EQ(0.0, delegate->handle_percent()); // Finishing the gesture should not change anything. - aura::GestureEvent* event7 = CreateGesture( + ui::GestureEventImpl* event7 = CreateGesture( ui::ET_GESTURE_SCROLL_END, xpos, ypos + ypos_half, 0, 0, kTouchId); consumed = root_window->DispatchGestureEvent(event7); @@ -276,7 +276,7 @@ TEST_F(SystemGestureEventFilterTest, DeviceControl) { EXPECT_EQ(3, delegate->handle_percent_count()); // Another event after this one should get ignored. - aura::GestureEvent* event8 = CreateGesture( + ui::GestureEventImpl* event8 = CreateGesture( ui::ET_GESTURE_SCROLL_UPDATE, xpos, ypos_half, 0, 0, kTouchId); consumed = root_window->DispatchGestureEvent(event8); @@ -284,9 +284,9 @@ TEST_F(SystemGestureEventFilterTest, DeviceControl) { EXPECT_TRUE(consumed); EXPECT_EQ(3, delegate->handle_percent_count()); - aura::TouchEvent release1(ui::ET_TOUCH_RELEASED, - gfx::Point(2 * xpos, ypos + ypos_half), kTouchId, - base::Time::NowFromSystemTime() - base::Time()); + ui::TouchEventImpl release1( + ui::ET_TOUCH_RELEASED, gfx::Point(2 * xpos, ypos + ypos_half), kTouchId, + base::Time::NowFromSystemTime() - base::Time()); root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); } } @@ -330,13 +330,13 @@ TEST_F(SystemGestureEventFilterTest, ApplicationControl) { aura::Window* active_window = ash::wm::GetActiveWindow(); // Get a target for kTouchId - aura::TouchEvent press(ui::ET_TOUCH_PRESSED, - gfx::Point(-10, ypos + ypos_half), - kTouchId, - base::Time::NowFromSystemTime() - base::Time()); + ui::TouchEventImpl press(ui::ET_TOUCH_PRESSED, + gfx::Point(-10, ypos + ypos_half), + kTouchId, + base::Time::NowFromSystemTime() - base::Time()); root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); - aura::GestureEvent* event1 = CreateGesture( + ui::GestureEventImpl* event1 = CreateGesture( ui::ET_GESTURE_SCROLL_BEGIN, xpos, ypos, 0, 0, kTouchId); bool consumed = root_window->DispatchGestureEvent(event1); @@ -345,7 +345,7 @@ TEST_F(SystemGestureEventFilterTest, ApplicationControl) { EXPECT_EQ(ash::wm::GetActiveWindow(), active_window); // No move at the beginning will produce no events. - aura::GestureEvent* event2 = CreateGesture( + ui::GestureEventImpl* event2 = CreateGesture( ui::ET_GESTURE_SCROLL_UPDATE, xpos, ypos, 0, 0, kTouchId); consumed = root_window->DispatchGestureEvent(event2); @@ -354,7 +354,7 @@ TEST_F(SystemGestureEventFilterTest, ApplicationControl) { EXPECT_EQ(ash::wm::GetActiveWindow(), active_window); // A move further to the outside will not trigger an action. - aura::GestureEvent* event3 = CreateGesture( + ui::GestureEventImpl* event3 = CreateGesture( ui::ET_GESTURE_SCROLL_UPDATE, xpos - delta_x, ypos, -delta_x, 0, kTouchId); consumed = root_window->DispatchGestureEvent(event3); @@ -363,7 +363,7 @@ TEST_F(SystemGestureEventFilterTest, ApplicationControl) { EXPECT_EQ(ash::wm::GetActiveWindow(), active_window); // A move to the proper side will trigger an action. - aura::GestureEvent* event4 = CreateGesture( + ui::GestureEventImpl* event4 = CreateGesture( ui::ET_GESTURE_SCROLL_UPDATE, xpos + delta_x, ypos, 2 * delta_x, 0, kTouchId); consumed = root_window->DispatchGestureEvent(event4); @@ -373,7 +373,7 @@ TEST_F(SystemGestureEventFilterTest, ApplicationControl) { active_window = ash::wm::GetActiveWindow(); // A second move to the proper side will not trigger an action. - aura::GestureEvent* event5 = CreateGesture( + ui::GestureEventImpl* event5 = CreateGesture( ui::ET_GESTURE_SCROLL_UPDATE, xpos + 2 * delta_x, ypos, delta_x, 0, kTouchId); consumed = root_window->DispatchGestureEvent(event5); @@ -381,9 +381,9 @@ TEST_F(SystemGestureEventFilterTest, ApplicationControl) { EXPECT_TRUE(consumed); EXPECT_EQ(ash::wm::GetActiveWindow(), active_window); - aura::TouchEvent release(ui::ET_TOUCH_RELEASED, - gfx::Point(2 * xpos, ypos + ypos_half), kTouchId, - base::Time::NowFromSystemTime() - base::Time()); + ui::TouchEventImpl release( + ui::ET_TOUCH_RELEASED, gfx::Point(2 * xpos, ypos + ypos_half), kTouchId, + base::Time::NowFromSystemTime() - base::Time()); root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); // Remove the launcher items again. @@ -413,7 +413,7 @@ TEST_F(SystemGestureEventFilterTest, LongPressAffordanceStateOnCaptureLoss) { EXPECT_TRUE(window1->HasCapture()); // Send touch event to first window. - aura::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), kTouchId, + ui::TouchEventImpl press(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), kTouchId, base::Time::NowFromSystemTime() - base::Time()); root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); EXPECT_TRUE(window1->HasCapture()); diff --git a/ash/wm/system_modal_container_event_filter.cc b/ash/wm/system_modal_container_event_filter.cc index 69891c2..448a73c 100644 --- a/ash/wm/system_modal_container_event_filter.cc +++ b/ash/wm/system_modal_container_event_filter.cc @@ -5,7 +5,7 @@ #include "ash/wm/system_modal_container_event_filter.h" #include "ash/wm/system_modal_container_event_filter_delegate.h" -#include "ui/aura/event.h" +#include "ui/base/event.h" namespace ash { namespace internal { @@ -20,26 +20,26 @@ SystemModalContainerEventFilter::~SystemModalContainerEventFilter() { bool SystemModalContainerEventFilter::PreHandleKeyEvent( aura::Window* target, - aura::KeyEvent* event) { + ui::KeyEvent* event) { return !delegate_->CanWindowReceiveEvents(target); } bool SystemModalContainerEventFilter::PreHandleMouseEvent( aura::Window* target, - aura::MouseEvent* event) { + ui::MouseEvent* event) { return !delegate_->CanWindowReceiveEvents(target); } ui::TouchStatus SystemModalContainerEventFilter::PreHandleTouchEvent( aura::Window* target, - aura::TouchEvent* event) { + ui::TouchEventImpl* event) { // TODO(sadrul): ! return ui::TOUCH_STATUS_UNKNOWN; } ui::GestureStatus SystemModalContainerEventFilter::PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) { + ui::GestureEventImpl* event) { // TODO(sad): return ui::GESTURE_STATUS_UNKNOWN; } diff --git a/ash/wm/system_modal_container_event_filter.h b/ash/wm/system_modal_container_event_filter.h index 548d1ce..ce45d7e 100644 --- a/ash/wm/system_modal_container_event_filter.h +++ b/ash/wm/system_modal_container_event_filter.h @@ -22,15 +22,15 @@ class ASH_EXPORT SystemModalContainerEventFilter : public aura::EventFilter { // Overridden from aura::EventFilter: virtual bool PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) OVERRIDE; + ui::KeyEvent* event) OVERRIDE; virtual bool PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) OVERRIDE; + ui::MouseEvent* event) OVERRIDE; virtual ui::TouchStatus PreHandleTouchEvent( aura::Window* target, - aura::TouchEvent* event) OVERRIDE; + ui::TouchEventImpl* event) OVERRIDE; virtual ui::GestureStatus PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) OVERRIDE; + ui::GestureEventImpl* event) OVERRIDE; private: SystemModalContainerEventFilterDelegate* delegate_; diff --git a/ash/wm/system_modal_container_layout_manager.cc b/ash/wm/system_modal_container_layout_manager.cc index 283c9df..bd788a2 100644 --- a/ash/wm/system_modal_container_layout_manager.cc +++ b/ash/wm/system_modal_container_layout_manager.cc @@ -14,9 +14,9 @@ #include "base/command_line.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/client/capture_client.h" -#include "ui/aura/event.h" #include "ui/aura/root_window.h" #include "ui/aura/window.h" +#include "ui/base/event.h" #include "ui/compositor/layer.h" #include "ui/compositor/layer_animator.h" #include "ui/compositor/scoped_layer_animation_settings.h" diff --git a/ash/wm/toplevel_window_event_filter.cc b/ash/wm/toplevel_window_event_filter.cc index 8d0ee8d..1f669a5 100644 --- a/ash/wm/toplevel_window_event_filter.cc +++ b/ash/wm/toplevel_window_event_filter.cc @@ -15,11 +15,11 @@ #include "base/run_loop.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/env.h" -#include "ui/aura/event.h" #include "ui/aura/root_window.h" #include "ui/aura/window.h" #include "ui/aura/window_delegate.h" #include "ui/base/cursor/cursor.h" +#include "ui/base/event.h" #include "ui/base/gestures/gesture_recognizer.h" #include "ui/base/hit_test.h" #include "ui/base/ui_base_types.h" @@ -39,7 +39,7 @@ namespace { gfx::Point ConvertPointToParent(aura::Window* window, const gfx::Point& point) { gfx::Point result(point); - aura::Window::ConvertPointToWindow(window, window->parent(), &result); + aura::Window::ConvertPointToTarget(window, window->parent(), &result); return result; } @@ -56,7 +56,7 @@ ToplevelWindowEventFilter::~ToplevelWindowEventFilter() { } bool ToplevelWindowEventFilter::PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) { + ui::KeyEvent* event) { if (window_resizer_.get() && event->type() == ui::ET_KEY_PRESSED && event->key_code() == ui::VKEY_ESCAPE) { CompleteDrag(DRAG_REVERT, event->flags()); @@ -65,7 +65,7 @@ bool ToplevelWindowEventFilter::PreHandleKeyEvent(aura::Window* target, } bool ToplevelWindowEventFilter::PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) { + ui::MouseEvent* event) { if ((event->flags() & (ui::EF_MIDDLE_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON)) != 0) return false; @@ -120,13 +120,13 @@ bool ToplevelWindowEventFilter::PreHandleMouseEvent(aura::Window* target, ui::TouchStatus ToplevelWindowEventFilter::PreHandleTouchEvent( aura::Window* target, - aura::TouchEvent* event) { + ui::TouchEventImpl* event) { return ui::TOUCH_STATUS_UNKNOWN; } ui::GestureStatus ToplevelWindowEventFilter::PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) { + ui::GestureEventImpl* event) { switch (event->type()) { case ui::ET_GESTURE_SCROLL_BEGIN: { int component = @@ -210,7 +210,7 @@ void ToplevelWindowEventFilter::RunMoveLoop(aura::Window* source) { DCHECK(has_point); } else { drag_location = root_window->GetLastMouseLocationInRoot(); - aura::Window::ConvertPointToWindow( + aura::Window::ConvertPointToTarget( root_window, source->parent(), &drag_location); } window_resizer_.reset( @@ -261,7 +261,7 @@ void ToplevelWindowEventFilter::CompleteDrag(DragCompletionStatus status, } bool ToplevelWindowEventFilter::HandleDrag(aura::Window* target, - aura::LocatedEvent* event) { + ui::LocatedEvent* event) { // This function only be triggered to move window // by mouse drag or touch move event. DCHECK(event->type() == ui::ET_MOUSE_DRAGGED || @@ -276,7 +276,7 @@ bool ToplevelWindowEventFilter::HandleDrag(aura::Window* target, } bool ToplevelWindowEventFilter::HandleMouseMoved(aura::Window* target, - aura::LocatedEvent* event) { + ui::LocatedEvent* event) { // TODO(jamescook): Move the resize cursor update code into here from // CompoundEventFilter? internal::ResizeShadowController* controller = @@ -294,7 +294,7 @@ bool ToplevelWindowEventFilter::HandleMouseMoved(aura::Window* target, } bool ToplevelWindowEventFilter::HandleMouseExited(aura::Window* target, - aura::LocatedEvent* event) { + ui::LocatedEvent* event) { internal::ResizeShadowController* controller = Shell::GetInstance()->resize_shadow_controller(); if (controller) diff --git a/ash/wm/toplevel_window_event_filter.h b/ash/wm/toplevel_window_event_filter.h index 4576432..02deebb 100644 --- a/ash/wm/toplevel_window_event_filter.h +++ b/ash/wm/toplevel_window_event_filter.h @@ -17,11 +17,13 @@ #include "ui/gfx/rect.h" namespace aura { -class LocatedEvent; -class MouseEvent; class Window; } +namespace ui { +class LocatedEvent; +} + namespace ash { class WindowResizer; @@ -41,14 +43,15 @@ class ASH_EXPORT ToplevelWindowEventFilter : // Overridden from aura::EventFilter: virtual bool PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) OVERRIDE; + ui::KeyEvent* event) OVERRIDE; virtual bool PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) OVERRIDE; - virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, - aura::TouchEvent* event) OVERRIDE; + ui::MouseEvent* event) OVERRIDE; + virtual ui::TouchStatus PreHandleTouchEvent( + aura::Window* target, + ui::TouchEventImpl* event) OVERRIDE; virtual ui::GestureStatus PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) OVERRIDE; + ui::GestureEventImpl* event) OVERRIDE; // Overridden form aura::client::WindowMoveClient: virtual void RunMoveLoop(aura::Window* source) OVERRIDE; @@ -71,15 +74,15 @@ class ASH_EXPORT ToplevelWindowEventFilter : // Called during a drag to resize/position the window. // The return value is returned by OnMouseEvent() above. - bool HandleDrag(aura::Window* target, aura::LocatedEvent* event); + bool HandleDrag(aura::Window* target, ui::LocatedEvent* event); // Called during mouse moves to update window resize shadows. // Return value is returned by OnMouseEvent() above. - bool HandleMouseMoved(aura::Window* target, aura::LocatedEvent* event); + bool HandleMouseMoved(aura::Window* target, ui::LocatedEvent* event); // Called for mouse exits to hide window resize shadows. // Return value is returned by OnMouseEvent() above. - bool HandleMouseExited(aura::Window* target, aura::LocatedEvent* event); + bool HandleMouseExited(aura::Window* target, ui::LocatedEvent* event); // Are we running a nested message loop from RunMoveLoop(). bool in_move_loop_; diff --git a/ash/wm/toplevel_window_event_filter_unittest.cc b/ash/wm/toplevel_window_event_filter_unittest.cc index 5240527..d8573d7 100644 --- a/ash/wm/toplevel_window_event_filter_unittest.cc +++ b/ash/wm/toplevel_window_event_filter_unittest.cc @@ -12,12 +12,12 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "testing/gtest/include/gtest/gtest.h" -#include "ui/aura/event.h" #include "ui/aura/root_window.h" #include "ui/aura/test/aura_test_base.h" #include "ui/aura/test/event_generator.h" #include "ui/aura/test/test_activation_client.h" #include "ui/aura/test/test_window_delegate.h" +#include "ui/base/event.h" #include "ui/base/hit_test.h" #include "ui/gfx/screen.h" diff --git a/ash/wm/user_activity_detector.cc b/ash/wm/user_activity_detector.cc index 3fd845a..5f16b6f 100644 --- a/ash/wm/user_activity_detector.cc +++ b/ash/wm/user_activity_detector.cc @@ -7,8 +7,8 @@ #include "ash/wm/property_util.h" #include "ash/wm/user_activity_observer.h" #include "ash/wm/window_util.h" -#include "ui/aura/event.h" #include "ui/aura/window.h" +#include "ui/base/event.h" namespace ash { @@ -29,7 +29,7 @@ void UserActivityDetector::RemoveObserver(UserActivityObserver* observer) { } bool UserActivityDetector::PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) { + ui::KeyEvent* event) { // Ignore input events on secondary displays in non extended desktop // mode. Remove this once this mode is gone. crbug.com/135245. if (!GetRootWindowController(target->GetRootWindow())) @@ -39,7 +39,7 @@ bool UserActivityDetector::PreHandleKeyEvent(aura::Window* target, } bool UserActivityDetector::PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) { + ui::MouseEvent* event) { if (!GetRootWindowController(target->GetRootWindow())) return true; if (!(event->flags() & ui::EF_IS_SYNTHESIZED)) @@ -49,7 +49,7 @@ bool UserActivityDetector::PreHandleMouseEvent(aura::Window* target, ui::TouchStatus UserActivityDetector::PreHandleTouchEvent( aura::Window* target, - aura::TouchEvent* event) { + ui::TouchEventImpl* event) { if (!GetRootWindowController(target->GetRootWindow())) return ui::TOUCH_STATUS_END; MaybeNotify(); @@ -58,7 +58,7 @@ ui::TouchStatus UserActivityDetector::PreHandleTouchEvent( ui::GestureStatus UserActivityDetector::PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) { + ui::GestureEventImpl* event) { if (!GetRootWindowController(target->GetRootWindow())) return ui::GESTURE_STATUS_CONSUMED; MaybeNotify(); diff --git a/ash/wm/user_activity_detector.h b/ash/wm/user_activity_detector.h index a19b57c..2332ffd 100644 --- a/ash/wm/user_activity_detector.h +++ b/ash/wm/user_activity_detector.h @@ -34,16 +34,16 @@ class ASH_EXPORT UserActivityDetector : public aura::EventFilter { // aura::EventFilter implementation. virtual bool PreHandleKeyEvent( aura::Window* target, - aura::KeyEvent* event) OVERRIDE; + ui::KeyEvent* event) OVERRIDE; virtual bool PreHandleMouseEvent( aura::Window* target, - aura::MouseEvent* event) OVERRIDE; + ui::MouseEvent* event) OVERRIDE; virtual ui::TouchStatus PreHandleTouchEvent( aura::Window* target, - aura::TouchEvent* event) OVERRIDE; + ui::TouchEventImpl* event) OVERRIDE; virtual ui::GestureStatus PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) OVERRIDE; + ui::GestureEventImpl* event) OVERRIDE; private: // Notifies observers if enough time has passed since the last notification. diff --git a/ash/wm/user_activity_detector_unittest.cc b/ash/wm/user_activity_detector_unittest.cc index 2d0c185..f396a52 100644 --- a/ash/wm/user_activity_detector_unittest.cc +++ b/ash/wm/user_activity_detector_unittest.cc @@ -10,9 +10,9 @@ #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" #include "base/time.h" -#include "ui/aura/event.h" #include "ui/aura/test/test_windows.h" #include "ui/aura/window.h" +#include "ui/base/event.h" #include "ui/base/events.h" #include "ui/base/keycodes/keyboard_codes.h" #include "ui/gfx/point.h" @@ -82,7 +82,7 @@ TEST_F(UserActivityDetectorTest, Basic) { scoped_ptr<aura::Window> window( aura::test::CreateTestWindowWithId(12345, NULL)); - aura::KeyEvent key_event(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE); + ui::KeyEvent key_event(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE); EXPECT_FALSE(detector_->PreHandleKeyEvent(window.get(), &key_event)); EXPECT_EQ(1, observer_->num_invocations()); observer_->reset_stats(); @@ -90,21 +90,21 @@ TEST_F(UserActivityDetectorTest, Basic) { base::TimeDelta advance_delta = base::TimeDelta::FromSeconds(UserActivityDetector::kNotifyIntervalSec); AdvanceTime(advance_delta); - aura::MouseEvent mouse_event( + ui::MouseEvent mouse_event( ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), ui::EF_NONE); EXPECT_FALSE(detector_->PreHandleMouseEvent(window.get(), &mouse_event)); EXPECT_EQ(1, observer_->num_invocations()); observer_->reset_stats(); AdvanceTime(advance_delta); - aura::TouchEvent touch_event( + ui::TouchEventImpl touch_event( ui::ET_TOUCH_PRESSED, gfx::Point(), 0, base::TimeDelta()); EXPECT_FALSE(detector_->PreHandleTouchEvent(window.get(), &touch_event)); EXPECT_EQ(1, observer_->num_invocations()); observer_->reset_stats(); AdvanceTime(advance_delta); - aura::GestureEvent gesture_event( + ui::GestureEventImpl gesture_event( ui::ET_GESTURE_TAP, 0, 0, ui::EF_NONE, base::Time(), ui::GestureEventDetails(ui::ET_GESTURE_TAP, 0, 0), 0U); EXPECT_FALSE(detector_->PreHandleGestureEvent(window.get(), &gesture_event)); @@ -118,7 +118,7 @@ TEST_F(UserActivityDetectorTest, RateLimitNotifications) { aura::test::CreateTestWindowWithId(12345, NULL)); // The observer should be notified about a key event. - aura::KeyEvent event(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE); + ui::KeyEvent event(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE); EXPECT_FALSE(detector_->PreHandleKeyEvent(window.get(), &event)); EXPECT_EQ(1, observer_->num_invocations()); observer_->reset_stats(); @@ -147,7 +147,7 @@ TEST_F(UserActivityDetectorTest, RateLimitNotifications) { TEST_F(UserActivityDetectorTest, IgnoreSyntheticMouseEvents) { scoped_ptr<aura::Window> window( aura::test::CreateTestWindowWithId(12345, NULL)); - aura::MouseEvent mouse_event( + ui::MouseEvent mouse_event( ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), ui::EF_IS_SYNTHESIZED); EXPECT_FALSE(detector_->PreHandleMouseEvent(window.get(), &mouse_event)); EXPECT_EQ(0, observer_->num_invocations()); diff --git a/ash/wm/window_cycle_controller.cc b/ash/wm/window_cycle_controller.cc index d3fbe71..dd71538 100644 --- a/ash/wm/window_cycle_controller.cc +++ b/ash/wm/window_cycle_controller.cc @@ -11,9 +11,9 @@ #include "ash/wm/activation_controller.h" #include "ash/wm/window_cycle_list.h" #include "ash/wm/window_util.h" -#include "ui/aura/event.h" #include "ui/aura/event_filter.h" #include "ui/aura/root_window.h" +#include "ui/base/event.h" namespace ash { @@ -34,14 +34,15 @@ class WindowCycleEventFilter : public aura::EventFilter { // Overridden from aura::EventFilter: virtual bool PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) OVERRIDE; + ui::KeyEvent* event) OVERRIDE; virtual bool PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) OVERRIDE; - virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, - aura::TouchEvent* event) OVERRIDE; + ui::MouseEvent* event) OVERRIDE; + virtual ui::TouchStatus PreHandleTouchEvent( + aura::Window* target, + ui::TouchEventImpl* event) OVERRIDE; virtual ui::GestureStatus PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) OVERRIDE; + ui::GestureEventImpl* event) OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(WindowCycleEventFilter); }; @@ -55,7 +56,7 @@ WindowCycleEventFilter::~WindowCycleEventFilter() { bool WindowCycleEventFilter::PreHandleKeyEvent( aura::Window* target, - aura::KeyEvent* event) { + ui::KeyEvent* event) { // Views uses VKEY_MENU for both left and right Alt keys. if (event->key_code() == ui::VKEY_MENU && event->type() == ui::ET_KEY_RELEASED) { @@ -67,19 +68,19 @@ bool WindowCycleEventFilter::PreHandleKeyEvent( bool WindowCycleEventFilter::PreHandleMouseEvent( aura::Window* target, - aura::MouseEvent* event) { + ui::MouseEvent* event) { return false; // Not handled. } ui::TouchStatus WindowCycleEventFilter::PreHandleTouchEvent( aura::Window* target, - aura::TouchEvent* event) { + ui::TouchEventImpl* event) { return ui::TOUCH_STATUS_UNKNOWN; // Not handled. } ui::GestureStatus WindowCycleEventFilter::PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) { + ui::GestureEventImpl* event) { return ui::GESTURE_STATUS_UNKNOWN; // Not handled. } diff --git a/ash/wm/window_manager_unittest.cc b/ash/wm/window_manager_unittest.cc index fb2874b..cb558b6 100644 --- a/ash/wm/window_manager_unittest.cc +++ b/ash/wm/window_manager_unittest.cc @@ -12,7 +12,6 @@ #include "ui/aura/client/activation_client.h" #include "ui/aura/client/activation_delegate.h" #include "ui/aura/env.h" -#include "ui/aura/event.h" #include "ui/aura/focus_manager.h" #include "ui/aura/root_window.h" #include "ui/aura/shared/compound_event_filter.h" @@ -23,6 +22,7 @@ #include "ui/aura/test/test_window_delegate.h" #include "ui/aura/test/test_windows.h" #include "ui/base/cursor/cursor.h" +#include "ui/base/event.h" #include "ui/base/hit_test.h" #include "ui/gfx/screen.h" @@ -116,14 +116,14 @@ TEST_F(WindowManagerTest, Focus) { EXPECT_EQ(w121.get(), focus_manager->GetFocusedWindow()); // The key press should be sent to the focused sub-window. - aura::KeyEvent keyev(ui::ET_KEY_PRESSED, ui::VKEY_E, 0); + ui::KeyEvent keyev(ui::ET_KEY_PRESSED, ui::VKEY_E, 0); root_window->AsRootWindowHostDelegate()->OnHostKeyEvent(&keyev); EXPECT_EQ(ui::VKEY_E, w121delegate->last_key_code()); // Touch on a sub-window (w122) to focus it. gfx::Point click_point = w122->bounds().CenterPoint(); - aura::Window::ConvertPointToWindow(w122->parent(), root_window, &click_point); - aura::TouchEvent touchev(ui::ET_TOUCH_PRESSED, click_point, 0, getTime()); + aura::Window::ConvertPointToTarget(w122->parent(), root_window, &click_point); + ui::TouchEventImpl touchev(ui::ET_TOUCH_PRESSED, click_point, 0, getTime()); root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&touchev); focus_manager = w122->GetFocusManager(); EXPECT_EQ(w122.get(), focus_manager->GetFocusedWindow()); @@ -263,7 +263,7 @@ TEST_F(WindowManagerTest, ActivateOnMouse) { // Then click the parent active window. The focus shouldn't move. gfx::Point left_top = w1->bounds().origin(); - aura::Window::ConvertPointToWindow(w1->parent(), root_window, &left_top); + aura::Window::ConvertPointToTarget(w1->parent(), root_window, &left_top); left_top.Offset(1, 1); generator.MoveMouseTo(left_top); generator.ClickLeftButton(); @@ -322,8 +322,8 @@ TEST_F(WindowManagerTest, ActivateOnTouch) { // Touch window2. gfx::Point press_point = w2->bounds().CenterPoint(); - aura::Window::ConvertPointToWindow(w2->parent(), root_window, &press_point); - aura::TouchEvent touchev1(ui::ET_TOUCH_PRESSED, press_point, 0, getTime()); + aura::Window::ConvertPointToTarget(w2->parent(), root_window, &press_point); + ui::TouchEventImpl touchev1(ui::ET_TOUCH_PRESSED, press_point, 0, getTime()); root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&touchev1); // Window2 should have become active. @@ -338,9 +338,9 @@ TEST_F(WindowManagerTest, ActivateOnTouch) { // Touch window1, but set it up so w1 doesn't activate on touch. press_point = w1->bounds().CenterPoint(); - aura::Window::ConvertPointToWindow(w1->parent(), root_window, &press_point); + aura::Window::ConvertPointToTarget(w1->parent(), root_window, &press_point); d1.set_activate(false); - aura::TouchEvent touchev2(ui::ET_TOUCH_PRESSED, press_point, 1, getTime()); + ui::TouchEventImpl touchev2(ui::ET_TOUCH_PRESSED, press_point, 1, getTime()); root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&touchev2); // Window2 should still be active and focused. @@ -382,12 +382,12 @@ TEST_F(WindowManagerTest, MouseEventCursors) { // Create two mouse movement events we can switch between. gfx::Point point1(kWindowLeft, kWindowTop); - aura::Window::ConvertPointToWindow(window->parent(), root_window, &point1); - aura::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1, 0x0); + aura::Window::ConvertPointToTarget(window->parent(), root_window, &point1); + ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1, 0x0); gfx::Point point2(kWindowLeft + 1, kWindowTop + 1); - aura::Window::ConvertPointToWindow(window->parent(), root_window, &point2); - aura::MouseEvent move2(ui::ET_MOUSE_MOVED, point2, point2, 0x0); + aura::Window::ConvertPointToTarget(window->parent(), root_window, &point2); + ui::MouseEvent move2(ui::ET_MOUSE_MOVED, point2, point2, 0x0); // Cursor starts as a pointer (set during Shell::Init()). EXPECT_EQ(ui::kCursorPointer, root_window->last_cursor().native_type()); @@ -466,24 +466,24 @@ TEST_F(WindowManagerTest, MAYBE_TransformActivate) { gfx::Point miss_point(5, 5); transform.TransformPoint(miss_point); - aura::MouseEvent mouseev1(ui::ET_MOUSE_PRESSED, - miss_point, - miss_point, - ui::EF_LEFT_MOUSE_BUTTON); + ui::MouseEvent mouseev1(ui::ET_MOUSE_PRESSED, + miss_point, + miss_point, + ui::EF_LEFT_MOUSE_BUTTON); root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouseev1); EXPECT_FALSE(w1->GetFocusManager()->GetFocusedWindow()); - aura::MouseEvent mouseup(ui::ET_MOUSE_RELEASED, - miss_point, - miss_point, - ui::EF_LEFT_MOUSE_BUTTON); + ui::MouseEvent mouseup(ui::ET_MOUSE_RELEASED, + miss_point, + miss_point, + ui::EF_LEFT_MOUSE_BUTTON); root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouseup); gfx::Point hit_point(5, 15); transform.TransformPoint(hit_point); - aura::MouseEvent mouseev2(ui::ET_MOUSE_PRESSED, - hit_point, - hit_point, - ui::EF_LEFT_MOUSE_BUTTON); + ui::MouseEvent mouseev2(ui::ET_MOUSE_PRESSED, + hit_point, + hit_point, + ui::EF_LEFT_MOUSE_BUTTON); root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouseev2); EXPECT_TRUE(wm::IsActiveWindow(w1.get())); EXPECT_EQ(w1.get(), w1->GetFocusManager()->GetFocusedWindow()); @@ -514,9 +514,9 @@ TEST_F(WindowManagerTest, AdditionalFilters) { env_filter->AddFilter(f2.get()); // Dispatches mouse and keyboard events. - aura::KeyEvent key_event(ui::ET_KEY_PRESSED, ui::VKEY_A, 0); + ui::KeyEvent key_event(ui::ET_KEY_PRESSED, ui::VKEY_A, 0); root_window->AsRootWindowHostDelegate()->OnHostKeyEvent(&key_event); - aura::MouseEvent mouse_pressed( + ui::MouseEvent mouse_pressed( ui::ET_MOUSE_PRESSED, gfx::Point(0, 0), gfx::Point(0, 0), 0x0); root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_pressed); @@ -535,7 +535,7 @@ TEST_F(WindowManagerTest, AdditionalFilters) { // Dispatches events. root_window->AsRootWindowHostDelegate()->OnHostKeyEvent(&key_event); - aura::MouseEvent mouse_released( + ui::MouseEvent mouse_released( ui::ET_MOUSE_RELEASED, gfx::Point(0, 0), gfx::Point(0, 0), 0x0); root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_released); @@ -577,11 +577,11 @@ TEST_F(WindowManagerTest, UpdateCursorVisibility) { ash::CursorManager* cursor_manager = ash::Shell::GetInstance()->cursor_manager(); - aura::MouseEvent mouse_moved( + ui::MouseEvent mouse_moved( ui::ET_MOUSE_MOVED, gfx::Point(0, 0), gfx::Point(0, 0), 0x0); - aura::TouchEvent touch_pressed1( + ui::TouchEventImpl touch_pressed1( ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), 0, getTime()); - aura::TouchEvent touch_pressed2( + ui::TouchEventImpl touch_pressed2( ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), 1, getTime()); env_filter->set_update_cursor_visibility(true); diff --git a/ash/wm/window_modality_controller.cc b/ash/wm/window_modality_controller.cc index 50fe516..bf474d8 100644 --- a/ash/wm/window_modality_controller.cc +++ b/ash/wm/window_modality_controller.cc @@ -10,9 +10,9 @@ #include "ui/aura/client/aura_constants.h" #include "ui/aura/client/capture_client.h" #include "ui/aura/env.h" -#include "ui/aura/event.h" #include "ui/aura/root_window.h" #include "ui/aura/window.h" +#include "ui/base/event.h" #include "ui/base/ui_base_types.h" namespace ash { @@ -75,25 +75,25 @@ WindowModalityController::~WindowModalityController() { // WindowModalityController, aura::EventFilter implementation: bool WindowModalityController::PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) { + ui::KeyEvent* event) { return !!wm::GetWindowModalTransient(target); } bool WindowModalityController::PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) { + ui::MouseEvent* event) { return ProcessLocatedEvent(target, event); } ui::TouchStatus WindowModalityController::PreHandleTouchEvent( aura::Window* target, - aura::TouchEvent* event) { + ui::TouchEventImpl* event) { return ProcessLocatedEvent(target, event) ? ui::TOUCH_STATUS_CONTINUE : ui::TOUCH_STATUS_UNKNOWN; } ui::GestureStatus WindowModalityController::PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) { + ui::GestureEventImpl* event) { // TODO: make gestures work with modals. return ui::GESTURE_STATUS_UNKNOWN; } @@ -122,7 +122,7 @@ void WindowModalityController::OnWindowDestroyed(aura::Window* window) { } bool WindowModalityController::ProcessLocatedEvent(aura::Window* target, - aura::LocatedEvent* event) { + ui::LocatedEvent* event) { aura::Window* modal_transient_child = wm::GetWindowModalTransient(target); if (modal_transient_child && (event->type() == ui::ET_MOUSE_PRESSED || event->type() == ui::ET_TOUCH_PRESSED)) { diff --git a/ash/wm/window_modality_controller.h b/ash/wm/window_modality_controller.h index 09ede72..614eb92 100644 --- a/ash/wm/window_modality_controller.h +++ b/ash/wm/window_modality_controller.h @@ -13,7 +13,7 @@ #include "ui/aura/event_filter.h" #include "ui/aura/window_observer.h" -namespace aura { +namespace ui { class LocatedEvent; } @@ -39,14 +39,15 @@ class WindowModalityController : public aura::EventFilter, // Overridden from aura::EventFilter: virtual bool PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) OVERRIDE; + ui::KeyEvent* event) OVERRIDE; virtual bool PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) OVERRIDE; - virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, - aura::TouchEvent* event) OVERRIDE; + ui::MouseEvent* event) OVERRIDE; + virtual ui::TouchStatus PreHandleTouchEvent( + aura::Window* target, + ui::TouchEventImpl* event) OVERRIDE; virtual ui::GestureStatus PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) OVERRIDE; + ui::GestureEventImpl* event) OVERRIDE; // Overridden from aura::EnvObserver: virtual void OnWindowInitialized(aura::Window* window) OVERRIDE; @@ -60,7 +61,7 @@ class WindowModalityController : public aura::EventFilter, // Processes a mouse/touch event, and returns true if the event should be // consumed. bool ProcessLocatedEvent(aura::Window* target, - aura::LocatedEvent* event); + ui::LocatedEvent* event); std::vector<aura::Window*> windows_; diff --git a/ash/wm/window_modality_controller_unittest.cc b/ash/wm/window_modality_controller_unittest.cc index 73ddaac..d5a40fa 100644 --- a/ash/wm/window_modality_controller_unittest.cc +++ b/ash/wm/window_modality_controller_unittest.cc @@ -294,7 +294,7 @@ class TouchTrackerWindowDelegate : public aura::test::TestWindowDelegate { private: // Overridden from aura::test::TestWindowDelegate. - virtual ui::TouchStatus OnTouchEvent(aura::TouchEvent* event) OVERRIDE { + virtual ui::TouchStatus OnTouchEvent(ui::TouchEventImpl* event) OVERRIDE { received_touch_ = true; return aura::test::TestWindowDelegate::OnTouchEvent(event); } diff --git a/ash/wm/workspace/frame_maximize_button.cc b/ash/wm/workspace/frame_maximize_button.cc index 89297c5d..9a584c8 100644 --- a/ash/wm/workspace/frame_maximize_button.cc +++ b/ash/wm/workspace/frame_maximize_button.cc @@ -13,9 +13,9 @@ #include "ash/wm/workspace/snap_sizer.h" #include "grit/ash_strings.h" #include "grit/ui_resources.h" -#include "ui/aura/event.h" #include "ui/aura/event_filter.h" #include "ui/aura/window.h" +#include "ui/base/event.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/image/image.h" @@ -44,15 +44,15 @@ class FrameMaximizeButton::EscapeEventFilter : public aura::EventFilter { // EventFilter overrides: virtual bool PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) OVERRIDE; + ui::KeyEvent* event) OVERRIDE; virtual bool PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) OVERRIDE; + ui::MouseEvent* event) OVERRIDE; virtual ui::TouchStatus PreHandleTouchEvent( aura::Window* target, - aura::TouchEvent* event) OVERRIDE; + ui::TouchEventImpl* event) OVERRIDE; virtual ui::GestureStatus PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) OVERRIDE; + ui::GestureEventImpl* event) OVERRIDE; private: FrameMaximizeButton* button_; @@ -72,7 +72,7 @@ FrameMaximizeButton::EscapeEventFilter::~EscapeEventFilter() { bool FrameMaximizeButton::EscapeEventFilter::PreHandleKeyEvent( aura::Window* target, - aura::KeyEvent* event) { + ui::KeyEvent* event) { if (event->type() == ui::ET_KEY_PRESSED && event->key_code() == ui::VKEY_ESCAPE) { button_->Cancel(false); @@ -82,19 +82,19 @@ bool FrameMaximizeButton::EscapeEventFilter::PreHandleKeyEvent( bool FrameMaximizeButton::EscapeEventFilter::PreHandleMouseEvent( aura::Window* target, - aura::MouseEvent* event) { + ui::MouseEvent* event) { return false; } ui::TouchStatus FrameMaximizeButton::EscapeEventFilter::PreHandleTouchEvent( - aura::Window* target, - aura::TouchEvent* event) { + aura::Window* target, + ui::TouchEventImpl* event) { return ui::TOUCH_STATUS_UNKNOWN; } ui::GestureStatus FrameMaximizeButton::EscapeEventFilter::PreHandleGestureEvent( - aura::Window* target, - aura::GestureEvent* event) { + aura::Window* target, + ui::GestureEventImpl* event) { return ui::GESTURE_STATUS_UNKNOWN; } diff --git a/ash/wm/workspace/multi_window_resize_controller.cc b/ash/wm/workspace/multi_window_resize_controller.cc index d774e58..909e040 100644 --- a/ash/wm/workspace/multi_window_resize_controller.cc +++ b/ash/wm/workspace/multi_window_resize_controller.cc @@ -180,7 +180,7 @@ void MultiWindowResizeController::Show(Window* window, windows_.window1->AddObserver(this); windows_.window2->AddObserver(this); show_location_in_parent_ = point_in_window; - Window::ConvertPointToWindow( + Window::ConvertPointToTarget( window, window->parent(), &show_location_in_parent_); if (show_timer_.IsRunning()) return; @@ -225,7 +225,7 @@ MultiWindowResizeController::DetermineWindows( const gfx::Point& point) const { ResizeWindows result; gfx::Point point_in_parent(point); - Window::ConvertPointToWindow(window, window->parent(), &point_in_parent); + Window::ConvertPointToTarget(window, window->parent(), &point_in_parent); switch (window_component) { case HTRIGHT: result.direction = LEFT_RIGHT; @@ -505,7 +505,7 @@ bool MultiWindowResizeController::IsOverWindow( return false; gfx::Point window_loc(location_in_screen); - aura::Window::ConvertPointToWindow( + aura::Window::ConvertPointToTarget( window->GetRootWindow(), window, &window_loc); return window->HitTest(window_loc) && window->delegate()->GetNonClientComponent(window_loc) == component; diff --git a/ash/wm/workspace/workspace_event_filter.cc b/ash/wm/workspace/workspace_event_filter.cc index 89218a1..8c9cb3c 100644 --- a/ash/wm/workspace/workspace_event_filter.cc +++ b/ash/wm/workspace/workspace_event_filter.cc @@ -11,9 +11,9 @@ #include "ash/wm/workspace/workspace_layout_manager.h" #include "ash/wm/workspace/workspace_window_resizer.h" #include "ui/aura/client/aura_constants.h" -#include "ui/aura/event.h" #include "ui/aura/window.h" #include "ui/aura/window_delegate.h" +#include "ui/base/event.h" #include "ui/base/hit_test.h" #include "ui/compositor/scoped_layer_animation_settings.h" #include "ui/gfx/screen.h" @@ -78,7 +78,7 @@ WorkspaceEventFilter::~WorkspaceEventFilter() { } bool WorkspaceEventFilter::PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) { + ui::MouseEvent* event) { switch (event->type()) { case ui::ET_MOUSE_MOVED: { int component = @@ -145,7 +145,7 @@ void WorkspaceEventFilter::UpdateHoveredWindow( void WorkspaceEventFilter::HandleVerticalResizeDoubleClick( aura::Window* target, - aura::MouseEvent* event) { + ui::MouseEvent* event) { if (event->flags() & ui::EF_IS_DOUBLE_CLICK && !wm::IsWindowMaximized(target)) { int component = diff --git a/ash/wm/workspace/workspace_event_filter.h b/ash/wm/workspace/workspace_event_filter.h index 25051b7..75479df 100644 --- a/ash/wm/workspace/workspace_event_filter.h +++ b/ash/wm/workspace/workspace_event_filter.h @@ -10,7 +10,6 @@ #include "ui/aura/window_observer.h" namespace aura { -class MouseEvent; class Window; } @@ -27,7 +26,7 @@ class WorkspaceEventFilter : public ToplevelWindowEventFilter, // Overridden from ToplevelWindowEventFilter: virtual bool PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) OVERRIDE; + ui::MouseEvent* event) OVERRIDE; // Overridden from WindowObserver: virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; @@ -51,7 +50,7 @@ class WorkspaceEventFilter : public ToplevelWindowEventFilter, // window between its restored state and the full available height of the // workspace. void HandleVerticalResizeDoubleClick(aura::Window* target, - aura::MouseEvent* event); + ui::MouseEvent* event); // Top-level window under the mouse cursor. aura::Window* hovered_window_; diff --git a/ash/wm/workspace/workspace_layout_manager.cc b/ash/wm/workspace/workspace_layout_manager.cc index 3e919ef..d8e3f06 100644 --- a/ash/wm/workspace/workspace_layout_manager.cc +++ b/ash/wm/workspace/workspace_layout_manager.cc @@ -11,10 +11,10 @@ #include "ash/wm/workspace/workspace_manager.h" #include "ash/wm/workspace/workspace_window_resizer.h" #include "ui/aura/client/aura_constants.h" -#include "ui/aura/event.h" #include "ui/aura/root_window.h" #include "ui/aura/window.h" #include "ui/aura/window_observer.h" +#include "ui/base/event.h" #include "ui/base/ui_base_types.h" #include "ui/gfx/rect.h" #include "ui/views/widget/native_widget_aura.h" diff --git a/ash/wm/workspace/workspace_layout_manager.h b/ash/wm/workspace/workspace_layout_manager.h index a5dfef6..6d1d461 100644 --- a/ash/wm/workspace/workspace_layout_manager.h +++ b/ash/wm/workspace/workspace_layout_manager.h @@ -12,7 +12,6 @@ #include "ui/aura/window_observer.h" namespace aura { -class MouseEvent; class RootWindow; class Window; } diff --git a/ash/wm/workspace/workspace_window_resizer.cc b/ash/wm/workspace/workspace_window_resizer.cc index 57c70f6..fe37687 100644 --- a/ash/wm/workspace/workspace_window_resizer.cc +++ b/ash/wm/workspace/workspace_window_resizer.cc @@ -88,7 +88,7 @@ void WorkspaceWindowResizer::Drag(const gfx::Point& location, int event_flags) { wm::GetRootWindowRelativeToWindow(window()->parent(), location); aura::RootWindow* current_root = actual_location.first; gfx::Point location_in_parent = actual_location.second; - aura::Window::ConvertPointToWindow(current_root, + aura::Window::ConvertPointToTarget(current_root, window()->parent(), &location_in_parent); diff --git a/chrome/browser/ui/ash/event_rewriter.cc b/chrome/browser/ui/ash/event_rewriter.cc index e9d51b2..163d355 100644 --- a/chrome/browser/ui/ash/event_rewriter.cc +++ b/chrome/browser/ui/ash/event_rewriter.cc @@ -11,8 +11,8 @@ #include "base/string_util.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile_manager.h" -#include "ui/aura/event.h" #include "ui/aura/root_window.h" +#include "ui/base/event.h" #include "ui/base/keycodes/keyboard_code_conversion.h" #if defined(OS_CHROMEOS) @@ -173,19 +173,19 @@ EventRewriter::DeviceType EventRewriter::GetDeviceType( return kDeviceUnknown; } -void EventRewriter::RewriteForTesting(aura::KeyEvent* event) { +void EventRewriter::RewriteForTesting(ui::KeyEvent* event) { Rewrite(event); } ash::EventRewriterDelegate::Action EventRewriter::RewriteOrFilterKeyEvent( - aura::KeyEvent* event) { + ui::KeyEvent* event) { if (event->HasNativeEvent()) Rewrite(event); return ash::EventRewriterDelegate::ACTION_REWRITE_EVENT; } ash::EventRewriterDelegate::Action EventRewriter::RewriteOrFilterLocatedEvent( - aura::LocatedEvent* event) { + ui::LocatedEvent* event) { if (event->HasNativeEvent()) RewriteLocatedEvent(event); return ash::EventRewriterDelegate::ACTION_REWRITE_EVENT; @@ -332,7 +332,7 @@ KeyCode EventRewriter::NativeKeySymToNativeKeycode(KeySym keysym) { } #endif -void EventRewriter::Rewrite(aura::KeyEvent* event) { +void EventRewriter::Rewrite(ui::KeyEvent* event) { #if defined(OS_CHROMEOS) // Do not rewrite an event sent by ui_controls::SendKeyPress(). See // crbug.com/136465. @@ -409,7 +409,7 @@ void EventRewriter::GetRemappedModifierMasks( #endif } -bool EventRewriter::RewriteModifiers(aura::KeyEvent* event) { +bool EventRewriter::RewriteModifiers(ui::KeyEvent* event) { // Do nothing if we have just logged in as guest but have not restarted chrome // process yet (so we are still on the login screen). In this situations we // have no user profile so can not do anything useful. @@ -500,7 +500,7 @@ bool EventRewriter::RewriteModifiers(aura::KeyEvent* event) { #endif } -bool EventRewriter::RewriteNumPadKeys(aura::KeyEvent* event) { +bool EventRewriter::RewriteNumPadKeys(ui::KeyEvent* event) { bool rewritten = false; #if defined(OS_CHROMEOS) XEvent* xev = event->native_event(); @@ -582,7 +582,7 @@ bool EventRewriter::RewriteNumPadKeys(aura::KeyEvent* event) { return rewritten; } -bool EventRewriter::RewriteBackspaceAndArrowKeys(aura::KeyEvent* event) { +bool EventRewriter::RewriteBackspaceAndArrowKeys(ui::KeyEvent* event) { bool rewritten = false; #if defined(OS_CHROMEOS) XEvent* xev = event->native_event(); @@ -629,7 +629,7 @@ bool EventRewriter::RewriteBackspaceAndArrowKeys(aura::KeyEvent* event) { return rewritten; } -void EventRewriter::RewriteLocatedEvent(aura::LocatedEvent* event) { +void EventRewriter::RewriteLocatedEvent(ui::LocatedEvent* event) { #if defined(OS_CHROMEOS) XEvent* xevent = event->native_event(); if (!xevent || xevent->type != GenericEvent) @@ -668,7 +668,7 @@ void EventRewriter::RewriteLocatedEvent(aura::LocatedEvent* event) { #endif } -void EventRewriter::OverwriteEvent(aura::KeyEvent* event, +void EventRewriter::OverwriteEvent(ui::KeyEvent* event, unsigned int new_native_keycode, unsigned int new_native_state, ui::KeyboardCode new_keycode, diff --git a/chrome/browser/ui/ash/event_rewriter.h b/chrome/browser/ui/ash/event_rewriter.h index 1e8f0d8..b87b5c9 100644 --- a/chrome/browser/ui/ash/event_rewriter.h +++ b/chrome/browser/ui/ash/event_rewriter.h @@ -51,7 +51,7 @@ class EventRewriter : public ash::EventRewriterDelegate, DeviceType DeviceAddedForTesting(int device_id, const std::string& device_name); // Calls Rewrite. - void RewriteForTesting(aura::KeyEvent* event); + void RewriteForTesting(ui::KeyEvent* event); const std::map<int, DeviceType>& device_id_to_type_for_testing() const { return device_id_to_type_; @@ -74,9 +74,9 @@ class EventRewriter : public ash::EventRewriterDelegate, private: // ash::EventRewriterDelegate overrides: virtual ash::EventRewriterDelegate::Action RewriteOrFilterKeyEvent( - aura::KeyEvent* event) OVERRIDE; + ui::KeyEvent* event) OVERRIDE; virtual ash::EventRewriterDelegate::Action RewriteOrFilterLocatedEvent( - aura::LocatedEvent* event) OVERRIDE; + ui::LocatedEvent* event) OVERRIDE; // aura::RootWindowObserver overrides: virtual void OnKeyboardMappingChanged(const aura::RootWindow* root) OVERRIDE; @@ -95,15 +95,15 @@ class EventRewriter : public ash::EventRewriterDelegate, #endif // Rewrites the |event| by applying all RewriteXXX functions as needed. - void Rewrite(aura::KeyEvent* event); + void Rewrite(ui::KeyEvent* event); // Rewrites a modifier key press/release following the current user // preferences. - bool RewriteModifiers(aura::KeyEvent* event); + bool RewriteModifiers(ui::KeyEvent* event); // Rewrites a NumPad key press/release without Num Lock to a corresponding key // press/release with the lock. Returns true when |event| is rewritten. - bool RewriteNumPadKeys(aura::KeyEvent* event); + bool RewriteNumPadKeys(ui::KeyEvent* event); // Rewrites Backspace and Arrow keys following the Chrome OS keyboard spec. // * Alt+Backspace -> Delete @@ -111,13 +111,13 @@ class EventRewriter : public ash::EventRewriterDelegate, // * Alt+Down -> Next (aka PageDown) // * Ctrl+Alt+Up -> Home // * Ctrl+Alt+Down -> End - bool RewriteBackspaceAndArrowKeys(aura::KeyEvent* event); + bool RewriteBackspaceAndArrowKeys(ui::KeyEvent* event); // Rewrites the located |event|. - void RewriteLocatedEvent(aura::LocatedEvent* event); + void RewriteLocatedEvent(ui::LocatedEvent* event); // Overwrites |event| with the keycodes and flags. - void OverwriteEvent(aura::KeyEvent* event, + void OverwriteEvent(ui::KeyEvent* event, unsigned int new_native_keycode, unsigned int new_native_state, ui::KeyboardCode new_keycode, diff --git a/chrome/browser/ui/ash/event_rewriter_unittest.cc b/chrome/browser/ui/ash/event_rewriter_unittest.cc index 6539c4a..8e929a9 100644 --- a/chrome/browser/ui/ash/event_rewriter_unittest.cc +++ b/chrome/browser/ui/ash/event_rewriter_unittest.cc @@ -10,7 +10,7 @@ #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_pref_service.h" #include "testing/gtest/include/gtest/gtest.h" -#include "ui/aura/event.h" +#include "ui/base/event.h" #if defined(OS_CHROMEOS) #include <X11/keysym.h> @@ -45,7 +45,7 @@ std::string GetRewrittenEventAsString(EventRewriter* rewriter, unsigned int x_state) { XEvent xev; InitXKeyEvent(ui_keycode, ui_flags, ui_type, x_keycode, x_state, &xev); - aura::KeyEvent keyevent(&xev, false /* is_char */); + ui::KeyEvent keyevent(&xev, false /* is_char */); rewriter->RewriteForTesting(&keyevent); return StringPrintf( "ui_keycode=%d ui_flags=%d ui_type=%d x_keycode=%u x_state=%u x_type=%d", @@ -1627,7 +1627,7 @@ TEST_F(EventRewriterTest, TestRewriteKeyEventSentByXSendEvent) { InitXKeyEvent(ui::VKEY_CONTROL, 0, ui::ET_KEY_PRESSED, keycode_control_l_, 0U, &xev); xev.xkey.send_event = True; // XSendEvent() always does this. - aura::KeyEvent keyevent(&xev, false /* is_char */); + ui::KeyEvent keyevent(&xev, false /* is_char */); rewriter.RewriteForTesting(&keyevent); rewritten_event = StringPrintf( "ui_keycode=%d ui_flags=%d ui_type=%d " diff --git a/chrome/browser/ui/views/ash/launcher/browser_launcher_item_controller_unittest.cc b/chrome/browser/ui/views/ash/launcher/browser_launcher_item_controller_unittest.cc index 85e0fd8..0c4f1b3 100644 --- a/chrome/browser/ui/views/ash/launcher/browser_launcher_item_controller_unittest.cc +++ b/chrome/browser/ui/views/ash/launcher/browser_launcher_item_controller_unittest.cc @@ -25,6 +25,7 @@ #include "ui/aura/test/test_window_delegate.h" #include "ui/aura/window.h" #include "ui/aura/window_delegate.h" +#include "ui/base/event.h" namespace { @@ -152,7 +153,7 @@ class BrowserLauncherItemControllerTest : } // aura::client::ActivationDelegate overrides. - virtual bool ShouldActivate(const aura::Event* event) OVERRIDE { + virtual bool ShouldActivate(const ui::Event* event) OVERRIDE { return true; } virtual void OnActivated() OVERRIDE { diff --git a/chrome/browser/ui/views/toolbar_view.cc b/chrome/browser/ui/views/toolbar_view.cc index 5e6e927..4f6a1ec 100644 --- a/chrome/browser/ui/views/toolbar_view.cc +++ b/chrome/browser/ui/views/toolbar_view.cc @@ -968,7 +968,7 @@ void ToolbarView::LayoutLocationBarNTP() { return; gfx::Point location_container_origin; - aura::Window::ConvertPointToWindow( + aura::Window::ConvertPointToTarget( contents_view, browser_window, &location_container_origin); views::View::ConvertPointFromWidget(location_bar_container_->parent(), &location_container_origin); diff --git a/content/browser/renderer_host/native_web_keyboard_event_aura.cc b/content/browser/renderer_host/native_web_keyboard_event_aura.cc index 1c8b503..8387d0a 100644 --- a/content/browser/renderer_host/native_web_keyboard_event_aura.cc +++ b/content/browser/renderer_host/native_web_keyboard_event_aura.cc @@ -6,7 +6,7 @@ #include "base/logging.h" #include "content/browser/renderer_host/web_input_event_aura.h" -#include "ui/aura/event.h" +#include "ui/base/event.h" namespace { @@ -14,8 +14,8 @@ namespace { // queued in RenderWidgetHost and may be passed and used // RenderViewHostDelegate::HandledKeybardEvent after the original aura // event is destroyed. -aura::Event* CopyEvent(aura::Event* event) { - return event ? static_cast<aura::KeyEvent*>(event)->Copy() : NULL; +ui::Event* CopyEvent(ui::Event* event) { + return event ? static_cast<ui::KeyEvent*>(event)->Copy() : NULL; } int EventFlagsToWebInputEventModifiers(int flags) { @@ -39,7 +39,7 @@ NativeWebKeyboardEvent::NativeWebKeyboardEvent() NativeWebKeyboardEvent::NativeWebKeyboardEvent(gfx::NativeEvent native_event) : WebKeyboardEvent(content::MakeWebKeyboardEvent( - static_cast<aura::KeyEvent*>(native_event))), + static_cast<ui::KeyEvent*>(native_event))), os_event(CopyEvent(native_event)), skip_in_browser(false) { } diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index 2739078..f60623a 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -32,10 +32,10 @@ #include "ui/aura/client/tooltip_client.h" #include "ui/aura/client/window_types.h" #include "ui/aura/env.h" -#include "ui/aura/event.h" #include "ui/aura/root_window.h" #include "ui/aura/window.h" #include "ui/aura/window_observer.h" +#include "ui/base/event.h" #include "ui/base/gestures/gesture_recognizer.h" #include "ui/base/hit_test.h" #include "ui/base/ime/input_method.h" @@ -89,7 +89,7 @@ void UpdateWebTouchEventAfterDispatch(WebKit::WebTouchEvent* event, } } -bool CanRendererHandleEvent(const aura::MouseEvent* event) { +bool CanRendererHandleEvent(const ui::MouseEvent* event) { if (event->type() == ui::ET_MOUSE_CAPTURE_CHANGED) return false; @@ -1149,7 +1149,7 @@ void RenderWidgetHostViewAura::OnBlur() { } } -bool RenderWidgetHostViewAura::OnKeyEvent(aura::KeyEvent* event) { +bool RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) { TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnKeyEvent"); if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab() && popup_child_host_view_->OnKeyEvent(event)) @@ -1196,7 +1196,7 @@ bool RenderWidgetHostViewAura::ShouldDescendIntoChildForEventHandling( return true; } -bool RenderWidgetHostViewAura::OnMouseEvent(aura::MouseEvent* event) { +bool RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) { TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnMouseEvent"); if (mouse_locked_) { WebKit::WebMouseEvent mouse_event = MakeWebMouseEvent(event); @@ -1236,13 +1236,13 @@ bool RenderWidgetHostViewAura::OnMouseEvent(aura::MouseEvent* event) { MakeWebGestureEventFlingCancel(); host_->ForwardGestureEvent(gesture_event); WebKit::WebMouseWheelEvent mouse_wheel_event = - MakeWebMouseWheelEvent(static_cast<aura::ScrollEvent*>(event)); + MakeWebMouseWheelEvent(static_cast<ui::ScrollEvent*>(event)); host_->ForwardWheelEvent(mouse_wheel_event); RecordAction(UserMetricsAction("TrackpadScroll")); } else if (event->type() == ui::ET_SCROLL_FLING_START || event->type() == ui::ET_SCROLL_FLING_CANCEL) { WebKit::WebGestureEvent gesture_event = - MakeWebGestureEvent(static_cast<aura::ScrollEvent*>(event)); + MakeWebGestureEvent(static_cast<ui::ScrollEvent*>(event)); host_->ForwardGestureEvent(gesture_event); if (event->type() == ui::ET_SCROLL_FLING_START) RecordAction(UserMetricsAction("TrackpadScrollFling")); @@ -1276,7 +1276,7 @@ bool RenderWidgetHostViewAura::OnMouseEvent(aura::MouseEvent* event) { } ui::TouchStatus RenderWidgetHostViewAura::OnTouchEvent( - aura::TouchEvent* event) { + ui::TouchEventImpl* event) { TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnTouchEvent"); // Update the touch event first. WebKit::WebTouchPoint* point = UpdateWebTouchEvent(event, @@ -1294,7 +1294,7 @@ ui::TouchStatus RenderWidgetHostViewAura::OnTouchEvent( } ui::GestureStatus RenderWidgetHostViewAura::OnGestureEvent( - aura::GestureEvent* event) { + ui::GestureEventImpl* event) { TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnGestureEvent"); // Pinch gestures are currently disabled by default. See crbug.com/128477. if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN || @@ -1399,13 +1399,13 @@ void RenderWidgetHostViewAura::GetHitTestMask(gfx::Path* mask) const { //////////////////////////////////////////////////////////////////////////////// // RenderWidgetHostViewAura, aura::client::ActivationDelegate implementation: -bool RenderWidgetHostViewAura::ShouldActivate(const aura::Event* event) { +bool RenderWidgetHostViewAura::ShouldActivate(const ui::Event* event) { bool activate = false; if (event) { if (event->type() == ui::ET_MOUSE_PRESSED) { activate = true; } else if (event->type() == ui::ET_GESTURE_BEGIN) { - activate = static_cast<const aura::GestureEvent*>(event)-> + activate = static_cast<const ui::GestureEventImpl*>(event)-> details().touch_points() == 1; } } diff --git a/content/browser/renderer_host/render_widget_host_view_aura.h b/content/browser/renderer_host/render_widget_host_view_aura.h index cd5e559..e8c4711 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.h +++ b/content/browser/renderer_host/render_widget_host_view_aura.h @@ -159,15 +159,16 @@ class RenderWidgetHostViewAura const gfx::Rect& new_bounds) OVERRIDE; virtual void OnFocus(aura::Window* old_focused_window) OVERRIDE; virtual void OnBlur() OVERRIDE; - virtual bool OnKeyEvent(aura::KeyEvent* event) OVERRIDE; + virtual bool OnKeyEvent(ui::KeyEvent* event) OVERRIDE; virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE; virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE; virtual bool ShouldDescendIntoChildForEventHandling( aura::Window* child, const gfx::Point& location) OVERRIDE; - virtual bool OnMouseEvent(aura::MouseEvent* event) OVERRIDE; - virtual ui::TouchStatus OnTouchEvent(aura::TouchEvent* event) OVERRIDE; - virtual ui::GestureStatus OnGestureEvent(aura::GestureEvent* event) OVERRIDE; + virtual bool OnMouseEvent(ui::MouseEvent* event) OVERRIDE; + virtual ui::TouchStatus OnTouchEvent(ui::TouchEventImpl* event) OVERRIDE; + virtual ui::GestureStatus OnGestureEvent( + ui::GestureEventImpl* event) OVERRIDE; virtual bool CanFocus() OVERRIDE; virtual void OnCaptureLost() OVERRIDE; virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; @@ -179,7 +180,7 @@ class RenderWidgetHostViewAura virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE; // Overridden from aura::client::ActivationDelegate: - virtual bool ShouldActivate(const aura::Event* event) OVERRIDE; + virtual bool ShouldActivate(const ui::Event* event) OVERRIDE; virtual void OnActivated() OVERRIDE; virtual void OnLostActive() OVERRIDE; diff --git a/content/browser/renderer_host/web_input_event_aura.cc b/content/browser/renderer_host/web_input_event_aura.cc index fade93d..7054d91 100644 --- a/content/browser/renderer_host/web_input_event_aura.cc +++ b/content/browser/renderer_host/web_input_event_aura.cc @@ -4,8 +4,8 @@ #include "content/browser/renderer_host/web_input_event_aura.h" -#include "ui/aura/event.h" #include "ui/aura/window.h" +#include "ui/base/event.h" namespace content { @@ -21,45 +21,45 @@ WebKit::WebGestureEvent MakeWebGestureEventFromNativeEvent( WebKit::WebTouchPoint* UpdateWebTouchEventFromNativeEvent( base::NativeEvent native_event, WebKit::WebTouchEvent* web_event); #else -WebKit::WebMouseEvent MakeWebMouseEventFromAuraEvent(aura::MouseEvent* event); +WebKit::WebMouseEvent MakeWebMouseEventFromAuraEvent(ui::MouseEvent* event); WebKit::WebMouseWheelEvent MakeWebMouseWheelEventFromAuraEvent( - aura::MouseEvent* event); + ui::MouseEvent* event); WebKit::WebMouseWheelEvent MakeWebMouseWheelEventFromAuraEvent( - aura::ScrollEvent* event); + ui::ScrollEvent* event); WebKit::WebKeyboardEvent MakeWebKeyboardEventFromAuraEvent( - aura::KeyEvent* event); + ui::KeyEvent* event); WebKit::WebGestureEvent MakeWebGestureEventFromAuraEvent( - aura::GestureEvent* event); + ui::GestureEventImpl* event); WebKit::WebGestureEvent MakeWebGestureEventFromAuraEvent( - aura::ScrollEvent* event); + ui::ScrollEvent* event); WebKit::WebTouchPoint* UpdateWebTouchEventFromAuraEvent( - aura::TouchEvent* event, WebKit::WebTouchEvent* web_event); + ui::TouchEventImpl* event, WebKit::WebTouchEvent* web_event); #endif // General approach: // -// aura::Event only carries a subset of possible event data provided to Aura by +// ui::Event only carries a subset of possible event data provided to Aura by // the host platform. WebKit utilizes a larger subset of that information than // Aura itself. WebKit includes some built in cracking functionality that we // rely on to obtain this information cleanly and consistently. // -// The only place where an aura::Event's data differs from what the underlying +// The only place where an ui::Event's data differs from what the underlying // base::NativeEvent would provide is position data, since we would like to // provide coordinates relative to the aura::Window that is hosting the // renderer, not the top level platform window. // // The approach is to fully construct a WebKit::WebInputEvent from the -// aura::Event's base::NativeEvent, and then replace the coordinate fields with -// the translated values from the aura::Event. +// ui::Event's base::NativeEvent, and then replace the coordinate fields with +// the translated values from the ui::Event. // -// The exception is mouse events on linux. The aura::MouseEvent contains enough +// The exception is mouse events on linux. The ui::MouseEvent contains enough // necessary information to construct a WebMouseEvent. So instead of extracting // the information from the XEvent, which can be tricky when supporting both // XInput2 and XInput, the WebMouseEvent is constructed from the -// aura::MouseEvent. This will not be necessary once only XInput2 is supported. +// ui::MouseEvent. This will not be necessary once only XInput2 is supported. // -WebKit::WebMouseEvent MakeWebMouseEvent(aura::MouseEvent* event) { +WebKit::WebMouseEvent MakeWebMouseEvent(ui::MouseEvent* event) { #if defined(OS_WIN) // Construct an untranslated event from the platform event data. WebKit::WebMouseEvent webkit_event = @@ -80,7 +80,7 @@ WebKit::WebMouseEvent MakeWebMouseEvent(aura::MouseEvent* event) { return webkit_event; } -WebKit::WebMouseWheelEvent MakeWebMouseWheelEvent(aura::MouseEvent* event) { +WebKit::WebMouseWheelEvent MakeWebMouseWheelEvent(ui::MouseEvent* event) { #if defined(OS_WIN) // Construct an untranslated event from the platform event data. WebKit::WebMouseWheelEvent webkit_event = @@ -102,7 +102,7 @@ WebKit::WebMouseWheelEvent MakeWebMouseWheelEvent(aura::MouseEvent* event) { return webkit_event; } -WebKit::WebMouseWheelEvent MakeWebMouseWheelEvent(aura::ScrollEvent* event) { +WebKit::WebMouseWheelEvent MakeWebMouseWheelEvent(ui::ScrollEvent* event) { #if defined(OS_WIN) // Construct an untranslated event from the platform event data. WebKit::WebMouseWheelEvent webkit_event = @@ -124,12 +124,12 @@ WebKit::WebMouseWheelEvent MakeWebMouseWheelEvent(aura::ScrollEvent* event) { return webkit_event; } -WebKit::WebKeyboardEvent MakeWebKeyboardEvent(aura::KeyEvent* event) { +WebKit::WebKeyboardEvent MakeWebKeyboardEvent(ui::KeyEvent* event) { // Windows can figure out whether or not to construct a RawKeyDown or a Char // WebInputEvent based on the type of message carried in // event->native_event(). X11 is not so fortunate, there is no separate // translated event type, so DesktopHostLinux sends an extra KeyEvent with - // is_char() == true. We need to pass the aura::KeyEvent to the X11 function + // is_char() == true. We need to pass the ui::KeyEvent to the X11 function // to detect this case so the right event type can be constructed. #if defined(OS_WIN) // Key events require no translation by the aura system. @@ -139,7 +139,7 @@ WebKit::WebKeyboardEvent MakeWebKeyboardEvent(aura::KeyEvent* event) { #endif } -WebKit::WebGestureEvent MakeWebGestureEvent(aura::GestureEvent* event) { +WebKit::WebGestureEvent MakeWebGestureEvent(ui::GestureEventImpl* event) { WebKit::WebGestureEvent gesture_event; #if defined(OS_WIN) gesture_event = MakeWebGestureEventFromNativeEvent(event->native_event()); @@ -157,7 +157,7 @@ WebKit::WebGestureEvent MakeWebGestureEvent(aura::GestureEvent* event) { return gesture_event; } -WebKit::WebGestureEvent MakeWebGestureEvent(aura::ScrollEvent* event) { +WebKit::WebGestureEvent MakeWebGestureEvent(ui::ScrollEvent* event) { WebKit::WebGestureEvent gesture_event; #if defined(OS_WIN) @@ -184,7 +184,7 @@ WebKit::WebGestureEvent MakeWebGestureEventFlingCancel() { return gesture_event; } -WebKit::WebTouchPoint* UpdateWebTouchEvent(aura::TouchEvent* event, +WebKit::WebTouchPoint* UpdateWebTouchEvent(ui::TouchEventImpl* event, WebKit::WebTouchEvent* web_event) { #if defined(OS_WIN) return UpdateWebTouchEventFromNativeEvent(event->native_event(), web_event); diff --git a/content/browser/renderer_host/web_input_event_aura.h b/content/browser/renderer_host/web_input_event_aura.h index 92593ca..c26a31e 100644 --- a/content/browser/renderer_host/web_input_event_aura.h +++ b/content/browser/renderer_host/web_input_event_aura.h @@ -8,34 +8,34 @@ #include "content/common/content_export.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" -namespace aura { -class GestureEvent; +namespace ui { +class GestureEventImpl; class KeyEvent; class MouseEvent; class ScrollEvent; -class TouchEvent; +class TouchEventImpl; } namespace content { CONTENT_EXPORT WebKit::WebMouseEvent MakeWebMouseEvent( - aura::MouseEvent* event); + ui::MouseEvent* event); CONTENT_EXPORT WebKit::WebMouseWheelEvent MakeWebMouseWheelEvent( - aura::MouseEvent* event); + ui::MouseEvent* event); CONTENT_EXPORT WebKit::WebMouseWheelEvent MakeWebMouseWheelEvent( - aura::ScrollEvent* event); + ui::ScrollEvent* event); CONTENT_EXPORT WebKit::WebKeyboardEvent MakeWebKeyboardEvent( - aura::KeyEvent* event); + ui::KeyEvent* event); CONTENT_EXPORT WebKit::WebGestureEvent MakeWebGestureEvent( - aura::GestureEvent* event); + ui::GestureEventImpl* event); CONTENT_EXPORT WebKit::WebGestureEvent MakeWebGestureEvent( - aura::ScrollEvent* event); + ui::ScrollEvent* event); CONTENT_EXPORT WebKit::WebGestureEvent MakeWebGestureEventFlingCancel(); // Updates the WebTouchEvent based on the TouchEvent. It returns the updated // WebTouchPoint contained in the WebTouchEvent, or NULL if no point was // updated. -WebKit::WebTouchPoint* UpdateWebTouchEvent(aura::TouchEvent* event, +WebKit::WebTouchPoint* UpdateWebTouchEvent(ui::TouchEventImpl* event, WebKit::WebTouchEvent* web_event); } diff --git a/content/browser/renderer_host/web_input_event_aura_unittest.cc b/content/browser/renderer_host/web_input_event_aura_unittest.cc index bed4577..a3879e5 100644 --- a/content/browser/renderer_host/web_input_event_aura_unittest.cc +++ b/content/browser/renderer_host/web_input_event_aura_unittest.cc @@ -6,7 +6,7 @@ #include "base/basictypes.h" #include "testing/gtest/include/gtest/gtest.h" -#include "ui/aura/event.h" +#include "ui/base/event.h" #if defined(USE_X11) #include <X11/keysym.h> @@ -27,7 +27,7 @@ TEST(WebInputEventAuraTest, TestMakeWebKeyboardEvent) { ui::VKEY_CONTROL, 0, // X does not set ControlMask for KeyPress. &xev); - aura::KeyEvent event(&xev, false /* is_char */); + ui::KeyEvent event(&xev, false /* is_char */); WebKit::WebKeyboardEvent webkit_event = MakeWebKeyboardEvent(&event); // However, modifier bit for Control in |webkit_event| should be set. EXPECT_EQ(webkit_event.modifiers, WebKit::WebInputEvent::ControlKey); @@ -38,7 +38,7 @@ TEST(WebInputEventAuraTest, TestMakeWebKeyboardEvent) { ui::VKEY_CONTROL, ControlMask, // X sets the mask for KeyRelease. &xev); - aura::KeyEvent event(&xev, false /* is_char */); + ui::KeyEvent event(&xev, false /* is_char */); WebKit::WebKeyboardEvent webkit_event = MakeWebKeyboardEvent(&event); // However, modifier bit for Control in |webkit_event| shouldn't be set. EXPECT_EQ(webkit_event.modifiers, 0); @@ -57,7 +57,7 @@ TEST(WebInputEventAuraTest, TestMakeWebKeyboardEventWindowsKeyCode) { 0, // X does not set ControlMask for KeyPress. &xev); xev.xkey.keycode = XKeysymToKeycode(ui::GetXDisplay(), XK_Control_L); - aura::KeyEvent event(&xev, false /* is_char */); + ui::KeyEvent event(&xev, false /* is_char */); WebKit::WebKeyboardEvent webkit_event = MakeWebKeyboardEvent(&event); // ui::VKEY_LCONTROL, instead of ui::VKEY_CONTROL, should be filled. EXPECT_EQ(ui::VKEY_LCONTROL, webkit_event.windowsKeyCode); @@ -69,7 +69,7 @@ TEST(WebInputEventAuraTest, TestMakeWebKeyboardEventWindowsKeyCode) { 0, // X does not set ControlMask for KeyPress. &xev); xev.xkey.keycode = XKeysymToKeycode(ui::GetXDisplay(), XK_Control_R); - aura::KeyEvent event(&xev, false /* is_char */); + ui::KeyEvent event(&xev, false /* is_char */); WebKit::WebKeyboardEvent webkit_event = MakeWebKeyboardEvent(&event); // ui::VKEY_RCONTROL, instead of ui::VKEY_CONTROL, should be filled. EXPECT_EQ(ui::VKEY_RCONTROL, webkit_event.windowsKeyCode); diff --git a/content/browser/renderer_host/web_input_event_aurax11.cc b/content/browser/renderer_host/web_input_event_aurax11.cc index a7aea7c..0235bb0 100644 --- a/content/browser/renderer_host/web_input_event_aurax11.cc +++ b/content/browser/renderer_host/web_input_event_aurax11.cc @@ -44,7 +44,7 @@ #include "base/event_types.h" #include "base/logging.h" -#include "ui/aura/event.h" +#include "ui/base/event.h" #include "ui/base/events.h" #include "ui/base/keycodes/keyboard_codes.h" #include "ui/base/keycodes/keyboard_code_conversion_x.h" @@ -62,7 +62,7 @@ const int kPixelsPerTick = 53; // Normalizes event.flags() to make it Windows/Mac compatible. Since the way // of setting modifier mask on X is very different than Windows/Mac as shown // in http://crbug.com/127142#c8, the normalization is necessary. -int NormalizeEventFlags(const aura::KeyEvent& event) { +int NormalizeEventFlags(const ui::KeyEvent& event) { int mask = 0; switch (event.key_code()) { case ui::VKEY_CONTROL: @@ -182,7 +182,7 @@ WebKit::WebUChar GetControlCharacter(int windows_key_code, bool shift) { } WebKit::WebTouchPoint::State TouchPointStateFromEvent( - const aura::TouchEvent* event) { + const ui::TouchEventImpl* event) { switch (event->type()) { case ui::ET_TOUCH_PRESSED: return WebKit::WebTouchPoint::StatePressed; @@ -198,7 +198,7 @@ WebKit::WebTouchPoint::State TouchPointStateFromEvent( } WebKit::WebInputEvent::Type TouchEventTypeFromEvent( - const aura::TouchEvent* event) { + const ui::TouchEventImpl* event) { switch (event->type()) { case ui::ET_TOUCH_PRESSED: return WebKit::WebInputEvent::TouchStart; @@ -215,7 +215,7 @@ WebKit::WebInputEvent::Type TouchEventTypeFromEvent( } // namespace -WebKit::WebMouseEvent MakeWebMouseEventFromAuraEvent(aura::MouseEvent* event) { +WebKit::WebMouseEvent MakeWebMouseEventFromAuraEvent(ui::MouseEvent* event) { WebKit::WebMouseEvent webkit_event; webkit_event.modifiers = EventFlagsToWebEventModifiers(event->flags()); @@ -252,7 +252,7 @@ WebKit::WebMouseEvent MakeWebMouseEventFromAuraEvent(aura::MouseEvent* event) { } WebKit::WebMouseWheelEvent MakeWebMouseWheelEventFromAuraEvent( - aura::MouseEvent* event) { + ui::MouseEvent* event) { WebKit::WebMouseWheelEvent webkit_event; webkit_event.type = WebKit::WebInputEvent::MouseWheel; @@ -266,7 +266,7 @@ WebKit::WebMouseWheelEvent MakeWebMouseWheelEventFromAuraEvent( } WebKit::WebMouseWheelEvent MakeWebMouseWheelEventFromAuraEvent( - aura::ScrollEvent* event) { + ui::ScrollEvent* event) { WebKit::WebMouseWheelEvent webkit_event; webkit_event.type = WebKit::WebInputEvent::MouseWheel; @@ -283,7 +283,7 @@ WebKit::WebMouseWheelEvent MakeWebMouseWheelEventFromAuraEvent( } WebKit::WebGestureEvent MakeWebGestureEventFromAuraEvent( - aura::ScrollEvent* event) { + ui::ScrollEvent* event) { WebKit::WebGestureEvent webkit_event; switch (event->type()) { @@ -309,7 +309,7 @@ WebKit::WebGestureEvent MakeWebGestureEventFromAuraEvent( } WebKit::WebKeyboardEvent MakeWebKeyboardEventFromAuraEvent( - aura::KeyEvent* event) { + ui::KeyEvent* event) { base::NativeEvent native_event = event->native_event(); WebKit::WebKeyboardEvent webkit_event; XKeyEvent* native_key_event = &native_event->xkey; @@ -358,7 +358,7 @@ WebKit::WebKeyboardEvent MakeWebKeyboardEventFromAuraEvent( } WebKit::WebGestureEvent MakeWebGestureEventFromAuraEvent( - aura::GestureEvent* event) { + ui::GestureEventImpl* event) { WebKit::WebGestureEvent gesture_event; switch (event->type()) { @@ -422,7 +422,7 @@ WebKit::WebGestureEvent MakeWebGestureEventFromAuraEvent( } WebKit::WebTouchPoint* UpdateWebTouchEventFromAuraEvent( - aura::TouchEvent* event, WebKit::WebTouchEvent* web_event) { + ui::TouchEventImpl* event, WebKit::WebTouchEvent* web_event) { WebKit::WebTouchPoint* point = NULL; switch (event->type()) { case ui::ET_TOUCH_PRESSED: diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc index add4e09..2ea648f 100644 --- a/content/browser/web_contents/web_contents_view_aura.cc +++ b/content/browser/web_contents/web_contents_view_aura.cc @@ -18,13 +18,13 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" #include "ui/aura/client/drag_drop_client.h" #include "ui/aura/client/drag_drop_delegate.h" -#include "ui/aura/event.h" #include "ui/aura/root_window.h" #include "ui/aura/window.h" #include "ui/base/clipboard/custom_data_helper.h" #include "ui/base/dragdrop/drag_drop_types.h" #include "ui/base/dragdrop/os_exchange_data.h" #include "ui/base/dragdrop/os_exchange_data_provider_aura.h" +#include "ui/base/event.h" #include "ui/base/hit_test.h" #include "ui/compositor/layer.h" #include "ui/gfx/screen.h" @@ -73,7 +73,7 @@ class WebDragSourceAura : public MessageLoopForUI::Observer { screen_loc_in_pixel); gfx::Point client_loc = screen_loc; aura::Window* window = rvh->GetView()->GetNativeView(); - aura::Window::ConvertPointToWindow(window->GetRootWindow(), + aura::Window::ConvertPointToTarget(window->GetRootWindow(), window, &client_loc); rvh->DragSourceMovedTo(client_loc.x(), client_loc.y(), screen_loc.x(), screen_loc.y()); @@ -241,7 +241,7 @@ void WebContentsViewAura::EndDrag(WebKit::WebDragOperationsMask ops) { gfx::Point client_loc = screen_loc; content::RenderViewHost* rvh = web_contents_->GetRenderViewHost(); aura::Window* window = rvh->GetView()->GetNativeView(); - aura::Window::ConvertPointToWindow(root_window, window, &client_loc); + aura::Window::ConvertPointToTarget(root_window, window, &client_loc); rvh->DragSourceEndedAt(client_loc.x(), client_loc.y(), screen_loc.x(), screen_loc.y(), ops); } @@ -496,7 +496,7 @@ void WebContentsViewAura::OnFocus(aura::Window* old_focused_window) { void WebContentsViewAura::OnBlur() { } -bool WebContentsViewAura::OnKeyEvent(aura::KeyEvent* event) { +bool WebContentsViewAura::OnKeyEvent(ui::KeyEvent* event) { return false; } @@ -514,7 +514,7 @@ bool WebContentsViewAura::ShouldDescendIntoChildForEventHandling( return true; } -bool WebContentsViewAura::OnMouseEvent(aura::MouseEvent* event) { +bool WebContentsViewAura::OnMouseEvent(ui::MouseEvent* event) { if (!web_contents_->GetDelegate()) return false; @@ -532,12 +532,12 @@ bool WebContentsViewAura::OnMouseEvent(aura::MouseEvent* event) { return false; } -ui::TouchStatus WebContentsViewAura::OnTouchEvent(aura::TouchEvent* event) { +ui::TouchStatus WebContentsViewAura::OnTouchEvent(ui::TouchEventImpl* event) { return ui::TOUCH_STATUS_UNKNOWN; } ui::GestureStatus WebContentsViewAura::OnGestureEvent( - aura::GestureEvent* event) { + ui::GestureEventImpl* event) { return ui::GESTURE_STATUS_UNKNOWN; } @@ -580,7 +580,7 @@ void WebContentsViewAura::GetHitTestMask(gfx::Path* mask) const { //////////////////////////////////////////////////////////////////////////////// // WebContentsViewAura, aura::client::DragDropDelegate implementation: -void WebContentsViewAura::OnDragEntered(const aura::DropTargetEvent& event) { +void WebContentsViewAura::OnDragEntered(const ui::DropTargetEvent& event) { if (drag_dest_delegate_) drag_dest_delegate_->DragInitialize(web_contents_); @@ -600,7 +600,7 @@ void WebContentsViewAura::OnDragEntered(const aura::DropTargetEvent& event) { } } -int WebContentsViewAura::OnDragUpdated(const aura::DropTargetEvent& event) { +int WebContentsViewAura::OnDragUpdated(const ui::DropTargetEvent& event) { DCHECK(current_rvh_for_drag_); if (current_rvh_for_drag_ != web_contents_->GetRenderViewHost()) OnDragEntered(event); @@ -627,7 +627,7 @@ void WebContentsViewAura::OnDragExited() { drag_dest_delegate_->OnDragLeave(); } -int WebContentsViewAura::OnPerformDrop(const aura::DropTargetEvent& event) { +int WebContentsViewAura::OnPerformDrop(const ui::DropTargetEvent& event) { DCHECK(current_rvh_for_drag_); if (current_rvh_for_drag_ != web_contents_->GetRenderViewHost()) OnDragEntered(event); diff --git a/content/browser/web_contents/web_contents_view_aura.h b/content/browser/web_contents/web_contents_view_aura.h index 0aeb5ba..1db8a96 100644 --- a/content/browser/web_contents/web_contents_view_aura.h +++ b/content/browser/web_contents/web_contents_view_aura.h @@ -26,6 +26,10 @@ class WebContentsViewDelegate; class WebDragDestDelegate; } +namespace ui { +class DropTargetEvent; +} + class CONTENT_EXPORT WebContentsViewAura : public content::WebContentsView, public content::RenderViewHostDelegateView, @@ -90,15 +94,16 @@ class CONTENT_EXPORT WebContentsViewAura const gfx::Rect& new_bounds) OVERRIDE; virtual void OnFocus(aura::Window* old_focused_window) OVERRIDE; virtual void OnBlur() OVERRIDE; - virtual bool OnKeyEvent(aura::KeyEvent* event) OVERRIDE; + virtual bool OnKeyEvent(ui::KeyEvent* event) OVERRIDE; virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE; virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE; virtual bool ShouldDescendIntoChildForEventHandling( aura::Window* child, const gfx::Point& location) OVERRIDE; - virtual bool OnMouseEvent(aura::MouseEvent* event) OVERRIDE; - virtual ui::TouchStatus OnTouchEvent(aura::TouchEvent* event) OVERRIDE; - virtual ui::GestureStatus OnGestureEvent(aura::GestureEvent* event) OVERRIDE; + virtual bool OnMouseEvent(ui::MouseEvent* event) OVERRIDE; + virtual ui::TouchStatus OnTouchEvent(ui::TouchEventImpl* event) OVERRIDE; + virtual ui::GestureStatus OnGestureEvent( + ui::GestureEventImpl* event) OVERRIDE; virtual bool CanFocus() OVERRIDE; virtual void OnCaptureLost() OVERRIDE; virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; @@ -110,10 +115,10 @@ class CONTENT_EXPORT WebContentsViewAura virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE; // Overridden from aura::client::DragDropDelegate: - virtual void OnDragEntered(const aura::DropTargetEvent& event) OVERRIDE; - virtual int OnDragUpdated(const aura::DropTargetEvent& event) OVERRIDE; + virtual void OnDragEntered(const ui::DropTargetEvent& event) OVERRIDE; + virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; virtual void OnDragExited() OVERRIDE; - virtual int OnPerformDrop(const aura::DropTargetEvent& event) OVERRIDE; + virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE; gfx::Size initial_size_; diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc index 4605b02..b8ec214 100644 --- a/content/renderer/render_view_browsertest.cc +++ b/content/renderer/render_view_browsertest.cc @@ -40,7 +40,7 @@ #endif #if defined(USE_AURA) -#include "ui/aura/event.h" +#include "ui/base/event.h" #endif #if defined(USE_AURA) && defined(USE_X11) @@ -176,7 +176,7 @@ class RenderViewImplTest : public content::RenderViewTest { // WM_CHAR sends a composed Unicode character. MSG msg1 = { NULL, WM_KEYDOWN, key_code, 0 }; #if defined(USE_AURA) - aura::KeyEvent evt1(msg1, false); + ui::KeyEvent evt1(msg1, false); NativeWebKeyboardEvent keydown_event(&evt1); #else NativeWebKeyboardEvent keydown_event(msg1); @@ -185,7 +185,7 @@ class RenderViewImplTest : public content::RenderViewTest { MSG msg2 = { NULL, WM_CHAR, (*output)[0], 0 }; #if defined(USE_AURA) - aura::KeyEvent evt2(msg2, true); + ui::KeyEvent evt2(msg2, true); NativeWebKeyboardEvent char_event(&evt2); #else NativeWebKeyboardEvent char_event(msg2); @@ -194,7 +194,7 @@ class RenderViewImplTest : public content::RenderViewTest { MSG msg3 = { NULL, WM_KEYUP, key_code, 0 }; #if defined(USE_AURA) - aura::KeyEvent evt3(msg3, false); + ui::KeyEvent evt3(msg3, false); NativeWebKeyboardEvent keyup_event(&evt3); #else NativeWebKeyboardEvent keyup_event(msg3); @@ -213,7 +213,7 @@ class RenderViewImplTest : public content::RenderViewTest { static_cast<ui::KeyboardCode>(key_code), flags, &xevent1); - aura::KeyEvent event1(&xevent1, false); + ui::KeyEvent event1(&xevent1, false); NativeWebKeyboardEvent keydown_event(&event1); SendNativeKeyEvent(keydown_event); @@ -222,7 +222,7 @@ class RenderViewImplTest : public content::RenderViewTest { static_cast<ui::KeyboardCode>(key_code), flags, &xevent2); - aura::KeyEvent event2(&xevent2, true); + ui::KeyEvent event2(&xevent2, true); NativeWebKeyboardEvent char_event(&event2); SendNativeKeyEvent(char_event); @@ -231,7 +231,7 @@ class RenderViewImplTest : public content::RenderViewTest { static_cast<ui::KeyboardCode>(key_code), flags, &xevent3); - aura::KeyEvent event3(&xevent3, false); + ui::KeyEvent event3(&xevent3, false); NativeWebKeyboardEvent keyup_event(&event3); SendNativeKeyEvent(keyup_event); diff --git a/ui/aura/aura.gyp b/ui/aura/aura.gyp index cf4ed9f..cd41c3b4 100644 --- a/ui/aura/aura.gyp +++ b/ui/aura/aura.gyp @@ -77,11 +77,7 @@ 'env.cc', 'env.h', 'env_observer.h', - 'event.cc', - 'event.h', 'event_filter.h', - 'event_mac.mm', - 'event_mac.h', 'focus_change_observer.h', 'focus_manager.cc', 'focus_manager.h', @@ -281,7 +277,6 @@ 'shared/compound_event_filter_unittest.cc', 'shared/input_method_event_filter_unittest.cc', 'event_filter_unittest.cc', - 'event_unittest.cc', 'window_unittest.cc', ], 'conditions': [ diff --git a/ui/aura/bench/bench_main.cc b/ui/aura/bench/bench_main.cc index 4c135cd..a833079 100644 --- a/ui/aura/bench/bench_main.cc +++ b/ui/aura/bench/bench_main.cc @@ -13,7 +13,6 @@ #include "third_party/khronos/GLES2/gl2.h" #include "third_party/skia/include/core/SkXfermode.h" #include "ui/aura/env.h" -#include "ui/aura/event.h" #include "ui/aura/root_window.h" #include "ui/aura/single_display_manager.h" #include "ui/aura/shared/root_window_capture_client.h" diff --git a/ui/aura/client/activation_client.h b/ui/aura/client/activation_client.h index 59841b3..23656e6 100644 --- a/ui/aura/client/activation_client.h +++ b/ui/aura/client/activation_client.h @@ -8,8 +8,11 @@ #include "ui/aura/aura_export.h" #include "ui/aura/window.h" -namespace aura { +namespace ui { class Event; +} + +namespace aura { class RootWindow; namespace client { @@ -30,11 +33,11 @@ class AURA_EXPORT ActivationClient { virtual void DeactivateWindow(Window* window) = 0; // Retrieves the active window, or NULL if there is none. - virtual aura::Window* GetActiveWindow() = 0; + virtual Window* GetActiveWindow() = 0; // Invoked prior to |window| getting focus as a result of the |event|. |event| // may be NULL. Returning false blocks |window| from getting focus. - virtual bool OnWillFocusWindow(Window* window, const Event* event) = 0; + virtual bool OnWillFocusWindow(Window* window, const ui::Event* event) = 0; // Returns true if |window| can be activated, false otherwise. If |window| has // a modal child it can not be activated. diff --git a/ui/aura/client/activation_delegate.h b/ui/aura/client/activation_delegate.h index 8551f85..ddb8069 100644 --- a/ui/aura/client/activation_delegate.h +++ b/ui/aura/client/activation_delegate.h @@ -7,8 +7,11 @@ #include "ui/aura/aura_export.h" -namespace aura { +namespace ui { class Event; +} + +namespace aura { class Window; namespace client { @@ -20,7 +23,7 @@ class AURA_EXPORT ActivationDelegate { // event supplied if the activation is the result of a mouse, or the touch // event if the activation is the result of a touch, or NULL if activation is // attempted for another reason. - virtual bool ShouldActivate(const Event* event) = 0; + virtual bool ShouldActivate(const ui::Event* event) = 0; // Sent when the window is activated. virtual void OnActivated() = 0; diff --git a/ui/aura/client/drag_drop_client.h b/ui/aura/client/drag_drop_client.h index 0df38b5..49ee306 100644 --- a/ui/aura/client/drag_drop_client.h +++ b/ui/aura/client/drag_drop_client.h @@ -6,9 +6,14 @@ #define UI_AURA_CLIENT_DRAG_DROP_CLIENT_H_ #include "ui/aura/aura_export.h" -#include "ui/aura/event.h" +#include "ui/gfx/native_widget_types.h" + +namespace gfx { +class Point; +} namespace ui { +class LocatedEvent; class OSExchangeData; } @@ -30,10 +35,12 @@ class AURA_EXPORT DragDropClient { int operation) = 0; // Called when mouse is dragged during a drag and drop. - virtual void DragUpdate(aura::Window* target, const LocatedEvent& event) = 0; + virtual void DragUpdate(aura::Window* target, + const ui::LocatedEvent& event) = 0; // Called when mouse is released during a drag and drop. - virtual void Drop(aura::Window* target, const LocatedEvent& event) = 0; + virtual void Drop(aura::Window* target, + const ui::LocatedEvent& event) = 0; // Called when a drag and drop session is cancelled. virtual void DragCancel() = 0; diff --git a/ui/aura/client/drag_drop_delegate.h b/ui/aura/client/drag_drop_delegate.h index 01c6645..dde7f32 100644 --- a/ui/aura/client/drag_drop_delegate.h +++ b/ui/aura/client/drag_drop_delegate.h @@ -7,8 +7,11 @@ #include "ui/aura/aura_export.h" -namespace aura { +namespace ui { class DropTargetEvent; +} + +namespace aura { class Window; namespace client { @@ -18,13 +21,13 @@ class AURA_EXPORT DragDropDelegate { // OnDragEntered is invoked when the mouse enters this window during a drag & // drop session. This is immediately followed by an invocation of // OnDragUpdated, and eventually one of OnDragExited or OnPerformDrop. - virtual void OnDragEntered(const DropTargetEvent& event) = 0; + virtual void OnDragEntered(const ui::DropTargetEvent& event) = 0; // Invoked during a drag and drop session while the mouse is over the window. // This should return a bitmask of the DragDropTypes::DragOperation supported // based on the location of the event. Return 0 to indicate the drop should // not be accepted. - virtual int OnDragUpdated(const DropTargetEvent& event) = 0; + virtual int OnDragUpdated(const ui::DropTargetEvent& event) = 0; // Invoked during a drag and drop session when the mouse exits the window, or // when the drag session was canceled and the mouse was over the window. @@ -32,7 +35,7 @@ class AURA_EXPORT DragDropDelegate { // Invoked during a drag and drop session when OnDragUpdated returns a valid // operation and the user release the mouse. - virtual int OnPerformDrop(const DropTargetEvent& event) = 0; + virtual int OnPerformDrop(const ui::DropTargetEvent& event) = 0; protected: virtual ~DragDropDelegate() {} diff --git a/ui/aura/client/tooltip_client.h b/ui/aura/client/tooltip_client.h index b9197f1..416547b 100644 --- a/ui/aura/client/tooltip_client.h +++ b/ui/aura/client/tooltip_client.h @@ -6,7 +6,6 @@ #define UI_AURA_CLIENT_TOOLTIP_CLIENT_H_ #include "ui/aura/aura_export.h" -#include "ui/aura/event.h" #include "ui/gfx/font.h" namespace aura { diff --git a/ui/aura/demo/demo_main.cc b/ui/aura/demo/demo_main.cc index 6ed8c40..52e5fc2 100644 --- a/ui/aura/demo/demo_main.cc +++ b/ui/aura/demo/demo_main.cc @@ -10,12 +10,12 @@ #include "third_party/skia/include/core/SkXfermode.h" #include "ui/aura/client/stacking_client.h" #include "ui/aura/env.h" -#include "ui/aura/event.h" #include "ui/aura/root_window.h" #include "ui/aura/single_display_manager.h" #include "ui/aura/shared/root_window_capture_client.h" #include "ui/aura/window.h" #include "ui/aura/window_delegate.h" +#include "ui/base/event.h" #include "ui/base/hit_test.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/ui_base_paths.h" @@ -42,7 +42,7 @@ class DemoWindowDelegate : public aura::WindowDelegate { const gfx::Rect& new_bounds) OVERRIDE {} virtual void OnFocus(aura::Window* old_focused_window) OVERRIDE {} virtual void OnBlur() OVERRIDE {} - virtual bool OnKeyEvent(aura::KeyEvent* event) OVERRIDE { + virtual bool OnKeyEvent(ui::KeyEvent* event) OVERRIDE { return false; } virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE { @@ -56,13 +56,14 @@ class DemoWindowDelegate : public aura::WindowDelegate { const gfx::Point& location) OVERRIDE { return true; } - virtual bool OnMouseEvent(aura::MouseEvent* event) OVERRIDE { + virtual bool OnMouseEvent(ui::MouseEvent* event) OVERRIDE { return true; } - virtual ui::TouchStatus OnTouchEvent(aura::TouchEvent* event) OVERRIDE { + virtual ui::TouchStatus OnTouchEvent(ui::TouchEventImpl* event) OVERRIDE { return ui::TOUCH_STATUS_END; } - virtual ui::GestureStatus OnGestureEvent(aura::GestureEvent* event) OVERRIDE { + virtual ui::GestureStatus OnGestureEvent( + ui::GestureEventImpl* event) OVERRIDE { return ui::GESTURE_STATUS_UNKNOWN; } virtual bool CanFocus() OVERRIDE { return true; } diff --git a/ui/aura/desktop/desktop_activation_client.cc b/ui/aura/desktop/desktop_activation_client.cc index d948203..497d56e 100644 --- a/ui/aura/desktop/desktop_activation_client.cc +++ b/ui/aura/desktop/desktop_activation_client.cc @@ -97,7 +97,7 @@ Window* DesktopActivationClient::GetActiveWindow() { } bool DesktopActivationClient::OnWillFocusWindow(Window* window, - const Event* event) { + const ui::Event* event) { return CanActivateWindow(GetActivatableWindow(window)); } diff --git a/ui/aura/desktop/desktop_activation_client.h b/ui/aura/desktop/desktop_activation_client.h index 5954ac2..1206d21 100644 --- a/ui/aura/desktop/desktop_activation_client.h +++ b/ui/aura/desktop/desktop_activation_client.h @@ -39,7 +39,8 @@ class AURA_EXPORT DesktopActivationClient : public client::ActivationClient, virtual void ActivateWindow(Window* window) OVERRIDE; virtual void DeactivateWindow(Window* window) OVERRIDE; virtual aura::Window* GetActiveWindow() OVERRIDE; - virtual bool OnWillFocusWindow(Window* window, const Event* event) OVERRIDE; + virtual bool OnWillFocusWindow(Window* window, + const ui::Event* event) OVERRIDE; virtual bool CanActivateWindow(Window* window) const OVERRIDE; // Overridden from aura::WindowObserver: diff --git a/ui/aura/event.cc b/ui/aura/event.cc deleted file mode 100644 index 503afbc..0000000 --- a/ui/aura/event.cc +++ /dev/null @@ -1,479 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/aura/event.h" - -#if defined(USE_X11) -#include <X11/Xlib.h> -#endif - -#include <cstring> - -#include "ui/aura/window.h" -#include "ui/base/keycodes/keyboard_code_conversion.h" -#include "ui/gfx/point3.h" -#include "ui/gfx/interpolated_transform.h" -#include "ui/gfx/transform.h" - -#if defined(OS_MACOSX) -#include "ui/aura/event_mac.h" -#endif - -#if defined(USE_X11) -#include "ui/base/keycodes/keyboard_code_conversion_x.h" -#endif - -namespace { - -base::NativeEvent CopyNativeEvent(const base::NativeEvent& event) { -#if defined(USE_X11) - XEvent* copy = new XEvent; - *copy = *event; - return copy; -#elif defined(OS_WIN) - return event; -#elif defined(OS_MACOSX) - return aura::CopyNativeEvent(event); -#else - NOTREACHED() << - "Don't know how to copy base::NativeEvent for this platform"; -#endif -} - -} // namespace - -namespace aura { - -Event::~Event() { -#if defined(USE_X11) - if (delete_native_event_) - delete native_event_; -#endif -} - -bool Event::HasNativeEvent() const { - base::NativeEvent null_event; - std::memset(&null_event, 0, sizeof(null_event)); - return !!std::memcmp(&native_event_, &null_event, sizeof(null_event)); -} - -Event::Event(ui::EventType type, int flags) - : type_(type), - time_stamp_(base::Time::NowFromSystemTime() - base::Time()), - flags_(flags), - delete_native_event_(false) { - Init(); -} - -Event::Event(const base::NativeEvent& native_event, - ui::EventType type, - int flags) - : type_(type), - time_stamp_(ui::EventTimeFromNative(native_event)), - flags_(flags), - delete_native_event_(false) { - InitWithNativeEvent(native_event); -} - -Event::Event(const Event& copy) - : native_event_(copy.native_event_), - type_(copy.type_), - time_stamp_(copy.time_stamp_), - flags_(copy.flags_), - delete_native_event_(false) { -} - -void Event::Init() { - std::memset(&native_event_, 0, sizeof(native_event_)); -} - -void Event::InitWithNativeEvent(const base::NativeEvent& native_event) { - native_event_ = native_event; -} - -LocatedEvent::~LocatedEvent() { -} - -LocatedEvent::LocatedEvent(const base::NativeEvent& native_event) - : Event(native_event, - ui::EventTypeFromNative(native_event), - ui::EventFlagsFromNative(native_event)), - location_(ui::EventLocationFromNative(native_event)), - root_location_(location_) { -} - -LocatedEvent::LocatedEvent(const LocatedEvent& model, - Window* source, - Window* target) - : Event(model), - location_(model.location_), - root_location_(model.root_location_) { - if (target && target != source) - Window::ConvertPointToWindow(source, target, &location_); -} - -LocatedEvent::LocatedEvent(ui::EventType type, - const gfx::Point& location, - const gfx::Point& root_location, - int flags) - : Event(type, flags), - location_(location), - root_location_(root_location) { -} - -void LocatedEvent::UpdateForRootTransform(const ui::Transform& root_transform) { - // Transform has to be done at root level. - DCHECK_EQ(root_location_.x(), location_.x()); - DCHECK_EQ(root_location_.y(), location_.y()); - gfx::Point3f p(location_); - root_transform.TransformPointReverse(p); - root_location_ = location_ = p.AsPoint(); -} - -MouseEvent::MouseEvent(const base::NativeEvent& native_event) - : LocatedEvent(native_event) { - if (type() == ui::ET_MOUSE_PRESSED) - SetClickCount(GetRepeatCount(*this)); -} - -MouseEvent::MouseEvent(const MouseEvent& model, Window* source, Window* target) - : LocatedEvent(model, source, target) { -} - -MouseEvent::MouseEvent(const MouseEvent& model, - Window* source, - Window* target, - ui::EventType type, - int flags) - : LocatedEvent(model, source, target) { - set_type(type); - set_flags(flags); -} - -MouseEvent::MouseEvent(ui::EventType type, - const gfx::Point& location, - const gfx::Point& root_location, - int flags) - : LocatedEvent(type, location, root_location, flags) { -} - -// static -bool MouseEvent::IsRepeatedClickEvent( - const MouseEvent& event1, - const MouseEvent& event2) { - // These values match the Windows defaults. - static const int kDoubleClickTimeMS = 500; - static const int kDoubleClickWidth = 4; - static const int kDoubleClickHeight = 4; - - if (event1.type() != ui::ET_MOUSE_PRESSED || - event2.type() != ui::ET_MOUSE_PRESSED) - return false; - - // Compare flags, but ignore EF_IS_DOUBLE_CLICK to allow triple clicks. - if ((event1.flags() & ~ui::EF_IS_DOUBLE_CLICK) != - (event2.flags() & ~ui::EF_IS_DOUBLE_CLICK)) - return false; - - base::TimeDelta time_difference = event2.time_stamp() - event1.time_stamp(); - - if (time_difference.InMilliseconds() > kDoubleClickTimeMS) - return false; - - if (abs(event2.x() - event1.x()) > kDoubleClickWidth / 2) - return false; - - if (abs(event2.y() - event1.y()) > kDoubleClickHeight / 2) - return false; - - return true; -} - -// static -int MouseEvent::GetRepeatCount(const MouseEvent& event) { - int click_count = 1; - if (last_click_event_) { - if (IsRepeatedClickEvent(*last_click_event_, event)) - click_count = last_click_event_->GetClickCount() + 1; - delete last_click_event_; - } - last_click_event_ = new MouseEvent(event, NULL, NULL); - if (click_count > 3) - click_count = 3; - last_click_event_->SetClickCount(click_count); - return click_count; -} - -// static -MouseEvent* MouseEvent::last_click_event_ = NULL; - -int MouseEvent::GetClickCount() const { - if (type() != ui::ET_MOUSE_PRESSED) - return 0; - - if (flags() & ui::EF_IS_TRIPLE_CLICK) - return 3; - else if (flags() & ui::EF_IS_DOUBLE_CLICK) - return 2; - else - return 1; -} - -void MouseEvent::SetClickCount(int click_count) { - if (type() != ui::ET_MOUSE_PRESSED) - return; - - DCHECK(click_count > 0); - DCHECK(click_count <= 3); - - int f = flags(); - switch (click_count) { - case 1: - f &= ~ui::EF_IS_DOUBLE_CLICK; - f &= ~ui::EF_IS_TRIPLE_CLICK; - break; - case 2: - f |= ui::EF_IS_DOUBLE_CLICK; - f &= ~ui::EF_IS_TRIPLE_CLICK; - break; - case 3: - f &= ~ui::EF_IS_DOUBLE_CLICK; - f |= ui::EF_IS_TRIPLE_CLICK; - break; - } - set_flags(f); -} - -TouchEvent::TouchEvent(const base::NativeEvent& native_event) - : LocatedEvent(native_event), - touch_id_(ui::GetTouchId(native_event)), - radius_x_(ui::GetTouchRadiusX(native_event)), - radius_y_(ui::GetTouchRadiusY(native_event)), - rotation_angle_(ui::GetTouchAngle(native_event)), - force_(ui::GetTouchForce(native_event)) { -} - -TouchEvent::TouchEvent(const TouchEvent& model, - Window* source, - Window* target) - : LocatedEvent(model, source, target), - touch_id_(model.touch_id_), - radius_x_(model.radius_x_), - radius_y_(model.radius_y_), - rotation_angle_(model.rotation_angle_), - force_(model.force_) { -} - -TouchEvent::TouchEvent(ui::EventType type, - const gfx::Point& location, - int touch_id, - base::TimeDelta time_stamp) - : LocatedEvent(type, location, location, 0), - touch_id_(touch_id), - radius_x_(0.0f), - radius_y_(0.0f), - rotation_angle_(0.0f), - force_(0.0f) { - set_time_stamp(time_stamp); -} - -TouchEvent::~TouchEvent() { -} - -void TouchEvent::UpdateForRootTransform(const ui::Transform& root_transform) { - LocatedEvent::UpdateForRootTransform(root_transform); - gfx::Point3f scale; - ui::InterpolatedTransform::FactorTRS(root_transform, NULL, NULL, &scale); - if (scale.x()) - radius_x_ /= scale.x(); - if (scale.y()) - radius_y_ /= scale.y(); -} - -ui::EventType TouchEvent::GetEventType() const { - return type(); -} - -gfx::Point TouchEvent::GetLocation() const { - return location(); -} - -int TouchEvent::GetTouchId() const { - return touch_id_; -} - -int TouchEvent::GetEventFlags() const { - return flags(); -} - -base::TimeDelta TouchEvent::GetTimestamp() const { - return time_stamp(); -} - -float TouchEvent::RadiusX() const { - return radius_x_; -} - -float TouchEvent::RadiusY() const { - return radius_y_; -} - -float TouchEvent::RotationAngle() const { - return rotation_angle_; -} - -float TouchEvent::Force() const { - return force_; -} - -KeyEvent::KeyEvent(const base::NativeEvent& native_event, bool is_char) - : Event(native_event, - ui::EventTypeFromNative(native_event), - ui::EventFlagsFromNative(native_event)), - key_code_(ui::KeyboardCodeFromNative(native_event)), - is_char_(is_char), - character_(0), - unmodified_character_(0) { -} - -KeyEvent::KeyEvent(ui::EventType type, - ui::KeyboardCode key_code, - int flags) - : Event(type, flags), - key_code_(key_code), - is_char_(false), - character_(ui::GetCharacterFromKeyCode(key_code, flags)), - unmodified_character_(0) { -} - -uint16 KeyEvent::GetCharacter() const { - if (character_) - return character_; - -#if defined(OS_WIN) - return (native_event().message == WM_CHAR) ? key_code_ : - ui::GetCharacterFromKeyCode(key_code_, flags()); -#elif defined(USE_X11) - if (!native_event()) - return ui::GetCharacterFromKeyCode(key_code_, flags()); - - DCHECK(native_event()->type == KeyPress || - native_event()->type == KeyRelease); - - uint16 ch = 0; - if (!IsControlDown()) - ch = ui::GetCharacterFromXEvent(native_event()); - return ch ? ch : ui::GetCharacterFromKeyCode(key_code_, flags()); -#else - NOTIMPLEMENTED(); - return 0; -#endif -} - -uint16 KeyEvent::GetUnmodifiedCharacter() const { - if (unmodified_character_) - return unmodified_character_; - -#if defined(OS_WIN) - // Looks like there is no way to get unmodified character on Windows. - return (native_event().message == WM_CHAR) ? key_code_ : - ui::GetCharacterFromKeyCode(key_code_, flags() & ui::EF_SHIFT_DOWN); -#elif defined(USE_X11) - if (!native_event()) - return ui::GetCharacterFromKeyCode(key_code_, flags() & ui::EF_SHIFT_DOWN); - - DCHECK(native_event()->type == KeyPress || - native_event()->type == KeyRelease); - - static const unsigned int kIgnoredModifiers = ControlMask | LockMask | - Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask; - - XKeyEvent copy = native_event()->xkey; // bit-wise copy is safe. - // We can't use things like (native_event()->xkey.state & ShiftMask), as it - // may mask out bits used by X11 internally. - copy.state &= ~kIgnoredModifiers; - uint16 ch = ui::GetCharacterFromXEvent(reinterpret_cast<XEvent*>(©)); - return ch ? ch : - ui::GetCharacterFromKeyCode(key_code_, flags() & ui::EF_SHIFT_DOWN); -#else - NOTIMPLEMENTED(); - return 0; -#endif -} - -KeyEvent* KeyEvent::Copy() { - KeyEvent* copy = new KeyEvent(::CopyNativeEvent(native_event()), is_char()); -#if defined(USE_X11) - copy->set_delete_native_event(true); -#endif - return copy; -} - -TranslatedKeyEvent::TranslatedKeyEvent(const base::NativeEvent& native_event, - bool is_char) - : KeyEvent(native_event, is_char) { - set_type(type() == ui::ET_KEY_PRESSED ? - ui::ET_TRANSLATED_KEY_PRESS : ui::ET_TRANSLATED_KEY_RELEASE); -} - -TranslatedKeyEvent::TranslatedKeyEvent(bool is_press, - ui::KeyboardCode key_code, - int flags) - : KeyEvent((is_press ? - ui::ET_TRANSLATED_KEY_PRESS : ui::ET_TRANSLATED_KEY_RELEASE), - key_code, - flags) { -} - -void TranslatedKeyEvent::ConvertToKeyEvent() { - set_type(type() == ui::ET_TRANSLATED_KEY_PRESS ? - ui::ET_KEY_PRESSED : ui::ET_KEY_RELEASED); -} - -ScrollEvent::ScrollEvent(const base::NativeEvent& native_event) - : MouseEvent(native_event) { - if (type() == ui::ET_SCROLL) { - ui::GetScrollOffsets(native_event, &x_offset_, &y_offset_); - double start, end; - ui::GetGestureTimes(native_event, &start, &end); - } else if (type() == ui::ET_SCROLL_FLING_START) { - bool is_cancel; - ui::GetFlingData(native_event, &x_offset_, &y_offset_, &is_cancel); - } -} - -GestureEvent::GestureEvent(ui::EventType type, - int x, - int y, - int flags, - base::Time time_stamp, - const ui::GestureEventDetails& details, - unsigned int touch_ids_bitfield) - : LocatedEvent(type, gfx::Point(x, y), gfx::Point(x, y), flags), - details_(details), - touch_ids_bitfield_(touch_ids_bitfield) { - set_time_stamp(base::TimeDelta::FromSeconds(time_stamp.ToDoubleT())); -} - -GestureEvent::GestureEvent(const GestureEvent& model, - Window* source, - Window* target) - : LocatedEvent(model, source, target), - details_(model.details_), - touch_ids_bitfield_(model.touch_ids_bitfield_) { -} - -GestureEvent::~GestureEvent() { -} - -int GestureEvent::GetLowestTouchId() const { - if (touch_ids_bitfield_ == 0) - return -1; - int i = -1; - // Find the index of the least significant 1 bit - while (!(1 << ++i & touch_ids_bitfield_)); - return i; -} - -} // namespace aura diff --git a/ui/aura/event.h b/ui/aura/event.h deleted file mode 100644 index ca3477c..0000000 --- a/ui/aura/event.h +++ /dev/null @@ -1,400 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_AURA_EVENT_H_ -#define UI_AURA_EVENT_H_ - -#include "base/basictypes.h" -#include "base/compiler_specific.h" -#include "base/event_types.h" -#include "base/logging.h" -#include "base/time.h" -#include "ui/aura/aura_export.h" -#include "ui/base/dragdrop/os_exchange_data.h" -#include "ui/base/events.h" -#include "ui/base/gestures/gesture_types.h" -#include "ui/base/keycodes/keyboard_codes.h" -#include "ui/gfx/point.h" - -namespace ui { -class Transform; -} - -namespace aura { - -class Window; - -class AURA_EXPORT Event { - public: - virtual ~Event(); - - // For testing. - class TestApi { - public: - explicit TestApi(Event* event) : event_(event) {} - - void set_time_stamp(const base::TimeDelta& time_stamp) { - event_->time_stamp_ = time_stamp; - } - - private: - TestApi(); - Event* event_; - }; - - const base::NativeEvent& native_event() const { return native_event_; } - ui::EventType type() const { return type_; } - // time_stamp represents time since machine was booted. - const base::TimeDelta& time_stamp() const { return time_stamp_; } - int flags() const { return flags_; } - - // This is only intended to be used externally by classes that are modifying - // events in EventFilter::PreHandleKeyEvent(). - void set_flags(int flags) { flags_ = flags; } - - // The following methods return true if the respective keys were pressed at - // the time the event was created. - bool IsShiftDown() const { return (flags_ & ui::EF_SHIFT_DOWN) != 0; } - bool IsControlDown() const { return (flags_ & ui::EF_CONTROL_DOWN) != 0; } - bool IsCapsLockDown() const { return (flags_ & ui::EF_CAPS_LOCK_DOWN) != 0; } - bool IsAltDown() const { return (flags_ & ui::EF_ALT_DOWN) != 0; } - - // Returns true if the event has a valid |native_event_|. - bool HasNativeEvent() const; - - protected: - Event(ui::EventType type, int flags); - Event(const base::NativeEvent& native_event, ui::EventType type, int flags); - Event(const Event& copy); - void set_type(ui::EventType type) { type_ = type; } - void set_delete_native_event(bool delete_native_event) { - delete_native_event_ = delete_native_event; - } - void set_time_stamp(base::TimeDelta time_stamp) { time_stamp_ = time_stamp; } - - private: - void operator=(const Event&); - - // Safely initializes the native event members of this class. - void Init(); - void InitWithNativeEvent(const base::NativeEvent& native_event); - - base::NativeEvent native_event_; - ui::EventType type_; - base::TimeDelta time_stamp_; - int flags_; - bool delete_native_event_; -}; - -class AURA_EXPORT LocatedEvent : public Event { - public: - // For testing. - class TestApi : public Event::TestApi { - public: - explicit TestApi(LocatedEvent* located_event) - : Event::TestApi(located_event), - located_event_(located_event) {} - - void set_location(const gfx::Point& location) { - located_event_->location_ = location; - } - - private: - TestApi(); - LocatedEvent* located_event_; - }; - - virtual ~LocatedEvent(); - - int x() const { return location_.x(); } - int y() const { return location_.y(); } - gfx::Point location() const { return location_; } - gfx::Point root_location() const { return root_location_; } - - // Applies |root_transform| to the event. - // This is applied to both |location_| and |root_location_|. - virtual void UpdateForRootTransform(const ui::Transform& root_transform); - - protected: - explicit LocatedEvent(const base::NativeEvent& native_event); - - // Create a new LocatedEvent which is identical to the provided model. - // If source / target windows are provided, the model location will be - // converted from |source| coordinate system to |target| coordinate system. - LocatedEvent(const LocatedEvent& model, Window* source, Window* target); - - // Used for synthetic events in testing. - LocatedEvent(ui::EventType type, - const gfx::Point& location, - const gfx::Point& root_location, - int flags); - - gfx::Point location_; - - gfx::Point root_location_; - - private: - DISALLOW_COPY_AND_ASSIGN(LocatedEvent); -}; - -class AURA_EXPORT MouseEvent : public LocatedEvent { - public: - explicit MouseEvent(const base::NativeEvent& native_event); - - // Create a new MouseEvent based on the provided model. - // Uses the provided |type| and |flags| for the new event. - // If source / target windows are provided, the model location will be - // converted from |source| coordinate system to |target| coordinate system. - MouseEvent(const MouseEvent& model, Window* source, Window* target); - MouseEvent(const MouseEvent& model, - Window* source, - Window* target, - ui::EventType type, - int flags); - - // Used for synthetic events in testing and by the gesture recognizer. - MouseEvent(ui::EventType type, - const gfx::Point& location, - const gfx::Point& root_location, - int flags); - - // Compares two mouse down events and returns true if the second one should - // be considered a repeat of the first. - static bool IsRepeatedClickEvent( - const MouseEvent& event1, - const MouseEvent& event2); - - // Get the click count. Can be 1, 2 or 3 for mousedown messages, 0 otherwise. - int GetClickCount() const; - - // Set the click count for a mousedown message. Can be 1, 2 or 3. - void SetClickCount(int click_count); - - private: - gfx::Point root_location_; - - static MouseEvent* last_click_event_; - // Returns the repeat count based on the previous mouse click, if it is - // recent enough and within a small enough distance. - static int GetRepeatCount(const MouseEvent& click_event); - - DISALLOW_COPY_AND_ASSIGN(MouseEvent); -}; - -class AURA_EXPORT TouchEvent : public LocatedEvent, - public ui::TouchEvent { - public: - explicit TouchEvent(const base::NativeEvent& native_event); - - // Create a new TouchEvent which is identical to the provided model. - // If source / target windows are provided, the model location will be - // converted from |source| coordinate system to |target| coordinate system. - TouchEvent(const TouchEvent& model, Window* source, Window* target); - - TouchEvent(ui::EventType type, - const gfx::Point& root_location, - int touch_id, - base::TimeDelta time_stamp); - - virtual ~TouchEvent(); - - int touch_id() const { return touch_id_; } - float radius_x() const { return radius_x_; } - float radius_y() const { return radius_y_; } - float rotation_angle() const { return rotation_angle_; } - float force() const { return force_; } - - // Used for unit tests. - void set_radius_x(const float r) { radius_x_ = r; } - void set_radius_y(const float r) { radius_y_ = r; } - - // Overridden from LocatedEvent. - virtual void UpdateForRootTransform( - const ui::Transform& root_transform) OVERRIDE; - - // Overridden from ui::TouchEvent. - virtual ui::EventType GetEventType() const OVERRIDE; - virtual gfx::Point GetLocation() const OVERRIDE; - virtual int GetTouchId() const OVERRIDE; - virtual int GetEventFlags() const OVERRIDE; - virtual base::TimeDelta GetTimestamp() const OVERRIDE; - virtual float RadiusX() const OVERRIDE; - virtual float RadiusY() const OVERRIDE; - virtual float RotationAngle() const OVERRIDE; - virtual float Force() const OVERRIDE; - - private: - // The identity (typically finger) of the touch starting at 0 and incrementing - // for each separable additional touch that the hardware can detect. - const int touch_id_; - - // Radius of the X (major) axis of the touch ellipse. 0.0 if unknown. - float radius_x_; - - // Radius of the Y (minor) axis of the touch ellipse. 0.0 if unknown. - float radius_y_; - - // Angle of the major axis away from the X axis. Default 0.0. - const float rotation_angle_; - - // Force (pressure) of the touch. Normalized to be [0, 1]. Default to be 0.0. - const float force_; - - DISALLOW_COPY_AND_ASSIGN(TouchEvent); -}; - -class AURA_EXPORT KeyEvent : public Event { - public: - KeyEvent(const base::NativeEvent& native_event, bool is_char); - - // Used for synthetic events in testing. - KeyEvent(ui::EventType type, - ui::KeyboardCode key_code, - int flags); - - // These setters allow an I18N virtual keyboard to fabricate a keyboard event - // which does not have a corresponding ui::KeyboardCode (example: U+00E1 Latin - // small letter A with acute, U+0410 Cyrillic capital letter A.) - // GetCharacter() and GetUnmodifiedCharacter() return the character. - void set_character(uint16 character) { character_ = character; } - void set_unmodified_character(uint16 unmodified_character) { - unmodified_character_ = unmodified_character; - } - - // Gets the character generated by this key event. It only supports Unicode - // BMP characters. - uint16 GetCharacter() const; - - // Gets the character generated by this key event ignoring concurrently-held - // modifiers (except shift). - uint16 GetUnmodifiedCharacter() const; - - // Returns the copy of this key event. Used in NativeWebKeyboardEvent. - KeyEvent* Copy(); - - ui::KeyboardCode key_code() const { return key_code_; } - bool is_char() const { return is_char_; } - - // This is only intended to be used externally by classes that are modifying - // events in EventFilter::PreHandleKeyEvent(). set_character() should also be - // called. - void set_key_code(ui::KeyboardCode key_code) { key_code_ = key_code; } - - private: - ui::KeyboardCode key_code_; - // True if this is a translated character event (vs. a raw key down). Both - // share the same type: ui::ET_KEY_PRESSED. - bool is_char_; - - uint16 character_; - uint16 unmodified_character_; -}; - -// A key event which is translated by an input method (IME). -// For example, if an IME receives a KeyEvent(ui::VKEY_SPACE), and it does not -// consume the key, the IME usually generates and dispatches a -// TranslatedKeyEvent(ui::VKEY_SPACE) event. If the IME receives a KeyEvent and -// it does consume the event, it might dispatch a -// TranslatedKeyEvent(ui::VKEY_PROCESSKEY) event as defined in the DOM spec. -class AURA_EXPORT TranslatedKeyEvent : public aura::KeyEvent { - public: - TranslatedKeyEvent(const base::NativeEvent& native_event, bool is_char); - - // Used for synthetic events such as a VKEY_PROCESSKEY key event. - TranslatedKeyEvent(bool is_press, - ui::KeyboardCode key_code, - int flags); - - // Changes the type() of the object from ET_TRANSLATED_KEY_* to ET_KEY_* so - // that RenderWidgetHostViewAura and NativeWidgetAura could handle the event. - void ConvertToKeyEvent(); -}; - -class AURA_EXPORT DropTargetEvent : public LocatedEvent { - public: - DropTargetEvent(const ui::OSExchangeData& data, - const gfx::Point& location, - const gfx::Point& root_location, - int source_operations) - : LocatedEvent(ui::ET_DROP_TARGET_EVENT, location, root_location, 0), - data_(data), - source_operations_(source_operations) { - } - - const ui::OSExchangeData& data() const { return data_; } - int source_operations() const { return source_operations_; } - - private: - // Data associated with the drag/drop session. - const ui::OSExchangeData& data_; - - // Bitmask of supported ui::DragDropTypes::DragOperation by the source. - int source_operations_; - - DISALLOW_COPY_AND_ASSIGN(DropTargetEvent); -}; - -class AURA_EXPORT ScrollEvent : public MouseEvent { - public: - explicit ScrollEvent(const base::NativeEvent& native_event); - ScrollEvent(const ScrollEvent& model, - Window* source, - Window* target, - ui::EventType type, - int flags) - : MouseEvent(model, source, target, type, flags), - x_offset_(model.x_offset_), - y_offset_(model.y_offset_) { - } - - float x_offset() const { return x_offset_; } - float y_offset() const { return y_offset_; } - - private: - float x_offset_; - float y_offset_; - - DISALLOW_COPY_AND_ASSIGN(ScrollEvent); -}; - -class AURA_EXPORT GestureEvent : public LocatedEvent, - public ui::GestureEvent { - public: - GestureEvent(ui::EventType type, - int x, - int y, - int flags, - base::Time time_stamp, - const ui::GestureEventDetails& details, - unsigned int touch_ids_bitfield); - - // Create a new GestureEvent which is identical to the provided model. - // If source / target windows are provided, the model location will be - // converted from |source| coordinate system to |target| coordinate system. - GestureEvent(const GestureEvent& model, Window* source, Window* target); - - virtual ~GestureEvent(); - - const ui::GestureEventDetails& details() const { return details_; } - - // Returns the lowest touch-id of any of the touches which make up this - // gesture. - // If there are no touches associated with this gesture, returns -1. - virtual int GetLowestTouchId() const OVERRIDE; - - private: - ui::GestureEventDetails details_; - - // The set of indices of ones in the binary representation of - // touch_ids_bitfield_ is the set of touch_ids associate with this gesture. - // This value is stored as a bitfield because the number of touch ids varies, - // but we currently don't need more than 32 touches at a time. - const unsigned int touch_ids_bitfield_; - - DISALLOW_COPY_AND_ASSIGN(GestureEvent); -}; - -} // namespace aura - -#endif // UI_AURA_EVENT_H_ diff --git a/ui/aura/event_filter.h b/ui/aura/event_filter.h index 6b98b9a..e103964 100644 --- a/ui/aura/event_filter.h +++ b/ui/aura/event_filter.h @@ -9,12 +9,15 @@ #include "ui/aura/aura_export.h" #include "ui/base/events.h" -namespace aura { - -class GestureEvent; +namespace ui { +class GestureEventImpl; class KeyEvent; class MouseEvent; -class TouchEvent; +class TouchEventImpl; +} + +namespace aura { + class Window; // An object that filters events sent to an owner window. The filter can stop @@ -44,18 +47,19 @@ class AURA_EXPORT EventFilter { // filter may still perform some action, the return value simply indicates // that further processing can occur. - virtual bool PreHandleKeyEvent(Window* target, KeyEvent* event) = 0; - virtual bool PreHandleMouseEvent(Window* target, MouseEvent* event) = 0; + virtual bool PreHandleKeyEvent(Window* target, ui::KeyEvent* event) = 0; + virtual bool PreHandleMouseEvent(Window* target, ui::MouseEvent* event) = 0; // Returns a value other than ui::TOUCH_STATUS_UNKNOWN if the event is // consumed. virtual ui::TouchStatus PreHandleTouchEvent(Window* target, - TouchEvent* event) = 0; + ui::TouchEventImpl* event) = 0; // Returns a value other than ui::GESTURE_STATUS_UNKNOWN if the gesture is // consumed. - virtual ui::GestureStatus PreHandleGestureEvent(Window* target, - GestureEvent* event) = 0; + virtual ui::GestureStatus PreHandleGestureEvent( + Window* target, + ui::GestureEventImpl* event) = 0; }; } // namespace aura diff --git a/ui/aura/event_filter_unittest.cc b/ui/aura/event_filter_unittest.cc index ee33013..cdc0308 100644 --- a/ui/aura/event_filter_unittest.cc +++ b/ui/aura/event_filter_unittest.cc @@ -6,13 +6,13 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" -#include "ui/aura/event.h" #include "ui/aura/focus_manager.h" #include "ui/aura/root_window.h" #include "ui/aura/test/aura_test_base.h" #include "ui/aura/test/event_generator.h" #include "ui/aura/test/test_event_filter.h" #include "ui/aura/test/test_window_delegate.h" +#include "ui/base/event.h" #if defined(OS_WIN) // Windows headers define macros for these function names which screw with us. @@ -45,19 +45,20 @@ class TestEventFilterWindowDelegate : public TestWindowDelegate { int touch_event_count() const { return touch_event_count_; } // Overridden from TestWindowDelegate: - virtual bool OnKeyEvent(KeyEvent* event) OVERRIDE { + virtual bool OnKeyEvent(ui::KeyEvent* event) OVERRIDE { ++key_event_count_; return true; } - virtual bool OnMouseEvent(MouseEvent* event) OVERRIDE { + virtual bool OnMouseEvent(ui::MouseEvent* event) OVERRIDE { ++mouse_event_count_; return true; } - virtual ui::TouchStatus OnTouchEvent(TouchEvent* event) OVERRIDE { + virtual ui::TouchStatus OnTouchEvent(ui::TouchEventImpl* event) OVERRIDE { ++touch_event_count_; return ui::TOUCH_STATUS_UNKNOWN; } - virtual ui::GestureStatus OnGestureEvent(GestureEvent* event) OVERRIDE { + virtual ui::GestureStatus OnGestureEvent( + ui::GestureEventImpl* event) OVERRIDE { return ui::GESTURE_STATUS_UNKNOWN; } @@ -106,7 +107,7 @@ TEST_F(EventFilterTest, Basic) { // and the w1111's delegate should receive the event. EventGenerator generator(root_window(), w1111.get()); generator.PressLeftButton(); - KeyEvent key_event(ui::ET_KEY_PRESSED, ui::VKEY_A, 0); + ui::KeyEvent key_event(ui::ET_KEY_PRESSED, ui::VKEY_A, 0); root_window()->AsRootWindowHostDelegate()->OnHostKeyEvent(&key_event); // TODO(sadrul): TouchEvent! diff --git a/ui/aura/event_mac.h b/ui/aura/event_mac.h deleted file mode 100644 index ab491ff..0000000 --- a/ui/aura/event_mac.h +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_AURA_EVENT_MAC_H_ -#define UI_AURA_EVENT_MAC_H_ - -#include "base/event_types.h" - -namespace aura { - -// Returns a deep copy of the native |event|. On Mac the returned value is -// autoreleased. -base::NativeEvent CopyNativeEvent(const base::NativeEvent& event); - -} // namespace aura - -#endif // UI_AURA_EVENT_MAC_H_ diff --git a/ui/aura/event_mac.mm b/ui/aura/event_mac.mm deleted file mode 100644 index d68a011..0000000 --- a/ui/aura/event_mac.mm +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import <AppKit/NSEvent.h> - -#include "ui/aura/event_mac.h" - -namespace aura { - -base::NativeEvent CopyNativeEvent(const base::NativeEvent& event) { - return [NSEvent eventWithCGEvent:[event CGEvent]]; -} - -} // namespace aura diff --git a/ui/aura/event_unittest.cc b/ui/aura/event_unittest.cc deleted file mode 100644 index 5579031..0000000 --- a/ui/aura/event_unittest.cc +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/aura/event.h" -#include "testing/gtest/include/gtest/gtest.h" - -#if defined(USE_X11) -#include <X11/Xlib.h> -#include "ui/base/x/x11_util.h" -#endif - -namespace aura { -namespace test { - -TEST(EventTest, NoNativeEvent) { - KeyEvent keyev(ui::ET_KEY_PRESSED, ui::VKEY_SPACE, 0); - EXPECT_FALSE(keyev.HasNativeEvent()); -} - -TEST(EventTest, NativeEvent) { -#if defined(OS_WIN) - MSG native_event = { NULL, WM_KEYUP, ui::VKEY_A, 0 }; - KeyEvent keyev(native_event, false); - EXPECT_TRUE(keyev.HasNativeEvent()); -#elif defined(USE_X11) - scoped_ptr<XEvent> native_event(new XEvent); - ui::InitXKeyEventForTesting(ui::ET_KEY_RELEASED, - ui::VKEY_A, - 0, - native_event.get()); - KeyEvent keyev(native_event.get(), false); - EXPECT_TRUE(keyev.HasNativeEvent()); -#endif -} - -TEST(EventTest, GetCharacter) { - // Check if Control+Enter returns 10. - KeyEvent keyev1(ui::ET_KEY_PRESSED, - ui::VKEY_RETURN, - ui::EF_CONTROL_DOWN); - EXPECT_EQ(10, keyev1.GetCharacter()); - EXPECT_EQ(13, keyev1.GetUnmodifiedCharacter()); - // Check if Enter returns 13. - KeyEvent keyev2(ui::ET_KEY_PRESSED, - ui::VKEY_RETURN, - 0); - EXPECT_EQ(13, keyev2.GetCharacter()); - EXPECT_EQ(13, keyev2.GetUnmodifiedCharacter()); - -#if defined(USE_X11) - // For X11, test the functions with native_event() as well. crbug.com/107837 - scoped_ptr<XEvent> native_event(new XEvent); - - ui::InitXKeyEventForTesting(ui::ET_KEY_PRESSED, - ui::VKEY_RETURN, - ui::EF_CONTROL_DOWN, - native_event.get()); - KeyEvent keyev3(native_event.get(), false); - EXPECT_EQ(10, keyev3.GetCharacter()); - EXPECT_EQ(13, keyev3.GetUnmodifiedCharacter()); - - ui::InitXKeyEventForTesting(ui::ET_KEY_PRESSED, - ui::VKEY_RETURN, - 0, - native_event.get()); - KeyEvent keyev4(native_event.get(), false); - EXPECT_EQ(13, keyev4.GetCharacter()); - EXPECT_EQ(13, keyev4.GetUnmodifiedCharacter()); -#endif -} - -TEST(EventTest, ClickCount) { - const gfx::Point origin(0, 0); - MouseEvent mouseev(ui::ET_MOUSE_PRESSED, origin, origin, 0); - for (int i = 1; i <=3 ; ++i) { - mouseev.SetClickCount(i); - EXPECT_EQ(i, mouseev.GetClickCount()); - } -} - -TEST(EventTest, Repeated) { - const gfx::Point origin(0, 0); - MouseEvent mouse_ev1(ui::ET_MOUSE_PRESSED, origin, origin, 0); - MouseEvent mouse_ev2(ui::ET_MOUSE_PRESSED, origin, origin, 0); - MouseEvent::TestApi test_ev1(&mouse_ev1); - MouseEvent::TestApi test_ev2(&mouse_ev2); - - base::TimeDelta start = base::TimeDelta::FromMilliseconds(0); - base::TimeDelta soon = start + base::TimeDelta::FromMilliseconds(1); - base::TimeDelta later = start + base::TimeDelta::FromMilliseconds(1000); - - // Close point. - test_ev1.set_location(gfx::Point(0, 0)); - test_ev2.set_location(gfx::Point(1, 0)); - test_ev1.set_time_stamp(start); - test_ev2.set_time_stamp(soon); - EXPECT_TRUE(MouseEvent::IsRepeatedClickEvent(mouse_ev1, mouse_ev2)); - - // Too far. - test_ev1.set_location(gfx::Point(0, 0)); - test_ev2.set_location(gfx::Point(10, 0)); - test_ev1.set_time_stamp(start); - test_ev2.set_time_stamp(soon); - EXPECT_FALSE(MouseEvent::IsRepeatedClickEvent(mouse_ev1, mouse_ev2)); - - // Too long a time between clicks. - test_ev1.set_location(gfx::Point(0, 0)); - test_ev2.set_location(gfx::Point(0, 0)); - test_ev1.set_time_stamp(start); - test_ev2.set_time_stamp(later); - EXPECT_FALSE(MouseEvent::IsRepeatedClickEvent(mouse_ev1, mouse_ev2)); -} - -} // namespace test -} // namespace aura diff --git a/ui/aura/focus_manager.cc b/ui/aura/focus_manager.cc index fc963ec..04fd09b 100644 --- a/ui/aura/focus_manager.cc +++ b/ui/aura/focus_manager.cc @@ -24,7 +24,7 @@ void FocusManager::RemoveObserver(FocusChangeObserver* observer) { } void FocusManager::SetFocusedWindow(Window* focused_window, - const Event* event) { + const ui::Event* event) { if (focused_window == focused_window_) return; if (focused_window && !focused_window->CanFocus()) diff --git a/ui/aura/focus_manager.h b/ui/aura/focus_manager.h index 36b8771..1e47eaf 100644 --- a/ui/aura/focus_manager.h +++ b/ui/aura/focus_manager.h @@ -9,9 +9,12 @@ #include "base/observer_list.h" #include "ui/aura/aura_export.h" +namespace ui { +class Event; +} + namespace aura { -class Event; class FocusChangeObserver; class Window; @@ -30,7 +33,7 @@ class AURA_EXPORT FocusManager { // notification, and after it is changed the new focused window is sent a // focused notification. Nothing happens if |window| and GetFocusedWindow() // match. - void SetFocusedWindow(Window* window, const Event* event); + void SetFocusedWindow(Window* window, const ui::Event* event); // Returns the currently focused window or NULL if there is none. Window* GetFocusedWindow(); diff --git a/ui/aura/gestures/gesture_recognizer_unittest.cc b/ui/aura/gestures/gesture_recognizer_unittest.cc index 2ade20e..00d1302 100644 --- a/ui/aura/gestures/gesture_recognizer_unittest.cc +++ b/ui/aura/gestures/gesture_recognizer_unittest.cc @@ -6,12 +6,12 @@ #include "base/string_number_conversions.h" #include "base/timer.h" #include "testing/gtest/include/gtest/gtest.h" -#include "ui/aura/event.h" #include "ui/aura/root_window.h" #include "ui/aura/test/aura_test_base.h" #include "ui/aura/test/event_generator.h" #include "ui/aura/test/test_window_delegate.h" #include "ui/aura/test/test_windows.h" +#include "ui/base/event.h" #include "ui/base/gestures/gesture_configuration.h" #include "ui/base/gestures/gesture_recognizer_impl.h" #include "ui/base/gestures/gesture_sequence.h" @@ -114,7 +114,8 @@ class GestureEventConsumeDelegate : public TestWindowDelegate { const gfx::Rect& bounding_box() const { return bounding_box_; } int tap_count() const { return tap_count_; } - virtual ui::GestureStatus OnGestureEvent(GestureEvent* gesture) OVERRIDE { + virtual ui::GestureStatus OnGestureEvent( + ui::GestureEventImpl* gesture) OVERRIDE { bounding_box_ = gesture->details().bounding_box(); switch (gesture->type()) { case ui::ET_GESTURE_TAP: @@ -213,7 +214,7 @@ class QueueTouchEventDelegate : public GestureEventConsumeDelegate { } virtual ~QueueTouchEventDelegate() {} - virtual ui::TouchStatus OnTouchEvent(TouchEvent* event) OVERRIDE { + virtual ui::TouchStatus OnTouchEvent(ui::TouchEventImpl* event) OVERRIDE { return event->type() == ui::ET_TOUCH_RELEASED ? ui::TOUCH_STATUS_QUEUED_END : ui::TOUCH_STATUS_QUEUED; } @@ -264,7 +265,7 @@ class GestureEventSynthDelegate : public TestWindowDelegate { bool mouse_release() const { return mouse_release_; } bool double_click() const { return double_click_; } - virtual bool OnMouseEvent(MouseEvent* event) OVERRIDE { + virtual bool OnMouseEvent(ui::MouseEvent* event) OVERRIDE { switch (event->type()) { case ui::ET_MOUSE_PRESSED: double_click_ = event->flags() & ui::EF_IS_DOUBLE_CLICK; @@ -375,8 +376,8 @@ void SendScrollEvents(RootWindow* root_window, x += dx; y += dy; time = time + base::TimeDelta::FromMilliseconds(time_step); - TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(x, y), - touch_id, time); + ui::TouchEventImpl move(ui::ET_TOUCH_MOVED, gfx::Point(x, y), + touch_id, time); root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&move); } } @@ -387,8 +388,8 @@ void SendScrollEvent(RootWindow* root_window, int touch_id, GestureEventConsumeDelegate* delegate) { delegate->Reset(); - TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(x, y), - touch_id, GetTime()); + ui::TouchEventImpl move(ui::ET_TOUCH_MOVED, gfx::Point(x, y), + touch_id, GetTime()); root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&move); } @@ -408,8 +409,8 @@ TEST_F(GestureRecognizerTest, GestureEventTap) { delegate.get(), -1234, bounds, NULL)); delegate->Reset(); - TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), - kTouchId, GetTime()); + ui::TouchEventImpl press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), + kTouchId, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); EXPECT_FALSE(delegate->tap()); EXPECT_TRUE(delegate->tap_down()); @@ -423,9 +424,9 @@ TEST_F(GestureRecognizerTest, GestureEventTap) { // Make sure there is enough delay before the touch is released so that it is // recognized as a tap. delegate->Reset(); - TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), - kTouchId, press.time_stamp() + - base::TimeDelta::FromMilliseconds(50)); + ui::TouchEventImpl release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), + kTouchId, press.time_stamp() + + base::TimeDelta::FromMilliseconds(50)); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_TRUE(delegate->tap()); @@ -455,8 +456,8 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { // Test with no ET_TOUCH_MOVED events. { delegate->Reset(); - TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), - kTouchId, GetTime()); + ui::TouchEventImpl press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), + kTouchId, GetTime()); press.set_radius_x(5); press.set_radius_y(12); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); @@ -472,9 +473,9 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { // Make sure there is enough delay before the touch is released so that it // is recognized as a tap. delegate->Reset(); - TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), - kTouchId, press.time_stamp() + - base::TimeDelta::FromMilliseconds(50)); + ui::TouchEventImpl release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), + kTouchId, press.time_stamp() + + base::TimeDelta::FromMilliseconds(50)); release.set_radius_x(5); release.set_radius_y(12); @@ -499,8 +500,8 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { // Test with no ET_TOUCH_MOVED events but different touch points and radii. { delegate->Reset(); - TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(365, 290), - kTouchId, GetTime()); + ui::TouchEventImpl press(ui::ET_TOUCH_PRESSED, gfx::Point(365, 290), + kTouchId, GetTime()); press.set_radius_x(8); press.set_radius_y(14); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); @@ -514,9 +515,9 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { EXPECT_FALSE(delegate->long_press()); delegate->Reset(); - TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(377, 291), - kTouchId, press.time_stamp() + - base::TimeDelta::FromMilliseconds(50)); + ui::TouchEventImpl release(ui::ET_TOUCH_RELEASED, gfx::Point(377, 291), + kTouchId, press.time_stamp() + + base::TimeDelta::FromMilliseconds(50)); release.set_radius_x(20); release.set_radius_y(13); @@ -541,8 +542,8 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { // Test with a single ET_TOUCH_MOVED event. { delegate->Reset(); - TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(46, 205), - kTouchId, GetTime()); + ui::TouchEventImpl press(ui::ET_TOUCH_PRESSED, gfx::Point(46, 205), + kTouchId, GetTime()); press.set_radius_x(6); press.set_radius_y(10); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); @@ -556,9 +557,9 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { EXPECT_FALSE(delegate->long_press()); delegate->Reset(); - TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(52, 200), - kTouchId, press.time_stamp() + - base::TimeDelta::FromMilliseconds(50)); + ui::TouchEventImpl move(ui::ET_TOUCH_MOVED, gfx::Point(52, 200), + kTouchId, press.time_stamp() + + base::TimeDelta::FromMilliseconds(50)); move.set_radius_x(8); move.set_radius_y(12); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move); @@ -572,9 +573,9 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { EXPECT_FALSE(delegate->long_press()); delegate->Reset(); - TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(50, 195), - kTouchId, press.time_stamp() + - base::TimeDelta::FromMilliseconds(50)); + ui::TouchEventImpl release(ui::ET_TOUCH_RELEASED, gfx::Point(50, 195), + kTouchId, press.time_stamp() + + base::TimeDelta::FromMilliseconds(50)); release.set_radius_x(4); release.set_radius_y(8); @@ -599,8 +600,8 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { // Test with a few ET_TOUCH_MOVED events. { delegate->Reset(); - TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(400, 150), - kTouchId, GetTime()); + ui::TouchEventImpl press(ui::ET_TOUCH_PRESSED, gfx::Point(400, 150), + kTouchId, GetTime()); press.set_radius_x(7); press.set_radius_y(10); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); @@ -614,9 +615,9 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { EXPECT_FALSE(delegate->long_press()); delegate->Reset(); - TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(397, 155), - kTouchId, press.time_stamp() + - base::TimeDelta::FromMilliseconds(50)); + ui::TouchEventImpl move(ui::ET_TOUCH_MOVED, gfx::Point(397, 155), + kTouchId, press.time_stamp() + + base::TimeDelta::FromMilliseconds(50)); move.set_radius_x(13); move.set_radius_y(12); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move); @@ -630,9 +631,9 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { EXPECT_FALSE(delegate->long_press()); delegate->Reset(); - TouchEvent move1(ui::ET_TOUCH_MOVED, gfx::Point(395, 148), - kTouchId, move.time_stamp() + - base::TimeDelta::FromMilliseconds(50)); + ui::TouchEventImpl move1(ui::ET_TOUCH_MOVED, gfx::Point(395, 148), + kTouchId, move.time_stamp() + + base::TimeDelta::FromMilliseconds(50)); move1.set_radius_x(16); move1.set_radius_y(16); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move1); @@ -646,9 +647,9 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { EXPECT_FALSE(delegate->long_press()); delegate->Reset(); - TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(400, 150), - kTouchId, move1.time_stamp() + - base::TimeDelta::FromMilliseconds(50)); + ui::TouchEventImpl move2(ui::ET_TOUCH_MOVED, gfx::Point(400, 150), + kTouchId, move1.time_stamp() + + base::TimeDelta::FromMilliseconds(50)); move2.set_radius_x(14); move2.set_radius_y(10); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2); @@ -662,9 +663,9 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { EXPECT_FALSE(delegate->long_press()); delegate->Reset(); - TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(401, 149), - kTouchId, press.time_stamp() + - base::TimeDelta::FromMilliseconds(50)); + ui::TouchEventImpl release(ui::ET_TOUCH_RELEASED, gfx::Point(401, 149), + kTouchId, press.time_stamp() + + base::TimeDelta::FromMilliseconds(50)); release.set_radius_x(8); release.set_radius_y(9); @@ -699,8 +700,8 @@ TEST_F(GestureRecognizerTest, GestureEventScroll) { delegate.get(), -1234, bounds, NULL)); delegate->Reset(); - TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), - kTouchId, GetTime()); + ui::TouchEventImpl press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), + kTouchId, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); EXPECT_FALSE(delegate->tap()); EXPECT_TRUE(delegate->tap_down()); @@ -758,9 +759,9 @@ TEST_F(GestureRecognizerTest, GestureEventScroll) { // Release the touch. This should end the scroll. delegate->Reset(); - TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), - kTouchId, press.time_stamp() + - base::TimeDelta::FromMilliseconds(50)); + ui::TouchEventImpl release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), + kTouchId, press.time_stamp() + + base::TimeDelta::FromMilliseconds(50)); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); @@ -789,8 +790,10 @@ TEST_F(GestureRecognizerTest, GestureEventScrollBoundingBox) { const int kPositionX = 101; const int kPositionY = 201; delegate->Reset(); - TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(kPositionX, kPositionY), - kTouchId, GetTime()); + ui::TouchEventImpl press(ui::ET_TOUCH_PRESSED, + gfx::Point(kPositionX, kPositionY), + kTouchId, + GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); EXPECT_EQ(gfx::Rect(kPositionX - radius, kPositionY - radius, @@ -811,10 +814,10 @@ TEST_F(GestureRecognizerTest, GestureEventScrollBoundingBox) { // Release the touch. This should end the scroll. delegate->Reset(); - TouchEvent release(ui::ET_TOUCH_RELEASED, - gfx::Point(kPositionX, kPositionY), - kTouchId, press.time_stamp() + - base::TimeDelta::FromMilliseconds(50)); + ui::TouchEventImpl release(ui::ET_TOUCH_RELEASED, + gfx::Point(kPositionX, kPositionY), + kTouchId, press.time_stamp() + + base::TimeDelta::FromMilliseconds(50)); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_EQ(gfx::Rect(kPositionX - radius, kPositionY - radius, @@ -835,8 +838,8 @@ TEST_F(GestureRecognizerTest, GestureEventHorizontalRailFling) { scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( delegate.get(), -1234, bounds, NULL)); - TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), - kTouchId, GetTime()); + ui::TouchEventImpl press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), + kTouchId, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); // Move the touch-point horizontally enough that it is considered a @@ -852,8 +855,8 @@ TEST_F(GestureRecognizerTest, GestureEventHorizontalRailFling) { delegate.get()); delegate->Reset(); - TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), - kTouchId, GetTime()); + ui::TouchEventImpl release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), + kTouchId, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_TRUE(delegate->scroll_end()); @@ -871,8 +874,8 @@ TEST_F(GestureRecognizerTest, GestureEventVerticalRailFling) { scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( delegate.get(), -1234, bounds, NULL)); - TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), - kTouchId, GetTime()); + ui::TouchEventImpl press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), + kTouchId, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); // Move the touch-point vertically enough that it is considered a @@ -888,8 +891,8 @@ TEST_F(GestureRecognizerTest, GestureEventVerticalRailFling) { delegate.get()); delegate->Reset(); - TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), - kTouchId, GetTime()); + ui::TouchEventImpl release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), + kTouchId, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_TRUE(delegate->scroll_end()); @@ -907,8 +910,8 @@ TEST_F(GestureRecognizerTest, GestureEventNonRailFling) { scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( delegate.get(), -1234, bounds, NULL)); - TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), - kTouchId, GetTime()); + ui::TouchEventImpl press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), + kTouchId, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); // Move the touch-point such that a non-rail scroll begins @@ -922,8 +925,8 @@ TEST_F(GestureRecognizerTest, GestureEventNonRailFling) { delegate.get()); delegate->Reset(); - TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), - kTouchId, GetTime()); + ui::TouchEventImpl release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), + kTouchId, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_TRUE(delegate->scroll_end()); @@ -952,8 +955,8 @@ TEST_F(GestureRecognizerTest, GestureEventLongPress) { root_window()->SetGestureRecognizerForTesting(gesture_recognizer); - TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), - kTouchId, GetTime()); + ui::TouchEventImpl press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), + kTouchId, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); EXPECT_TRUE(delegate->tap_down()); EXPECT_TRUE(delegate->begin()); @@ -967,8 +970,8 @@ TEST_F(GestureRecognizerTest, GestureEventLongPress) { EXPECT_EQ(0, delegate->touch_id()); delegate->Reset(); - TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), - kTouchId, GetTime()); + ui::TouchEventImpl release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), + kTouchId, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); EXPECT_FALSE(delegate->long_press()); } @@ -994,8 +997,8 @@ TEST_F(GestureRecognizerTest, GestureEventLongPressCancelledByScroll) { root_window()->SetGestureRecognizerForTesting(gesture_recognizer); - TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), - kTouchId, GetTime()); + ui::TouchEventImpl press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), + kTouchId, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); EXPECT_TRUE(delegate->tap_down()); @@ -1009,8 +1012,8 @@ TEST_F(GestureRecognizerTest, GestureEventLongPressCancelledByScroll) { EXPECT_FALSE(delegate->long_press()); delegate->Reset(); - TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), - kTouchId, GetTime()); + ui::TouchEventImpl release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), + kTouchId, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); EXPECT_FALSE(delegate->long_press()); } @@ -1036,8 +1039,8 @@ TEST_F(GestureRecognizerTest, GestureEventLongPressCancelledBySecondTap) { root_window()->SetGestureRecognizerForTesting(gesture_recognizer); delegate->Reset(); - TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), - kTouchId1, GetTime()); + ui::TouchEventImpl press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), + kTouchId1, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); EXPECT_TRUE(delegate->tap_down()); EXPECT_TRUE(delegate->begin()); @@ -1047,8 +1050,8 @@ TEST_F(GestureRecognizerTest, GestureEventLongPressCancelledBySecondTap) { // Second tap, to cancel the long press delegate->Reset(); - TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), - kTouchId2, GetTime()); + ui::TouchEventImpl press2(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), + kTouchId2, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); EXPECT_FALSE(delegate->tap_down()); // no touch down for second tap. EXPECT_TRUE(delegate->begin()); @@ -1060,8 +1063,8 @@ TEST_F(GestureRecognizerTest, GestureEventLongPressCancelledBySecondTap) { EXPECT_FALSE(delegate->long_press()); delegate->Reset(); - TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), - kTouchId1, GetTime()); + ui::TouchEventImpl release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), + kTouchId1, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); EXPECT_FALSE(delegate->long_press()); EXPECT_TRUE(delegate->two_finger_tap()); @@ -1077,8 +1080,8 @@ TEST_F(GestureRecognizerTest, GestureEventHorizontalRailScroll) { scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( delegate.get(), -1234, bounds, NULL)); - TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), - kTouchId, GetTime()); + ui::TouchEventImpl press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), + kTouchId, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); // Move the touch-point horizontally enough that it is considered a @@ -1119,8 +1122,8 @@ TEST_F(GestureRecognizerTest, GestureEventVerticalRailScroll) { scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( delegate.get(), -1234, bounds, NULL)); - TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), - kTouchId, GetTime()); + ui::TouchEventImpl press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), + kTouchId, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); // Move the touch-point vertically enough that it is considered a @@ -1163,8 +1166,8 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) { delegate.get(), -1234, bounds, NULL)); delegate->Reset(); - TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), - kTouchId, GetTime()); + ui::TouchEventImpl press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), + kTouchId, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); EXPECT_FALSE(delegate->tap()); EXPECT_TRUE(delegate->tap_down()); @@ -1176,9 +1179,9 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) { // Make sure there is enough delay before the touch is released so that it is // recognized as a tap. delegate->Reset(); - TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), - kTouchId, press.time_stamp() + - base::TimeDelta::FromMilliseconds(50)); + ui::TouchEventImpl release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), + kTouchId, press.time_stamp() + + base::TimeDelta::FromMilliseconds(50)); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_TRUE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); @@ -1190,8 +1193,8 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) { // Now, do a scroll gesture. Delay it sufficiently so that it doesn't trigger // a double-tap. delegate->Reset(); - TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), - kTouchId, release.time_stamp() + + ui::TouchEventImpl press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), + kTouchId, release.time_stamp() + base::TimeDelta::FromMilliseconds(1000)); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); EXPECT_FALSE(delegate->tap()); @@ -1206,8 +1209,8 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) { // The first movement is diagonal, to ensure that we have a free scroll, // and not a rail scroll. delegate->Reset(); - TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(130, 230), - kTouchId, GetTime()); + ui::TouchEventImpl move(ui::ET_TOUCH_MOVED, gfx::Point(130, 230), + kTouchId, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); @@ -1220,8 +1223,8 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) { // Move some more to generate a few more scroll updates. delegate->Reset(); - TouchEvent move1(ui::ET_TOUCH_MOVED, gfx::Point(110, 211), - kTouchId, GetTime()); + ui::TouchEventImpl move1(ui::ET_TOUCH_MOVED, gfx::Point(110, 211), + kTouchId, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move1); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); @@ -1233,8 +1236,8 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) { EXPECT_EQ(-19, delegate->scroll_y()); delegate->Reset(); - TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(140, 215), - kTouchId, GetTime()); + ui::TouchEventImpl move2(ui::ET_TOUCH_MOVED, gfx::Point(140, 215), + kTouchId, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); @@ -1247,8 +1250,8 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) { // Release the touch. This should end the scroll. delegate->Reset(); - TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), - kTouchId, GetTime()); + ui::TouchEventImpl release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), + kTouchId, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); @@ -1273,8 +1276,8 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) { // Touch down on the window. This should not generate any gesture event. queued_delegate->Reset(); - TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), - kTouchId1, GetTime()); + ui::TouchEventImpl press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), + kTouchId1, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); EXPECT_FALSE(queued_delegate->tap()); EXPECT_FALSE(queued_delegate->tap_down()); @@ -1287,9 +1290,9 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) { // Introduce some delay before the touch is released so that it is recognized // as a tap. However, this still should not create any gesture events. queued_delegate->Reset(); - TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), - kTouchId1, press.time_stamp() + - base::TimeDelta::FromMilliseconds(50)); + ui::TouchEventImpl release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), + kTouchId1, press.time_stamp() + + base::TimeDelta::FromMilliseconds(50)); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_FALSE(queued_delegate->tap()); EXPECT_FALSE(queued_delegate->tap_down()); @@ -1307,8 +1310,8 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) { scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( delegate.get(), -2345, gfx::Rect(0, 0, 50, 50), NULL)); delegate->Reset(); - TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(10, 20), - kTouchId2, GetTime()); + ui::TouchEventImpl press2(ui::ET_TOUCH_PRESSED, gfx::Point(10, 20), + kTouchId2, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); EXPECT_FALSE(delegate->tap()); EXPECT_TRUE(delegate->tap_down()); @@ -1319,8 +1322,8 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) { EXPECT_FALSE(delegate->scroll_update()); EXPECT_FALSE(delegate->scroll_end()); - TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(10, 20), - kTouchId2, GetTime()); + ui::TouchEventImpl release2(ui::ET_TOUCH_RELEASED, gfx::Point(10, 20), + kTouchId2, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2); // Process the first queued event. @@ -1350,8 +1353,8 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) { // Start all over. Press on the first window, then press again on the second // window. The second press should still go to the first window. queued_delegate->Reset(); - TouchEvent press3(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), - kTouchId1, GetTime()); + ui::TouchEventImpl press3(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), + kTouchId1, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press3); EXPECT_FALSE(queued_delegate->tap()); EXPECT_FALSE(queued_delegate->tap_down()); @@ -1366,8 +1369,8 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) { queued_delegate->Reset(); delegate->Reset(); - TouchEvent press4(ui::ET_TOUCH_PRESSED, gfx::Point(103, 203), - kTouchId2, GetTime()); + ui::TouchEventImpl press4(ui::ET_TOUCH_PRESSED, gfx::Point(103, 203), + kTouchId2, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press4); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); @@ -1391,8 +1394,8 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) { queued_delegate->Reset(); delegate->Reset(); int x_move = ui::GestureConfiguration::max_touch_move_in_pixels_for_click(); - TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(103 + x_move, 203), - kTouchId2, GetTime()); + ui::TouchEventImpl move(ui::ET_TOUCH_MOVED, gfx::Point(103 + x_move, 203), + kTouchId2, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); @@ -1464,8 +1467,8 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromScroll) { aura::RootWindow* root = root_window(); delegate->Reset(); - TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), - kTouchId1, GetTime()); + ui::TouchEventImpl press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), + kTouchId1, GetTime()); root->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); EXPECT_FALSE(delegate->tap()); EXPECT_TRUE(delegate->tap_down()); @@ -1477,8 +1480,8 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromScroll) { // Move the touch-point enough so that it is considered as a scroll. This // should generate both SCROLL_BEGIN and SCROLL_UPDATE gestures. delegate->Reset(); - TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(130, 301), - kTouchId1, GetTime()); + ui::TouchEventImpl move(ui::ET_TOUCH_MOVED, gfx::Point(130, 301), + kTouchId1, GetTime()); root->AsRootWindowHostDelegate()->OnHostTouchEvent(&move); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); @@ -1490,8 +1493,8 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromScroll) { // Press the second finger. It should cause pinch-begin. Note that we will not // transition to two finger tap here because the touch points are far enough. delegate->Reset(); - TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), - kTouchId2, GetTime()); + ui::TouchEventImpl press2(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), + kTouchId2, GetTime()); root->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); // no touch down for second tap. @@ -1505,8 +1508,8 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromScroll) { // Move the first finger. delegate->Reset(); - TouchEvent move3(ui::ET_TOUCH_MOVED, gfx::Point(95, 201), - kTouchId1, GetTime()); + ui::TouchEventImpl move3(ui::ET_TOUCH_MOVED, gfx::Point(95, 201), + kTouchId1, GetTime()); root->AsRootWindowHostDelegate()->OnHostTouchEvent(&move3); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); @@ -1521,8 +1524,8 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromScroll) { // Now move the second finger. delegate->Reset(); - TouchEvent move4(ui::ET_TOUCH_MOVED, gfx::Point(55, 15), - kTouchId2, GetTime()); + ui::TouchEventImpl move4(ui::ET_TOUCH_MOVED, gfx::Point(55, 15), + kTouchId2, GetTime()); root->AsRootWindowHostDelegate()->OnHostTouchEvent(&move4); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); @@ -1537,9 +1540,9 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromScroll) { // Release the first finger. This should end pinch. delegate->Reset(); - TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), - kTouchId1, press.time_stamp() + - base::TimeDelta::FromMilliseconds(50)); + ui::TouchEventImpl release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), + kTouchId1, press.time_stamp() + + base::TimeDelta::FromMilliseconds(50)); root->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); @@ -1553,8 +1556,8 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromScroll) { // Move the second finger. This should still generate a scroll. delegate->Reset(); - TouchEvent move5(ui::ET_TOUCH_MOVED, gfx::Point(25, 10), - kTouchId2, GetTime()); + ui::TouchEventImpl move5(ui::ET_TOUCH_MOVED, gfx::Point(25, 10), + kTouchId2, GetTime()); root->AsRootWindowHostDelegate()->OnHostTouchEvent(&move5); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); @@ -1578,12 +1581,12 @@ scoped_ptr<GestureEventConsumeDelegate> delegate( scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( delegate.get(), -1234, bounds, NULL)); - TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 301), - kTouchId1, GetTime()); + ui::TouchEventImpl press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 301), + kTouchId1, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); delegate->Reset(); - TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), - kTouchId2, GetTime()); + ui::TouchEventImpl press2(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), + kTouchId2, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); // Since the touch points are far enough we will go to pinch rather than two // finger tap. @@ -1594,8 +1597,8 @@ scoped_ptr<GestureEventConsumeDelegate> delegate( // Pinch has started, now release the second finger delegate->Reset(); - TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), - kTouchId1, GetTime()); + ui::TouchEventImpl release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), + kTouchId1, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_TRUE(delegate->pinch_end()); @@ -1604,13 +1607,13 @@ scoped_ptr<GestureEventConsumeDelegate> delegate( // Pinch again delegate->Reset(); - TouchEvent press3(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), - kTouchId1, GetTime()); + ui::TouchEventImpl press3(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), + kTouchId1, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press3); // Now the touch points are close. So we will go into two finger tap. // Move the touch-point enough to break two-finger-tap and enter pinch. - TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(101, 202), - kTouchId1, GetTime()); + ui::TouchEventImpl move2(ui::ET_TOUCH_MOVED, gfx::Point(101, 202), + kTouchId1, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2); EXPECT_TRUE(delegate->pinch_begin()); @@ -1632,8 +1635,8 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromTap) { aura::RootWindow* root = root_window(); delegate->Reset(); - TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 301), - kTouchId1, GetTime()); + ui::TouchEventImpl press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 301), + kTouchId1, GetTime()); root->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); EXPECT_FALSE(delegate->tap()); EXPECT_TRUE(delegate->tap_down()); @@ -1646,8 +1649,8 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromTap) { // Press the second finger far enough to break two finger tap. It should // instead cause a scroll-begin and pinch-begin. delegate->Reset(); - TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), - kTouchId2, GetTime()); + ui::TouchEventImpl press2(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), + kTouchId2, GetTime()); root->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); // no touch down for second tap. @@ -1661,8 +1664,8 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromTap) { // Move the first finger. delegate->Reset(); - TouchEvent move3(ui::ET_TOUCH_MOVED, gfx::Point(65, 201), - kTouchId1, GetTime()); + ui::TouchEventImpl move3(ui::ET_TOUCH_MOVED, gfx::Point(65, 201), + kTouchId1, GetTime()); root->AsRootWindowHostDelegate()->OnHostTouchEvent(&move3); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); @@ -1677,8 +1680,8 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromTap) { // Now move the second finger. delegate->Reset(); - TouchEvent move4(ui::ET_TOUCH_MOVED, gfx::Point(55, 15), - kTouchId2, GetTime()); + ui::TouchEventImpl move4(ui::ET_TOUCH_MOVED, gfx::Point(55, 15), + kTouchId2, GetTime()); root->AsRootWindowHostDelegate()->OnHostTouchEvent(&move4); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); @@ -1693,9 +1696,9 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromTap) { // Release the first finger. This should end pinch. delegate->Reset(); - TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), - kTouchId1, press.time_stamp() + - base::TimeDelta::FromMilliseconds(50)); + ui::TouchEventImpl release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), + kTouchId1, press.time_stamp() + + base::TimeDelta::FromMilliseconds(50)); root->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); @@ -1709,8 +1712,8 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromTap) { // Move the second finger. This should still generate a scroll. delegate->Reset(); - TouchEvent move5(ui::ET_TOUCH_MOVED, gfx::Point(25, 10), - kTouchId2, GetTime()); + ui::TouchEventImpl move5(ui::ET_TOUCH_MOVED, gfx::Point(25, 10), + kTouchId2, GetTime()); root->AsRootWindowHostDelegate()->OnHostTouchEvent(&move5); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); @@ -1727,8 +1730,8 @@ TEST_F(GestureRecognizerTest, GestureEventIgnoresDisconnectedEvents) { scoped_ptr<GestureEventConsumeDelegate> delegate( new GestureEventConsumeDelegate()); - TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), - 6, GetTime()); + ui::TouchEventImpl release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), + 6, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); @@ -1765,8 +1768,8 @@ TEST_F(GestureRecognizerTest, GestureEventTouchLockSelectsCorrectWindow) { windows[i] = CreateTestWindowWithDelegate( delegates[i], i, *window_bounds[i], NULL); windows[i]->set_id(i); - TouchEvent press(ui::ET_TOUCH_PRESSED, window_bounds[i]->origin(), - i, GetTime()); + ui::TouchEventImpl press(ui::ET_TOUCH_PRESSED, window_bounds[i]->origin(), + i, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); } @@ -1782,11 +1785,11 @@ TEST_F(GestureRecognizerTest, GestureEventTouchLockSelectsCorrectWindow) { EXPECT_EQ("3", WindowIDAsString(target)); // Add a touch in the middle associated with windows[2] - TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 500), - kNumWindows, GetTime()); + ui::TouchEventImpl press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 500), + kNumWindows, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); - TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(250, 250), - kNumWindows, GetTime()); + ui::TouchEventImpl move(ui::ET_TOUCH_MOVED, gfx::Point(250, 250), + kNumWindows, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move); target = gesture_recognizer->GetTargetForLocation(gfx::Point(250, 250)); @@ -1806,8 +1809,8 @@ TEST_F(GestureRecognizerTest, GestureEventTouchLockSelectsCorrectWindow) { EXPECT_TRUE(target == NULL); // Move a touch associated with windows[2] to 1000, 1000 - TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(1000, 1000), - kNumWindows, GetTime()); + ui::TouchEventImpl move2(ui::ET_TOUCH_MOVED, gfx::Point(1000, 1000), + kNumWindows, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2); target = gesture_recognizer->GetTargetForLocation(gfx::Point(1000, 1000)); @@ -1831,11 +1834,11 @@ TEST_F(GestureRecognizerTest, GestureEventOutsideRootWindowTap) { gesture_recognizer->GetGestureSequenceForTesting(root_window()); gfx::Point pos1(-10, -10); - TouchEvent press1(ui::ET_TOUCH_PRESSED, pos1, 0, GetTime()); + ui::TouchEventImpl press1(ui::ET_TOUCH_PRESSED, pos1, 0, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); gfx::Point pos2(1000, 1000); - TouchEvent press2(ui::ET_TOUCH_PRESSED, pos2, 1, GetTime()); + ui::TouchEventImpl press2(ui::ET_TOUCH_PRESSED, pos2, 1, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); // As these presses were outside the root window, they should be @@ -1854,12 +1857,12 @@ TEST_F(GestureRecognizerTest, NoTapWithPreventDefaultedRelease) { delegate->set_window(window.get()); delegate->Reset(); - TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), - kTouchId, GetTime()); + ui::TouchEventImpl press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), + kTouchId, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); - TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), - kTouchId, press.time_stamp() + - base::TimeDelta::FromMilliseconds(50)); + ui::TouchEventImpl release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), + kTouchId, press.time_stamp() + + base::TimeDelta::FromMilliseconds(50)); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); delegate->Reset(); @@ -1907,8 +1910,8 @@ TEST_F(GestureRecognizerTest, TwoFingerTap) { delegate.get(), -1234, bounds, NULL)); delegate->Reset(); - TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), - kTouchId1, GetTime()); + ui::TouchEventImpl press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), + kTouchId1, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); EXPECT_FALSE(delegate->tap()); EXPECT_TRUE(delegate->tap_down()); @@ -1920,8 +1923,8 @@ TEST_F(GestureRecognizerTest, TwoFingerTap) { EXPECT_FALSE(delegate->two_finger_tap()); delegate->Reset(); - TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201), - kTouchId2, GetTime()); + ui::TouchEventImpl press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201), + kTouchId2, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); // no touch down for second tap. @@ -1934,11 +1937,11 @@ TEST_F(GestureRecognizerTest, TwoFingerTap) { // Little bit of touch move should not affect our state. delegate->Reset(); - TouchEvent move1(ui::ET_TOUCH_MOVED, gfx::Point(102, 202), - kTouchId1, GetTime()); + ui::TouchEventImpl move1(ui::ET_TOUCH_MOVED, gfx::Point(102, 202), + kTouchId1, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move1); - TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(131, 202), - kTouchId2, GetTime()); + ui::TouchEventImpl move2(ui::ET_TOUCH_MOVED, gfx::Point(131, 202), + kTouchId2, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); @@ -1952,9 +1955,9 @@ TEST_F(GestureRecognizerTest, TwoFingerTap) { // Make sure there is enough delay before the touch is released so that it is // recognized as a tap. delegate->Reset(); - TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), - kTouchId1, press1.time_stamp() + - base::TimeDelta::FromMilliseconds(50)); + ui::TouchEventImpl release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), + kTouchId1, press1.time_stamp() + + base::TimeDelta::FromMilliseconds(50)); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); EXPECT_FALSE(delegate->tap()); @@ -1969,9 +1972,9 @@ TEST_F(GestureRecognizerTest, TwoFingerTap) { // Make sure there is enough delay before the touch is released so that it is // recognized as a tap. delegate->Reset(); - TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(130, 201), - kTouchId2, press2.time_stamp() + - base::TimeDelta::FromMilliseconds(50)); + ui::TouchEventImpl release2(ui::ET_TOUCH_RELEASED, gfx::Point(130, 201), + kTouchId2, press2.time_stamp() + + base::TimeDelta::FromMilliseconds(50)); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2); EXPECT_FALSE(delegate->tap()); @@ -1995,20 +1998,20 @@ TEST_F(GestureRecognizerTest, TwoFingerTapExpired) { delegate.get(), -1234, bounds, NULL)); delegate->Reset(); - TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), - kTouchId1, GetTime()); + ui::TouchEventImpl press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), + kTouchId1, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); delegate->Reset(); - TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201), - kTouchId2, GetTime()); + ui::TouchEventImpl press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201), + kTouchId2, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); // Send release event after sufficient delay so that two finger time expires. delegate->Reset(); - TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), - kTouchId1, press1.time_stamp() + - base::TimeDelta::FromMilliseconds(1000)); + ui::TouchEventImpl release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), + kTouchId1, press1.time_stamp() + + base::TimeDelta::FromMilliseconds(1000)); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); EXPECT_FALSE(delegate->two_finger_tap()); @@ -2017,9 +2020,9 @@ TEST_F(GestureRecognizerTest, TwoFingerTapExpired) { // Make sure there is enough delay before the touch is released so that it is // recognized as a tap. delegate->Reset(); - TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(130, 201), - kTouchId2, press2.time_stamp() + - base::TimeDelta::FromMilliseconds(50)); + ui::TouchEventImpl release2(ui::ET_TOUCH_RELEASED, gfx::Point(130, 201), + kTouchId2, press2.time_stamp() + + base::TimeDelta::FromMilliseconds(50)); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2); EXPECT_FALSE(delegate->two_finger_tap()); @@ -2040,13 +2043,13 @@ TEST_F(GestureRecognizerTest, TwoFingerTapChangesToPinch) { delegate.get(), -1234, bounds, NULL)); delegate->Reset(); - TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), - kTouchId1, GetTime()); + ui::TouchEventImpl press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), + kTouchId1, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); delegate->Reset(); - TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201), - kTouchId2, GetTime()); + ui::TouchEventImpl press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201), + kTouchId2, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); SendScrollEvent(root_window(), 130, 230, kTouchId1, delegate.get()); @@ -2056,9 +2059,9 @@ TEST_F(GestureRecognizerTest, TwoFingerTapChangesToPinch) { // Make sure there is enough delay before the touch is released so that it // is recognized as a tap. delegate->Reset(); - TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), - kTouchId2, press1.time_stamp() + - base::TimeDelta::FromMilliseconds(50)); + ui::TouchEventImpl release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), + kTouchId2, press1.time_stamp() + + base::TimeDelta::FromMilliseconds(50)); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_FALSE(delegate->two_finger_tap()); @@ -2072,13 +2075,13 @@ TEST_F(GestureRecognizerTest, TwoFingerTapChangesToPinch) { delegate.get(), -1234, bounds, NULL)); delegate->Reset(); - TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), - kTouchId1, GetTime()); + ui::TouchEventImpl press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), + kTouchId1, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); delegate->Reset(); - TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201), - kTouchId2, GetTime()); + ui::TouchEventImpl press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201), + kTouchId2, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); SendScrollEvent(root_window(), 101, 230, kTouchId2, delegate.get()); @@ -2088,9 +2091,9 @@ TEST_F(GestureRecognizerTest, TwoFingerTapChangesToPinch) { // Make sure there is enough delay before the touch is released so that it // is recognized as a tap. delegate->Reset(); - TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), - kTouchId1, press1.time_stamp() + - base::TimeDelta::FromMilliseconds(50)); + ui::TouchEventImpl release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), + kTouchId1, press1.time_stamp() + + base::TimeDelta::FromMilliseconds(50)); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_FALSE(delegate->two_finger_tap()); @@ -2113,27 +2116,27 @@ TEST_F(GestureRecognizerTest, TwoFingerTapCancelled) { delegate.get(), -1234, bounds, NULL)); delegate->Reset(); - TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), - kTouchId1, GetTime()); + ui::TouchEventImpl press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), + kTouchId1, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); delegate->Reset(); - TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201), - kTouchId2, GetTime()); + ui::TouchEventImpl press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201), + kTouchId2, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); delegate->Reset(); - TouchEvent cancel(ui::ET_TOUCH_CANCELLED, gfx::Point(130, 201), - kTouchId1, GetTime()); + ui::TouchEventImpl cancel(ui::ET_TOUCH_CANCELLED, gfx::Point(130, 201), + kTouchId1, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&cancel); EXPECT_FALSE(delegate->two_finger_tap()); // Make sure there is enough delay before the touch is released so that it // is recognized as a tap. delegate->Reset(); - TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), - kTouchId2, press1.time_stamp() + - base::TimeDelta::FromMilliseconds(50)); + ui::TouchEventImpl release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), + kTouchId2, press1.time_stamp() + + base::TimeDelta::FromMilliseconds(50)); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_FALSE(delegate->two_finger_tap()); @@ -2146,27 +2149,27 @@ TEST_F(GestureRecognizerTest, TwoFingerTapCancelled) { delegate.get(), -1234, bounds, NULL)); delegate->Reset(); - TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), - kTouchId1, GetTime()); + ui::TouchEventImpl press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), + kTouchId1, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); delegate->Reset(); - TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201), - kTouchId2, GetTime()); + ui::TouchEventImpl press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201), + kTouchId2, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); delegate->Reset(); - TouchEvent cancel(ui::ET_TOUCH_CANCELLED, gfx::Point(130, 201), - kTouchId2, GetTime()); + ui::TouchEventImpl cancel(ui::ET_TOUCH_CANCELLED, gfx::Point(130, 201), + kTouchId2, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&cancel); EXPECT_FALSE(delegate->two_finger_tap()); // Make sure there is enough delay before the touch is released so that it // is recognized as a tap. delegate->Reset(); - TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), - kTouchId1, press1.time_stamp() + - base::TimeDelta::FromMilliseconds(50)); + ui::TouchEventImpl release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), + kTouchId1, press1.time_stamp() + + base::TimeDelta::FromMilliseconds(50)); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_FALSE(delegate->two_finger_tap()); @@ -2185,8 +2188,8 @@ TEST_F(GestureRecognizerTest, VeryWideTwoFingerTouchDownShouldBeAPinch) { delegate.get(), -1234, bounds, NULL)); delegate->Reset(); - TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), - kTouchId1, GetTime()); + ui::TouchEventImpl press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), + kTouchId1, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); EXPECT_FALSE(delegate->tap()); EXPECT_TRUE(delegate->tap_down()); @@ -2198,8 +2201,8 @@ TEST_F(GestureRecognizerTest, VeryWideTwoFingerTouchDownShouldBeAPinch) { EXPECT_FALSE(delegate->two_finger_tap()); delegate->Reset(); - TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(430, 201), - kTouchId2, GetTime()); + ui::TouchEventImpl press2(ui::ET_TOUCH_PRESSED, gfx::Point(430, 201), + kTouchId2, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); // no touch down for second tap. @@ -2222,11 +2225,11 @@ TEST_F(GestureRecognizerTest, FlushAllOnHide) { CreateTestWindowWithDelegate(delegate.get(), 0, bounds, NULL)); const int kTouchId1 = 8; const int kTouchId2 = 2; - TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), - kTouchId1, GetTime()); + ui::TouchEventImpl press1(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), + kTouchId1, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); - TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(20, 20), - kTouchId2, GetTime()); + ui::TouchEventImpl press2(ui::ET_TOUCH_PRESSED, gfx::Point(20, 20), + kTouchId2, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); window->Hide(); EXPECT_EQ(NULL, @@ -2253,8 +2256,8 @@ TEST_F(GestureRecognizerTest, LongPressTimerStopsOnPreventDefaultedTouchMoves) { root_window()->SetGestureRecognizerForTesting(gesture_recognizer); delegate->Reset(); - TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), - kTouchId, GetTime()); + ui::TouchEventImpl press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), + kTouchId, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); // Scroll around, to cancel the long press SendScrollEvent(root_window(), 130, 230, kTouchId, delegate.get()); @@ -2280,7 +2283,7 @@ class ConsumesTouchMovesDelegate : public GestureEventConsumeDelegate { void set_consume_touch_move(bool consume) { consume_touch_move_ = consume; } private: - virtual ui::TouchStatus OnTouchEvent(TouchEvent* touch) OVERRIDE { + virtual ui::TouchStatus OnTouchEvent(ui::TouchEventImpl* touch) OVERRIDE { if (consume_touch_move_ && touch->type() == ui::ET_TOUCH_MOVED) return ui::TOUCH_STATUS_CONTINUE; return GestureEventConsumeDelegate::OnTouchEvent(touch); @@ -2304,8 +2307,8 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTouchMoveConsumed) { delegate.get(), -1234, bounds, NULL)); delegate->Reset(); - TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), - kTouchId, GetTime()); + ui::TouchEventImpl press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), + kTouchId, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); EXPECT_FALSE(delegate->tap()); EXPECT_TRUE(delegate->tap_down()); @@ -2372,9 +2375,9 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTouchMoveConsumed) { // Release the touch. This should end the scroll. delegate->Reset(); - TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), - kTouchId, press.time_stamp() + - base::TimeDelta::FromMilliseconds(50)); + ui::TouchEventImpl release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), + kTouchId, press.time_stamp() + + base::TimeDelta::FromMilliseconds(50)); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); @@ -2398,23 +2401,23 @@ TEST_F(GestureRecognizerTest, GestureEventDoubleTap) { delegate.get(), -1234, bounds, NULL)); // First tap (tested in GestureEventTap) - TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(104, 201), - kTouchId, GetTime()); + ui::TouchEventImpl press1(ui::ET_TOUCH_PRESSED, gfx::Point(104, 201), + kTouchId, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); - TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(104, 201), - kTouchId, press1.time_stamp() + - base::TimeDelta::FromMilliseconds(50)); + ui::TouchEventImpl release1(ui::ET_TOUCH_RELEASED, gfx::Point(104, 201), + kTouchId, press1.time_stamp() + + base::TimeDelta::FromMilliseconds(50)); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); delegate->Reset(); // Second tap - TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(101, 203), - kTouchId, release1.time_stamp() + - base::TimeDelta::FromMilliseconds(200)); + ui::TouchEventImpl press2(ui::ET_TOUCH_PRESSED, gfx::Point(101, 203), + kTouchId, release1.time_stamp() + + base::TimeDelta::FromMilliseconds(200)); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); - TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(102, 206), - kTouchId, press2.time_stamp() + - base::TimeDelta::FromMilliseconds(50)); + ui::TouchEventImpl release2(ui::ET_TOUCH_RELEASED, gfx::Point(102, 206), + kTouchId, press2.time_stamp() + + base::TimeDelta::FromMilliseconds(50)); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2); EXPECT_TRUE(delegate->tap()); @@ -2441,23 +2444,23 @@ TEST_F(GestureRecognizerTest, TwoTapsFarApart) { delegate.get(), -1234, bounds, NULL)); // First tap (tested in GestureEventTap) - TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), + ui::TouchEventImpl press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); - TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), - kTouchId, press1.time_stamp() + - base::TimeDelta::FromMilliseconds(50)); + ui::TouchEventImpl release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), + kTouchId, press1.time_stamp() + + base::TimeDelta::FromMilliseconds(50)); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); delegate->Reset(); // Second tap, close in time but far in distance - TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(201, 201), - kTouchId, release1.time_stamp() + - base::TimeDelta::FromMilliseconds(200)); + ui::TouchEventImpl press2(ui::ET_TOUCH_PRESSED, gfx::Point(201, 201), + kTouchId, release1.time_stamp() + + base::TimeDelta::FromMilliseconds(200)); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); - TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(201, 201), - kTouchId, press2.time_stamp() + - base::TimeDelta::FromMilliseconds(50)); + ui::TouchEventImpl release2(ui::ET_TOUCH_RELEASED, gfx::Point(201, 201), + kTouchId, press2.time_stamp() + + base::TimeDelta::FromMilliseconds(50)); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2); EXPECT_TRUE(delegate->tap()); @@ -2485,23 +2488,23 @@ TEST_F(GestureRecognizerTest, TwoTapsWithDelayBetween) { delegate.get(), -1234, bounds, NULL)); // First tap (tested in GestureEventTap) - TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), - kTouchId, GetTime()); + ui::TouchEventImpl press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), + kTouchId, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); - TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), - kTouchId, press1.time_stamp() + - base::TimeDelta::FromMilliseconds(50)); + ui::TouchEventImpl release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), + kTouchId, press1.time_stamp() + + base::TimeDelta::FromMilliseconds(50)); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); delegate->Reset(); // Second tap, close in distance but after some delay - TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), - kTouchId, release1.time_stamp() + - base::TimeDelta::FromMilliseconds(2000)); + ui::TouchEventImpl press2(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), + kTouchId, release1.time_stamp() + + base::TimeDelta::FromMilliseconds(2000)); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); - TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), - kTouchId, press2.time_stamp() + - base::TimeDelta::FromMilliseconds(50)); + ui::TouchEventImpl release2(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), + kTouchId, press2.time_stamp() + + base::TimeDelta::FromMilliseconds(50)); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2); EXPECT_TRUE(delegate->tap()); @@ -2529,14 +2532,15 @@ TEST_F(GestureRecognizerTest, BoundingBoxRadiusChange) { scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( delegate.get(), -1234, bounds, NULL)); - TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId, - GetTime()); + ui::TouchEventImpl press1( + ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); EXPECT_TRUE(delegate->bounding_box().IsEmpty()); delegate->Reset(); - TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(201, 201), kTouchId2, + ui::TouchEventImpl press2( + ui::ET_TOUCH_PRESSED, gfx::Point(201, 201), kTouchId2, press1.time_stamp() + base::TimeDelta::FromMilliseconds(400)); press2.set_radius_x(5); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); @@ -2544,7 +2548,7 @@ TEST_F(GestureRecognizerTest, BoundingBoxRadiusChange) { delegate->Reset(); - TouchEvent move1(ui::ET_TOUCH_MOVED, gfx::Point(141, 201), kTouchId, + ui::TouchEventImpl move1(ui::ET_TOUCH_MOVED, gfx::Point(141, 201), kTouchId, press1.time_stamp() + base::TimeDelta::FromMilliseconds(40)); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move1); EXPECT_TRUE(delegate->pinch_begin()); @@ -2554,7 +2558,7 @@ TEST_F(GestureRecognizerTest, BoundingBoxRadiusChange) { delegate->Reset(); // The position doesn't move, but the radius changes. - TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(101, 201), kTouchId, + ui::TouchEventImpl move2(ui::ET_TOUCH_MOVED, gfx::Point(101, 201), kTouchId, press2.time_stamp() + base::TimeDelta::FromMilliseconds(40)); move2.set_radius_x(50); move2.set_radius_y(60); diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc index d7fb311..a80ead2 100644 --- a/ui/aura/root_window.cc +++ b/ui/aura/root_window.cc @@ -18,7 +18,6 @@ #include "ui/aura/client/event_client.h" #include "ui/aura/client/screen_position_client.h" #include "ui/aura/env.h" -#include "ui/aura/event.h" #include "ui/aura/event_filter.h" #include "ui/aura/focus_manager.h" #include "ui/aura/display_manager.h" @@ -26,6 +25,7 @@ #include "ui/aura/root_window_observer.h" #include "ui/aura/window.h" #include "ui/aura/window_delegate.h" +#include "ui/base/event.h" #include "ui/base/gestures/gesture_recognizer.h" #include "ui/base/gestures/gesture_types.h" #include "ui/base/hit_test.h" @@ -272,7 +272,7 @@ void RootWindow::ScheduleFullDraw() { compositor_->ScheduleFullDraw(); } -bool RootWindow::DispatchGestureEvent(GestureEvent* event) { +bool RootWindow::DispatchGestureEvent(ui::GestureEventImpl* event) { DispatchHeldMouseMove(); Window* target = client::GetCaptureWindow(this); @@ -284,7 +284,8 @@ bool RootWindow::DispatchGestureEvent(GestureEvent* event) { } if (target) { - GestureEvent translated_event(*event, this, target); + ui::GestureEventImpl translated_event( + *event, static_cast<Window*>(this), target); ui::GestureStatus status = ProcessGestureEvent(target, &translated_event); return status != ui::GESTURE_STATUS_UNKNOWN; } @@ -519,8 +520,8 @@ void RootWindow::UpdateCapture(Window* old_capture, if (old_capture && old_capture->GetRootWindow() == this && old_capture->delegate()) { // Send a capture changed event with bogus location data. - MouseEvent event( - ui::ET_MOUSE_CAPTURE_CHANGED, gfx::Point(), gfx::Point(), 0); + ui::MouseEvent event(ui::ET_MOUSE_CAPTURE_CHANGED, gfx::Point(), + gfx::Point(), 0); ProcessMouseEvent(old_capture, &event); old_capture->delegate()->OnCaptureLost(); @@ -564,26 +565,32 @@ gfx::Point RootWindow::QueryMouseLocationForTest() const { //////////////////////////////////////////////////////////////////////////////// // RootWindow, private: -void RootWindow::HandleMouseMoved(const MouseEvent& event, Window* target) { +void RootWindow::HandleMouseMoved(const ui::MouseEvent& event, Window* target) { if (target == mouse_moved_handler_) return; // Send an exited event. if (mouse_moved_handler_ && mouse_moved_handler_->delegate()) { - MouseEvent translated_event(event, this, mouse_moved_handler_, - ui::ET_MOUSE_EXITED, event.flags()); + ui::MouseEvent translated_event(event, + static_cast<Window*>(this), + mouse_moved_handler_, + ui::ET_MOUSE_EXITED, + event.flags()); ProcessMouseEvent(mouse_moved_handler_, &translated_event); } mouse_moved_handler_ = target; // Send an entered event. if (mouse_moved_handler_ && mouse_moved_handler_->delegate()) { - MouseEvent translated_event(event, this, mouse_moved_handler_, - ui::ET_MOUSE_ENTERED, event.flags()); + ui::MouseEvent translated_event(event, + static_cast<Window*>(this), + mouse_moved_handler_, + ui::ET_MOUSE_ENTERED, + event.flags()); ProcessMouseEvent(mouse_moved_handler_, &translated_event); } } -bool RootWindow::ProcessMouseEvent(Window* target, MouseEvent* event) { +bool RootWindow::ProcessMouseEvent(Window* target, ui::MouseEvent* event) { if (!target->IsVisible()) return false; @@ -601,7 +608,7 @@ bool RootWindow::ProcessMouseEvent(Window* target, MouseEvent* event) { return target->delegate()->OnMouseEvent(event); } -bool RootWindow::ProcessKeyEvent(Window* target, KeyEvent* event) { +bool RootWindow::ProcessKeyEvent(Window* target, ui::KeyEvent* event) { EventFilters filters; if (!target) { @@ -628,7 +635,7 @@ bool RootWindow::ProcessKeyEvent(Window* target, KeyEvent* event) { } ui::TouchStatus RootWindow::ProcessTouchEvent(Window* target, - TouchEvent* event) { + ui::TouchEventImpl* event) { if (!target->IsVisible()) return ui::TOUCH_STATUS_UNKNOWN; @@ -652,7 +659,7 @@ ui::TouchStatus RootWindow::ProcessTouchEvent(Window* target, } ui::GestureStatus RootWindow::ProcessGestureEvent(Window* target, - GestureEvent* event) { + ui::GestureEventImpl* event) { if (!target->IsVisible()) return ui::GESTURE_STATUS_UNKNOWN; @@ -681,8 +688,8 @@ bool RootWindow::ProcessGestures(ui::GestureRecognizer::Gestures* gestures) { return false; bool handled = false; for (unsigned int i = 0; i < gestures->size(); i++) { - GestureEvent* gesture = - static_cast<GestureEvent*>(gestures->get().at(i)); + ui::GestureEventImpl* gesture = + static_cast<ui::GestureEventImpl*>(gestures->get().at(i)); if (DispatchGestureEvent(gesture) != ui::GESTURE_STATUS_UNKNOWN) handled = true; } @@ -748,11 +755,11 @@ void RootWindow::OnWindowAddedToRootWindow(Window* attached) { } bool RootWindow::DispatchLongPressGestureEvent(ui::GestureEvent* event) { - return DispatchGestureEvent(static_cast<GestureEvent*>(event)); + return DispatchGestureEvent(static_cast<ui::GestureEventImpl*>(event)); } bool RootWindow::DispatchCancelTouchEvent(ui::TouchEvent* event) { - return OnHostTouchEvent(static_cast<TouchEvent*>(event)); + return OnHostTouchEvent(static_cast<ui::TouchEventImpl*>(event)); } ui::GestureEvent* RootWindow::CreateGestureEvent( @@ -761,16 +768,15 @@ ui::GestureEvent* RootWindow::CreateGestureEvent( int flags, base::Time time, unsigned int touch_id_bitfield) { - return new GestureEvent(details.type(), location.x(), location.y(), - flags, time, details, - touch_id_bitfield); + return new ui::GestureEventImpl(details.type(), location.x(), location.y(), + flags, time, details, touch_id_bitfield); } ui::TouchEvent* RootWindow::CreateTouchEvent(ui::EventType type, const gfx::Point& location, int touch_id, base::TimeDelta time_stamp) { - return new TouchEvent(type, location, touch_id, time_stamp); + return new ui::TouchEventImpl(type, location, touch_id, time_stamp); } void RootWindow::OnLayerAnimationEnded( @@ -789,7 +795,7 @@ void RootWindow::OnLayerAnimationAborted( //////////////////////////////////////////////////////////////////////////////// // RootWindow, RootWindowHostDelegate implementation: -bool RootWindow::OnHostKeyEvent(KeyEvent* event) { +bool RootWindow::OnHostKeyEvent(ui::KeyEvent* event) { DispatchHeldMouseMove(); if (event->key_code() == ui::VKEY_UNKNOWN) return false; @@ -802,11 +808,13 @@ bool RootWindow::OnHostKeyEvent(KeyEvent* event) { return ProcessKeyEvent(focused_window, event); } -bool RootWindow::OnHostMouseEvent(MouseEvent* event) { +bool RootWindow::OnHostMouseEvent(ui::MouseEvent* event) { if (event->type() == ui::ET_MOUSE_DRAGGED || (event->flags() & ui::EF_IS_SYNTHESIZED)) { if (mouse_move_hold_count_) { - held_mouse_move_.reset(new MouseEvent(*event, NULL, NULL)); + Window* null_window = static_cast<Window*>(NULL); + held_mouse_move_.reset( + new ui::MouseEvent(*event, null_window, null_window)); return true; } else { // We may have a held event for a period between the time @@ -820,7 +828,7 @@ bool RootWindow::OnHostMouseEvent(MouseEvent* event) { return DispatchMouseEventImpl(event); } -bool RootWindow::OnHostScrollEvent(ScrollEvent* event) { +bool RootWindow::OnHostScrollEvent(ui::ScrollEvent* event) { DispatchHeldMouseMove(); float scale = ui::GetDeviceScaleFactor(layer()); ui::Transform transform = layer()->transform(); @@ -838,16 +846,17 @@ bool RootWindow::OnHostScrollEvent(ScrollEvent* event) { if (target && target->delegate()) { int flags = event->flags(); gfx::Point location_in_window = event->location(); - Window::ConvertPointToWindow(this, target, &location_in_window); + Window::ConvertPointToTarget(this, target, &location_in_window); if (IsNonClientLocation(target, location_in_window)) flags |= ui::EF_IS_NON_CLIENT; - ScrollEvent translated_event(*event, this, target, event->type(), flags); + ui::ScrollEvent translated_event( + *event, static_cast<Window*>(this), target, event->type(), flags); return ProcessMouseEvent(target, &translated_event); } return false; } -bool RootWindow::OnHostTouchEvent(TouchEvent* event) { +bool RootWindow::OnHostTouchEvent(ui::TouchEventImpl* event) { DispatchHeldMouseMove(); switch (event->type()) { case ui::ET_TOUCH_PRESSED: @@ -892,7 +901,8 @@ bool RootWindow::OnHostTouchEvent(TouchEvent* event) { return false; } - TouchEvent translated_event(*event, this, target); + ui::TouchEventImpl translated_event( + *event, static_cast<Window*>(this), target); status = ProcessTouchEvent(target, &translated_event); handled = status != ui::TOUCH_STATUS_UNKNOWN; @@ -946,7 +956,7 @@ RootWindow* RootWindow::AsRootWindow() { //////////////////////////////////////////////////////////////////////////////// // RootWindow, private: -bool RootWindow::DispatchMouseEventImpl(MouseEvent* event) { +bool RootWindow::DispatchMouseEventImpl(ui::MouseEvent* event) { float scale = ui::GetDeviceScaleFactor(layer()); ui::Transform transform = layer()->transform(); transform.ConcatScale(scale, scale); @@ -958,7 +968,7 @@ bool RootWindow::DispatchMouseEventImpl(MouseEvent* event) { return DispatchMouseEventToTarget(event, target); } -bool RootWindow::DispatchMouseEventToTarget(MouseEvent* event, +bool RootWindow::DispatchMouseEventToTarget(ui::MouseEvent* event, Window* target) { static const int kMouseButtonFlagMask = ui::EF_LEFT_MOUSE_BUTTON | @@ -987,10 +997,11 @@ bool RootWindow::DispatchMouseEventToTarget(MouseEvent* event, if (target && target->delegate()) { int flags = event->flags(); gfx::Point location_in_window = event->location(); - Window::ConvertPointToWindow(this, target, &location_in_window); + Window::ConvertPointToTarget(this, target, &location_in_window); if (IsNonClientLocation(target, location_in_window)) flags |= ui::EF_IS_NON_CLIENT; - MouseEvent translated_event(*event, this, target, event->type(), flags); + ui::MouseEvent translated_event( + *event, static_cast<Window*>(this), target, event->type(), flags); return ProcessMouseEvent(target, &translated_event); } return false; @@ -1031,10 +1042,10 @@ void RootWindow::SynthesizeMouseMoveEvent() { // TODO(derat|oshima): Don't use mouse_button_flags_ as it's // currently broken. See/ crbug.com/107931. - MouseEvent event(ui::ET_MOUSE_MOVED, - orig_mouse_location, - orig_mouse_location, - ui::EF_IS_SYNTHESIZED); + ui::MouseEvent event(ui::ET_MOUSE_MOVED, + orig_mouse_location, + orig_mouse_location, + ui::EF_IS_SYNTHESIZED); OnHostMouseEvent(&event); #endif } diff --git a/ui/aura/root_window.h b/ui/aura/root_window.h index ac435e8..70a77a8 100644 --- a/ui/aura/root_window.h +++ b/ui/aura/root_window.h @@ -31,22 +31,22 @@ class Size; } namespace ui { +class GestureEventImpl; class GestureRecognizer; +class KeyEvent; class LayerAnimationSequence; +class MouseEvent; +class ScrollEvent; +class TouchEventImpl; class Transform; } namespace aura { class FocusManager; -class GestureEvent; -class KeyEvent; -class MouseEvent; class RootWindow; class RootWindowHost; class RootWindowObserver; -class ScrollEvent; -class TouchEvent; // This class represents a lock on the compositor, that can be used to prevent a // compositing pass from happening while we're waiting for an asynchronous @@ -145,7 +145,7 @@ class AURA_EXPORT RootWindow : public ui::CompositorDelegate, // Handles a gesture event. Returns true if handled. Unlike the other // event-dispatching function (e.g. for touch/mouse/keyboard events), gesture // events are dispatched from GestureRecognizer instead of RootWindowHost. - bool DispatchGestureEvent(GestureEvent* event); + bool DispatchGestureEvent(ui::GestureEventImpl* event); // Invoked when |window| is being destroyed. void OnWindowDestroying(Window* window); @@ -267,12 +267,13 @@ class AURA_EXPORT RootWindow : public ui::CompositorDelegate, // Called whenever the mouse moves, tracks the current |mouse_moved_handler_|, // sending exited and entered events as its value changes. - void HandleMouseMoved(const MouseEvent& event, Window* target); + void HandleMouseMoved(const ui::MouseEvent& event, Window* target); - bool ProcessMouseEvent(Window* target, MouseEvent* event); - bool ProcessKeyEvent(Window* target, KeyEvent* event); - ui::TouchStatus ProcessTouchEvent(Window* target, TouchEvent* event); - ui::GestureStatus ProcessGestureEvent(Window* target, GestureEvent* event); + bool ProcessMouseEvent(Window* target, ui::MouseEvent* event); + bool ProcessKeyEvent(Window* target, ui::KeyEvent* event); + ui::TouchStatus ProcessTouchEvent(Window* target, ui::TouchEventImpl* event); + ui::GestureStatus ProcessGestureEvent(Window* target, + ui::GestureEventImpl* event); bool ProcessGestures(ui::GestureRecognizer::Gestures* gestures); // Called when a Window is attached or detached from the RootWindow. @@ -310,10 +311,10 @@ class AURA_EXPORT RootWindow : public ui::CompositorDelegate, ui::LayerAnimationSequence* animation) OVERRIDE; // Overridden from aura::RootWindowHostDelegate: - virtual bool OnHostKeyEvent(KeyEvent* event) OVERRIDE; - virtual bool OnHostMouseEvent(MouseEvent* event) OVERRIDE; - virtual bool OnHostScrollEvent(ScrollEvent* event) OVERRIDE; - virtual bool OnHostTouchEvent(TouchEvent* event) OVERRIDE; + virtual bool OnHostKeyEvent(ui::KeyEvent* event) OVERRIDE; + virtual bool OnHostMouseEvent(ui::MouseEvent* event) OVERRIDE; + virtual bool OnHostScrollEvent(ui::ScrollEvent* event) OVERRIDE; + virtual bool OnHostTouchEvent(ui::TouchEventImpl* event) OVERRIDE; virtual void OnHostLostCapture() OVERRIDE; virtual void OnHostPaint() OVERRIDE; virtual void OnHostResized(const gfx::Size& size) OVERRIDE; @@ -326,8 +327,8 @@ class AURA_EXPORT RootWindow : public ui::CompositorDelegate, // drag needs dispatching or a matching ReleaseMouseMoves() is called. // NOTE: because these methods dispatch events from RootWindowHost the // coordinates are in terms of the root. - bool DispatchMouseEventImpl(MouseEvent* event); - bool DispatchMouseEventToTarget(MouseEvent* event, Window* target); + bool DispatchMouseEventImpl(ui::MouseEvent* event); + bool DispatchMouseEventToTarget(ui::MouseEvent* event, Window* target); void DispatchHeldMouseMove(); // Parses the switch describing the initial size for the host window and @@ -390,7 +391,7 @@ class AURA_EXPORT RootWindow : public ui::CompositorDelegate, // How many holds are outstanding. We try to defer dispatching mouse moves // while the count is > 0. int mouse_move_hold_count_; - scoped_ptr<MouseEvent> held_mouse_move_; + scoped_ptr<ui::MouseEvent> held_mouse_move_; // Used to schedule DispatchHeldMouseMove() when |mouse_move_hold_count_| goes // to 0. base::WeakPtrFactory<RootWindow> held_mouse_event_factory_; diff --git a/ui/aura/root_window_host_delegate.h b/ui/aura/root_window_host_delegate.h index 3f64911..1ebeb5f 100644 --- a/ui/aura/root_window_host_delegate.h +++ b/ui/aura/root_window_host_delegate.h @@ -9,22 +9,25 @@ namespace gfx { class Size; } -namespace aura { - +namespace ui { class KeyEvent; class MouseEvent; -class RootWindow; class ScrollEvent; -class TouchEvent; +class TouchEventImpl; +} + +namespace aura { + +class RootWindow; // A private interface used by RootWindowHost implementations to communicate // with their owning RootWindow. class AURA_EXPORT RootWindowHostDelegate { public: - virtual bool OnHostKeyEvent(KeyEvent* event) = 0; - virtual bool OnHostMouseEvent(MouseEvent* event) = 0; - virtual bool OnHostScrollEvent(ScrollEvent* event) = 0; - virtual bool OnHostTouchEvent(TouchEvent* event) = 0; + virtual bool OnHostKeyEvent(ui::KeyEvent* event) = 0; + virtual bool OnHostMouseEvent(ui::MouseEvent* event) = 0; + virtual bool OnHostScrollEvent(ui::ScrollEvent* event) = 0; + virtual bool OnHostTouchEvent(ui::TouchEventImpl* event) = 0; virtual void OnHostLostCapture() = 0; diff --git a/ui/aura/root_window_host_linux.cc b/ui/aura/root_window_host_linux.cc index 0325b7c..a8cba8b 100644 --- a/ui/aura/root_window_host_linux.cc +++ b/ui/aura/root_window_host_linux.cc @@ -22,9 +22,9 @@ #include "ui/aura/client/user_action_client.h" #include "ui/aura/dispatcher_linux.h" #include "ui/aura/env.h" -#include "ui/aura/event.h" #include "ui/aura/root_window.h" #include "ui/base/cursor/cursor.h" +#include "ui/base/event.h" #include "ui/base/keycodes/keyboard_codes.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/touch/touch_factory.h" @@ -585,12 +585,12 @@ bool RootWindowHostLinux::Dispatch(const base::NativeEvent& event) { delegate_->AsRootWindow()->ScheduleFullDraw(); break; case KeyPress: { - KeyEvent keydown_event(xev, false); + ui::KeyEvent keydown_event(xev, false); delegate_->OnHostKeyEvent(&keydown_event); break; } case KeyRelease: { - KeyEvent keyup_event(xev, false); + ui::KeyEvent keyup_event(xev, false); delegate_->OnHostKeyEvent(&keyup_event); break; } @@ -609,7 +609,7 @@ bool RootWindowHostLinux::Dispatch(const base::NativeEvent& event) { } } // fallthrough case ButtonRelease: { - MouseEvent mouseev(xev); + ui::MouseEvent mouseev(xev); delegate_->OnHostMouseEvent(&mouseev); break; } @@ -652,7 +652,7 @@ bool RootWindowHostLinux::Dispatch(const base::NativeEvent& event) { case ui::ET_TOUCH_PRESSED: case ui::ET_TOUCH_RELEASED: case ui::ET_TOUCH_MOVED: { - TouchEvent touchev(xev); + ui::TouchEventImpl touchev(xev); delegate_->OnHostTouchEvent(&touchev); break; } @@ -688,14 +688,14 @@ bool RootWindowHostLinux::Dispatch(const base::NativeEvent& event) { break; } } - MouseEvent mouseev(xev); + ui::MouseEvent mouseev(xev); delegate_->OnHostMouseEvent(&mouseev); break; } case ui::ET_SCROLL_FLING_START: case ui::ET_SCROLL_FLING_CANCEL: case ui::ET_SCROLL: { - ScrollEvent scrollev(xev); + ui::ScrollEvent scrollev(xev); delegate_->OnHostScrollEvent(&scrollev); break; } @@ -768,7 +768,7 @@ bool RootWindowHostLinux::Dispatch(const base::NativeEvent& event) { } } - MouseEvent mouseev(xev); + ui::MouseEvent mouseev(xev); delegate_->OnHostMouseEvent(&mouseev); break; } diff --git a/ui/aura/root_window_host_win.cc b/ui/aura/root_window_host_win.cc index 66492c8..fa336a3 100644 --- a/ui/aura/root_window_host_win.cc +++ b/ui/aura/root_window_host_win.cc @@ -11,8 +11,8 @@ #include "base/message_loop.h" #include "ui/aura/client/capture_client.h" #include "ui/aura/env.h" -#include "ui/aura/event.h" #include "ui/aura/root_window.h" +#include "ui/base/event.h" #include "ui/base/view_prop.h" using std::max; @@ -309,7 +309,7 @@ LRESULT RootWindowHostWin::OnKeyEvent(UINT message, WPARAM w_param, LPARAM l_param) { MSG msg = { hwnd(), message, w_param, l_param }; - KeyEvent keyev(msg, message == WM_CHAR); + ui::KeyEvent keyev(msg, message == WM_CHAR); SetMsgHandled(delegate_->OnHostKeyEvent(&keyev)); return 0; } @@ -319,7 +319,7 @@ LRESULT RootWindowHostWin::OnMouseRange(UINT message, LPARAM l_param) { MSG msg = { hwnd(), message, w_param, l_param, 0, { GET_X_LPARAM(l_param), GET_Y_LPARAM(l_param) } }; - MouseEvent event(msg); + ui::MouseEvent event(msg); bool handled = false; if (!(event.flags() & ui::EF_IS_NON_CLIENT)) handled = delegate_->OnHostMouseEvent(&event); diff --git a/ui/aura/root_window_unittest.cc b/ui/aura/root_window_unittest.cc index 89b8e71..c280653 100644 --- a/ui/aura/root_window_unittest.cc +++ b/ui/aura/root_window_unittest.cc @@ -9,13 +9,13 @@ #include "testing/gtest/include/gtest/gtest.h" #include "ui/aura/client/event_client.h" #include "ui/aura/env.h" -#include "ui/aura/event.h" #include "ui/aura/event_filter.h" #include "ui/aura/focus_manager.h" #include "ui/aura/test/aura_test_base.h" #include "ui/aura/test/event_generator.h" #include "ui/aura/test/test_window_delegate.h" #include "ui/aura/test/test_windows.h" +#include "ui/base/event.h" #include "ui/base/gestures/gesture_configuration.h" #include "ui/base/hit_test.h" #include "ui/base/keycodes/keyboard_codes.h" @@ -48,7 +48,7 @@ class NonClientDelegate : public test::TestWindowDelegate { self->non_client_location_ = location; return HTTOPLEFT; } - virtual bool OnMouseEvent(MouseEvent* event) OVERRIDE { + virtual bool OnMouseEvent(ui::MouseEvent* event) OVERRIDE { mouse_event_count_++; mouse_event_location_ = event->location(); mouse_event_flags_ = event->flags(); @@ -81,20 +81,21 @@ class EventCountFilter : public EventFilter { } // EventFilter overrides: - virtual bool PreHandleKeyEvent(Window* target, KeyEvent* event) OVERRIDE { + virtual bool PreHandleKeyEvent(Window* target, ui::KeyEvent* event) OVERRIDE { num_key_events_++; return true; } - virtual bool PreHandleMouseEvent(Window* target, MouseEvent* event) OVERRIDE { + virtual bool PreHandleMouseEvent(Window* target, + ui::MouseEvent* event) OVERRIDE { num_mouse_events_++; return true; } virtual ui::TouchStatus PreHandleTouchEvent( - Window* target, TouchEvent* event) OVERRIDE { + Window* target, ui::TouchEventImpl* event) OVERRIDE { return ui::TOUCH_STATUS_UNKNOWN; } virtual ui::GestureStatus PreHandleGestureEvent( - Window* target, GestureEvent* event) OVERRIDE { + Window* target, ui::GestureEventImpl* event) OVERRIDE { return ui::GESTURE_STATUS_UNKNOWN; } @@ -128,7 +129,7 @@ TEST_F(RootWindowTest, OnHostMouseEvent) { // Send a mouse event to window1. gfx::Point point(101, 201); - MouseEvent event1( + ui::MouseEvent event1( ui::ET_MOUSE_PRESSED, point, point, ui::EF_LEFT_MOUSE_BUTTON); root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(&event1); @@ -152,10 +153,10 @@ TEST_F(RootWindowTest, MouseButtonState) { EXPECT_FALSE(Env::GetInstance()->is_mouse_button_down()); gfx::Point location; - scoped_ptr<MouseEvent> event; + scoped_ptr<ui::MouseEvent> event; // Press the left button. - event.reset(new MouseEvent( + event.reset(new ui::MouseEvent( ui::ET_MOUSE_PRESSED, location, location, @@ -164,7 +165,7 @@ TEST_F(RootWindowTest, MouseButtonState) { EXPECT_TRUE(Env::GetInstance()->is_mouse_button_down()); // Additionally press the right. - event.reset(new MouseEvent( + event.reset(new ui::MouseEvent( ui::ET_MOUSE_PRESSED, location, location, @@ -173,7 +174,7 @@ TEST_F(RootWindowTest, MouseButtonState) { EXPECT_TRUE(Env::GetInstance()->is_mouse_button_down()); // Release the left button. - event.reset(new MouseEvent( + event.reset(new ui::MouseEvent( ui::ET_MOUSE_RELEASED, location, location, @@ -182,7 +183,7 @@ TEST_F(RootWindowTest, MouseButtonState) { EXPECT_TRUE(Env::GetInstance()->is_mouse_button_down()); // Release the right button. We should ignore the Shift-is-down flag. - event.reset(new MouseEvent( + event.reset(new ui::MouseEvent( ui::ET_MOUSE_RELEASED, location, location, @@ -191,7 +192,7 @@ TEST_F(RootWindowTest, MouseButtonState) { EXPECT_FALSE(Env::GetInstance()->is_mouse_button_down()); // Press the middle button. - event.reset(new MouseEvent( + event.reset(new ui::MouseEvent( ui::ET_MOUSE_PRESSED, location, location, @@ -205,13 +206,13 @@ TEST_F(RootWindowTest, TranslatedEvent) { gfx::Rect(50, 50, 100, 100), NULL)); gfx::Point origin(100, 100); - MouseEvent root(ui::ET_MOUSE_PRESSED, origin, origin, 0); + ui::MouseEvent root(ui::ET_MOUSE_PRESSED, origin, origin, 0); EXPECT_EQ("100,100", root.location().ToString()); EXPECT_EQ("100,100", root.root_location().ToString()); - MouseEvent translated_event( - root, root_window(), w1.get(), + ui::MouseEvent translated_event( + root, static_cast<Window*>(root_window()), w1.get(), ui::ET_MOUSE_ENTERED, root.flags()); EXPECT_EQ("50,50", translated_event.location().ToString()); EXPECT_EQ("100,100", translated_event.root_location().ToString()); @@ -333,12 +334,12 @@ TEST_F(RootWindowTest, IgnoreUnknownKeys) { EventCountFilter* filter = new EventCountFilter; root_window()->SetEventFilter(filter); // passes ownership - KeyEvent unknown_event(ui::ET_KEY_PRESSED, ui::VKEY_UNKNOWN, 0); + ui::KeyEvent unknown_event(ui::ET_KEY_PRESSED, ui::VKEY_UNKNOWN, 0); EXPECT_FALSE(root_window()->AsRootWindowHostDelegate()->OnHostKeyEvent( &unknown_event)); EXPECT_EQ(0, filter->num_key_events()); - KeyEvent known_event(ui::ET_KEY_PRESSED, ui::VKEY_A, 0); + ui::KeyEvent known_event(ui::ET_KEY_PRESSED, ui::VKEY_A, 0); EXPECT_TRUE(root_window()->AsRootWindowHostDelegate()->OnHostKeyEvent( &known_event)); EXPECT_EQ(1, filter->num_key_events()); @@ -356,22 +357,24 @@ class EventFilterRecorder : public EventFilter { Events& events() { return events_; } // EventFilter overrides: - virtual bool PreHandleKeyEvent(Window* target, KeyEvent* event) OVERRIDE { + virtual bool PreHandleKeyEvent(Window* target, ui::KeyEvent* event) OVERRIDE { events_.push_back(event->type()); return true; } - virtual bool PreHandleMouseEvent(Window* target, MouseEvent* event) OVERRIDE { + virtual bool PreHandleMouseEvent(Window* target, + ui::MouseEvent* event) OVERRIDE { events_.push_back(event->type()); return true; } - virtual ui::TouchStatus PreHandleTouchEvent(Window* target, - TouchEvent* event) OVERRIDE { + virtual ui::TouchStatus PreHandleTouchEvent( + Window* target, + ui::TouchEventImpl* event) OVERRIDE { events_.push_back(event->type()); return ui::TOUCH_STATUS_UNKNOWN; } virtual ui::GestureStatus PreHandleGestureEvent( Window* target, - GestureEvent* event) OVERRIDE { + ui::GestureEventImpl* event) OVERRIDE { events_.push_back(event->type()); return ui::GESTURE_STATUS_UNKNOWN; } @@ -462,8 +465,8 @@ TEST_F(RootWindowTest, HoldMouseMove) { scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( &delegate, 1, gfx::Rect(0, 0, 100, 100), NULL)); - MouseEvent mouse_move_event(ui::ET_MOUSE_MOVED, gfx::Point(0, 0), - gfx::Point(0, 0), 0); + ui::MouseEvent mouse_move_event(ui::ET_MOUSE_MOVED, gfx::Point(0, 0), + gfx::Point(0, 0), 0); root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent( &mouse_move_event); // Discard MOUSE_ENTER. @@ -472,16 +475,16 @@ TEST_F(RootWindowTest, HoldMouseMove) { root_window()->HoldMouseMoves(); // Check that we don't immediately dispatch the MOUSE_DRAGGED event. - MouseEvent mouse_dragged_event(ui::ET_MOUSE_DRAGGED, gfx::Point(0, 0), - gfx::Point(0, 0), 0); + ui::MouseEvent mouse_dragged_event(ui::ET_MOUSE_DRAGGED, gfx::Point(0, 0), + gfx::Point(0, 0), 0); root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent( &mouse_dragged_event); EXPECT_TRUE(filter->events().empty()); // Check that we do dispatch the held MOUSE_DRAGGED event before another type // of event. - MouseEvent mouse_pressed_event(ui::ET_MOUSE_PRESSED, gfx::Point(0, 0), - gfx::Point(0, 0), 0); + ui::MouseEvent mouse_pressed_event(ui::ET_MOUSE_PRESSED, gfx::Point(0, 0), + gfx::Point(0, 0), 0); root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent( &mouse_pressed_event); EXPECT_EQ("MOUSE_DRAGGED MOUSE_PRESSED", @@ -489,8 +492,8 @@ TEST_F(RootWindowTest, HoldMouseMove) { filter->events().clear(); // Check that we coalesce held MOUSE_DRAGGED events. - MouseEvent mouse_dragged_event2(ui::ET_MOUSE_DRAGGED, gfx::Point(1, 1), - gfx::Point(1, 1), 0); + ui::MouseEvent mouse_dragged_event2(ui::ET_MOUSE_DRAGGED, gfx::Point(1, 1), + gfx::Point(1, 1), 0); root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent( &mouse_dragged_event); root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent( diff --git a/ui/aura/shared/compound_event_filter.cc b/ui/aura/shared/compound_event_filter.cc index 85cff86..60c48fa 100644 --- a/ui/aura/shared/compound_event_filter.cc +++ b/ui/aura/shared/compound_event_filter.cc @@ -7,11 +7,11 @@ #include "ui/aura/client/activation_client.h" #include "ui/aura/client/cursor_client.h" #include "ui/aura/env.h" -#include "ui/aura/event.h" #include "ui/aura/focus_manager.h" #include "ui/aura/root_window.h" #include "ui/aura/window_delegate.h" #include "ui/aura/window_tracker.h" +#include "ui/base/event.h" #include "ui/base/hit_test.h" namespace aura { @@ -19,15 +19,15 @@ namespace shared { namespace { -aura::Window* FindFocusableWindowFor(aura::Window* window) { +Window* FindFocusableWindowFor(Window* window) { while (window && !window->CanFocus()) window = window->parent(); return window; } -aura::Window* GetActiveWindow(aura::Window* window) { +Window* GetActiveWindow(Window* window) { DCHECK(window->GetRootWindow()); - return aura::client::GetActivationClient(window->GetRootWindow())-> + return client::GetActivationClient(window->GetRootWindow())-> GetActiveWindow(); } @@ -70,11 +70,11 @@ gfx::NativeCursor CompoundEventFilter::CursorForWindowComponent( } } -void CompoundEventFilter::AddFilter(aura::EventFilter* filter) { +void CompoundEventFilter::AddFilter(EventFilter* filter) { filters_.AddObserver(filter); } -void CompoundEventFilter::RemoveFilter(aura::EventFilter* filter) { +void CompoundEventFilter::RemoveFilter(EventFilter* filter) { filters_.RemoveObserver(filter); } @@ -85,13 +85,13 @@ size_t CompoundEventFilter::GetFilterCount() const { //////////////////////////////////////////////////////////////////////////////// // CompoundEventFilter, EventFilter implementation: -bool CompoundEventFilter::PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) { +bool CompoundEventFilter::PreHandleKeyEvent(Window* target, + ui::KeyEvent* event) { return FilterKeyEvent(target, event); } -bool CompoundEventFilter::PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) { +bool CompoundEventFilter::PreHandleMouseEvent(Window* target, + ui::MouseEvent* event) { WindowTracker window_tracker; window_tracker.Add(target); @@ -123,8 +123,8 @@ bool CompoundEventFilter::PreHandleMouseEvent(aura::Window* target, } ui::TouchStatus CompoundEventFilter::PreHandleTouchEvent( - aura::Window* target, - aura::TouchEvent* event) { + Window* target, + ui::TouchEventImpl* event) { ui::TouchStatus status = FilterTouchEvent(target, event); if (status == ui::TOUCH_STATUS_UNKNOWN && event->type() == ui::ET_TOUCH_PRESSED) { @@ -134,12 +134,12 @@ ui::TouchStatus CompoundEventFilter::PreHandleTouchEvent( } ui::GestureStatus CompoundEventFilter::PreHandleGestureEvent( - aura::Window* target, - aura::GestureEvent* event) { + Window* target, + ui::GestureEventImpl* event) { ui::GestureStatus status = ui::GESTURE_STATUS_UNKNOWN; if (filters_.might_have_observers()) { - ObserverListBase<aura::EventFilter>::Iterator it(filters_); - aura::EventFilter* filter; + ObserverListBase<EventFilter>::Iterator it(filters_); + EventFilter* filter; while (status == ui::GESTURE_STATUS_UNKNOWN && (filter = it.GetNext()) != NULL) { status = filter->PreHandleGestureEvent(target, event); @@ -160,10 +160,9 @@ ui::GestureStatus CompoundEventFilter::PreHandleGestureEvent( //////////////////////////////////////////////////////////////////////////////// // CompoundEventFilter, private: -void CompoundEventFilter::UpdateCursor(aura::Window* target, - aura::MouseEvent* event) { - aura::client::CursorClient* client = - aura::client::GetCursorClient(target->GetRootWindow()); +void CompoundEventFilter::UpdateCursor(Window* target, ui::MouseEvent* event) { + client::CursorClient* client = + client::GetCursorClient(target->GetRootWindow()); if (client) { gfx::NativeCursor cursor = target->GetCursor(event->location()); if (event->flags() & ui::EF_IS_NON_CLIENT) { @@ -176,24 +175,23 @@ void CompoundEventFilter::UpdateCursor(aura::Window* target, } } -bool CompoundEventFilter::FilterKeyEvent(aura::Window* target, - aura::KeyEvent* event) { +bool CompoundEventFilter::FilterKeyEvent(Window* target, ui::KeyEvent* event) { bool handled = false; if (filters_.might_have_observers()) { - ObserverListBase<aura::EventFilter>::Iterator it(filters_); - aura::EventFilter* filter; + ObserverListBase<EventFilter>::Iterator it(filters_); + EventFilter* filter; while (!handled && (filter = it.GetNext()) != NULL) handled = filter->PreHandleKeyEvent(target, event); } return handled; } -bool CompoundEventFilter::FilterMouseEvent(aura::Window* target, - aura::MouseEvent* event) { +bool CompoundEventFilter::FilterMouseEvent(Window* target, + ui::MouseEvent* event) { bool handled = false; if (filters_.might_have_observers()) { - ObserverListBase<aura::EventFilter>::Iterator it(filters_); - aura::EventFilter* filter; + ObserverListBase<EventFilter>::Iterator it(filters_); + EventFilter* filter; while (!handled && (filter = it.GetNext()) != NULL) handled = filter->PreHandleMouseEvent(target, event); } @@ -201,12 +199,12 @@ bool CompoundEventFilter::FilterMouseEvent(aura::Window* target, } ui::TouchStatus CompoundEventFilter::FilterTouchEvent( - aura::Window* target, - aura::TouchEvent* event) { + Window* target, + ui::TouchEventImpl* event) { ui::TouchStatus status = ui::TOUCH_STATUS_UNKNOWN; if (filters_.might_have_observers()) { - ObserverListBase<aura::EventFilter>::Iterator it(filters_); - aura::EventFilter* filter; + ObserverListBase<EventFilter>::Iterator it(filters_); + EventFilter* filter; while (status == ui::TOUCH_STATUS_UNKNOWN && (filter = it.GetNext()) != NULL) { status = filter->PreHandleTouchEvent(target, event); @@ -216,11 +214,11 @@ ui::TouchStatus CompoundEventFilter::FilterTouchEvent( } void CompoundEventFilter::SetCursorVisibilityOnEvent(aura::Window* target, - aura::LocatedEvent* event, + ui::LocatedEvent* event, bool show) { if (update_cursor_visibility_ && !(event->flags() & ui::EF_IS_SYNTHESIZED)) { - aura::client::CursorClient* client = - aura::client::GetCursorClient(target->GetRootWindow()); + client::CursorClient* client = + client::GetCursorClient(target->GetRootWindow()); if (client) client->ShowCursor(show); } diff --git a/ui/aura/shared/compound_event_filter.h b/ui/aura/shared/compound_event_filter.h index f255dd6..c5a5e83 100644 --- a/ui/aura/shared/compound_event_filter.h +++ b/ui/aura/shared/compound_event_filter.h @@ -8,9 +8,16 @@ #include "base/compiler_specific.h" #include "base/observer_list.h" #include "ui/aura/aura_export.h" -#include "ui/aura/event.h" #include "ui/aura/event_filter.h" +namespace ui { +class GestureEventImpl; +class KeyEvent; +class LocatedEvent; +class MouseEvent; +class TouchEventImpl; +} + namespace aura { class CursorManager; class RootWindow; @@ -25,7 +32,7 @@ namespace shared { // consumed by any of those filters. If an event is consumed by a filter, the // rest of the filter(s) and CompoundEventFilter will not see the consumed // event. -class AURA_EXPORT CompoundEventFilter : public aura::EventFilter { +class AURA_EXPORT CompoundEventFilter : public EventFilter { public: CompoundEventFilter(); virtual ~CompoundEventFilter(); @@ -39,41 +46,40 @@ class AURA_EXPORT CompoundEventFilter : public aura::EventFilter { // Adds/removes additional event filters. This does not take ownership of // the EventFilter. - void AddFilter(aura::EventFilter* filter); - void RemoveFilter(aura::EventFilter* filter); + void AddFilter(EventFilter* filter); + void RemoveFilter(EventFilter* filter); size_t GetFilterCount() const; // Overridden from EventFilter: - virtual bool PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) OVERRIDE; - virtual bool PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) OVERRIDE; - virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, - aura::TouchEvent* event) OVERRIDE; + virtual bool PreHandleKeyEvent(Window* target, ui::KeyEvent* event) OVERRIDE; + virtual bool PreHandleMouseEvent(Window* target, + ui::MouseEvent* event) OVERRIDE; + virtual ui::TouchStatus PreHandleTouchEvent( + Window* target, + ui::TouchEventImpl* event) OVERRIDE; virtual ui::GestureStatus PreHandleGestureEvent( - aura::Window* target, - aura::GestureEvent* event) OVERRIDE; + Window* target, + ui::GestureEventImpl* event) OVERRIDE; private: // Updates the cursor if the target provides a custom one, and provides // default resize cursors for window edges. - void UpdateCursor(aura::Window* target, aura::MouseEvent* event); + void UpdateCursor(Window* target, ui::MouseEvent* event); // Dispatches event to additional filters. Returns false or // ui::TOUCH_STATUS_UNKNOWN if event is consumed. - bool FilterKeyEvent(aura::Window* target, aura::KeyEvent* event); - bool FilterMouseEvent(aura::Window* target, aura::MouseEvent* event); - ui::TouchStatus FilterTouchEvent(aura::Window* target, - aura::TouchEvent* event); + bool FilterKeyEvent(Window* target, ui::KeyEvent* event); + bool FilterMouseEvent(Window* target, ui::MouseEvent* event); + ui::TouchStatus FilterTouchEvent(Window* target, ui::TouchEventImpl* event); // Sets the visibility of the cursor if the event is not synthesized and // |update_cursor_visibility_| is true. void SetCursorVisibilityOnEvent(aura::Window* target, - aura::LocatedEvent* event, + ui::LocatedEvent* event, bool show); // Additional event filters that pre-handles events. - ObserverList<aura::EventFilter, true> filters_; + ObserverList<EventFilter, true> filters_; // Should we show the mouse cursor when we see mouse movement and hide it when // we see a touch event? diff --git a/ui/aura/shared/compound_event_filter_unittest.cc b/ui/aura/shared/compound_event_filter_unittest.cc index 85ee580..deb076b 100644 --- a/ui/aura/shared/compound_event_filter_unittest.cc +++ b/ui/aura/shared/compound_event_filter_unittest.cc @@ -12,6 +12,7 @@ #include "ui/aura/test/aura_test_base.h" #include "ui/aura/test/test_activation_client.h" #include "ui/aura/test/test_windows.h" +#include "ui/base/event.h" namespace { base::TimeDelta GetTime() { @@ -60,23 +61,24 @@ TEST_F(CompoundEventFilterTest, TouchHidesCursor) { TestVisibleClient cursor_client; aura::client::SetCursorClient(root_window(), &cursor_client); - MouseEvent mouse(ui::ET_MOUSE_MOVED, gfx::Point(10, 10), + ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, gfx::Point(10, 10), gfx::Point(10, 10), 0); root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse); EXPECT_TRUE(cursor_client.IsCursorVisible()); // This press is required for the GestureRecognizer to associate a target // with kTouchId - TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(90, 90), 1, GetTime()); + ui::TouchEventImpl press( + ui::ET_TOUCH_PRESSED, gfx::Point(90, 90), 1, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); EXPECT_FALSE(cursor_client.IsCursorVisible()); - TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(10, 10), 1, - GetTime()); + ui::TouchEventImpl move(ui::ET_TOUCH_MOVED, gfx::Point(10, 10), 1, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move); EXPECT_FALSE(cursor_client.IsCursorVisible()); - TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(10, 10), 1, GetTime()); + ui::TouchEventImpl release( + ui::ET_TOUCH_RELEASED, gfx::Point(10, 10), 1, GetTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_FALSE(cursor_client.IsCursorVisible()); diff --git a/ui/aura/shared/input_method_event_filter.cc b/ui/aura/shared/input_method_event_filter.cc index e4ff412..3ff57f8 100644 --- a/ui/aura/shared/input_method_event_filter.cc +++ b/ui/aura/shared/input_method_event_filter.cc @@ -5,8 +5,8 @@ #include "ui/aura/shared/input_method_event_filter.h" #include "ui/aura/client/aura_constants.h" -#include "ui/aura/event.h" #include "ui/aura/root_window.h" +#include "ui/base/event.h" #include "ui/base/ime/input_method.h" #include "ui/base/ime/input_method_factory.h" @@ -38,13 +38,13 @@ void InputMethodEventFilter::SetInputMethodPropertyInRootWindow( // InputMethodEventFilter, EventFilter implementation: bool InputMethodEventFilter::PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) { + ui::KeyEvent* event) { const ui::EventType type = event->type(); if (type == ui::ET_TRANSLATED_KEY_PRESS || type == ui::ET_TRANSLATED_KEY_RELEASE) { // The |event| is already handled by this object, change the type of the // event to ui::ET_KEY_* and pass it to the next filter. - static_cast<aura::TranslatedKeyEvent*>(event)->ConvertToKeyEvent(); + static_cast<ui::TranslatedKeyEvent*>(event)->ConvertToKeyEvent(); return false; } else { // If the focused window is changed, all requests to IME will be @@ -57,19 +57,19 @@ bool InputMethodEventFilter::PreHandleKeyEvent(aura::Window* target, } bool InputMethodEventFilter::PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) { + ui::MouseEvent* event) { return false; } ui::TouchStatus InputMethodEventFilter::PreHandleTouchEvent( aura::Window* target, - aura::TouchEvent* event) { + ui::TouchEventImpl* event) { return ui::TOUCH_STATUS_UNKNOWN; } ui::GestureStatus InputMethodEventFilter::PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) { + ui::GestureEventImpl* event) { return ui::GESTURE_STATUS_UNKNOWN; } @@ -81,7 +81,7 @@ void InputMethodEventFilter::DispatchKeyEventPostIME( #if defined(OS_WIN) DCHECK(event.message != WM_CHAR); #endif - aura::TranslatedKeyEvent aura_event(event, false /* is_char */); + ui::TranslatedKeyEvent aura_event(event, false /* is_char */); target_root_window_->AsRootWindowHostDelegate()->OnHostKeyEvent(&aura_event); } @@ -89,8 +89,8 @@ void InputMethodEventFilter::DispatchFabricatedKeyEventPostIME( ui::EventType type, ui::KeyboardCode key_code, int flags) { - aura::TranslatedKeyEvent aura_event(type == ui::ET_KEY_PRESSED, key_code, - flags); + ui::TranslatedKeyEvent aura_event(type == ui::ET_KEY_PRESSED, key_code, + flags); target_root_window_->AsRootWindowHostDelegate()->OnHostKeyEvent(&aura_event); } diff --git a/ui/aura/shared/input_method_event_filter.h b/ui/aura/shared/input_method_event_filter.h index ff82ede5..8806cb5 100644 --- a/ui/aura/shared/input_method_event_filter.h +++ b/ui/aura/shared/input_method_event_filter.h @@ -24,26 +24,25 @@ namespace shared { // An event filter that forwards a KeyEvent to a system IME, and dispatches a // TranslatedKeyEvent to the root window as needed. class AURA_EXPORT InputMethodEventFilter - : public aura::EventFilter, + : public EventFilter, public ui::internal::InputMethodDelegate { public: InputMethodEventFilter(); virtual ~InputMethodEventFilter(); - void SetInputMethodPropertyInRootWindow(aura::RootWindow* root_window); + void SetInputMethodPropertyInRootWindow(RootWindow* root_window); private: - // Overridden from aura::EventFilter: - virtual bool PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) OVERRIDE; - virtual bool PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) OVERRIDE; + // Overridden from EventFilter: + virtual bool PreHandleKeyEvent(Window* target, ui::KeyEvent* event) OVERRIDE; + virtual bool PreHandleMouseEvent(Window* target, + ui::MouseEvent* event) OVERRIDE; virtual ui::TouchStatus PreHandleTouchEvent( - aura::Window* target, - aura::TouchEvent* event) OVERRIDE; + Window* target, + ui::TouchEventImpl* event) OVERRIDE; virtual ui::GestureStatus PreHandleGestureEvent( - aura::Window* target, - aura::GestureEvent* event) OVERRIDE; + Window* target, + ui::GestureEventImpl* event) OVERRIDE; // Overridden from ui::internal::InputMethodDelegate. virtual void DispatchKeyEventPostIME(const base::NativeEvent& event) OVERRIDE; diff --git a/ui/aura/test/event_generator.cc b/ui/aura/test/event_generator.cc index 81400f7..5ee24bd 100644 --- a/ui/aura/test/event_generator.cc +++ b/ui/aura/test/event_generator.cc @@ -5,8 +5,8 @@ #include "ui/aura/test/event_generator.h" #include "base/memory/scoped_ptr.h" -#include "ui/aura/event.h" #include "ui/aura/root_window.h" +#include "ui/base/event.h" #if defined(USE_X11) #include <X11/Xlib.h> @@ -15,7 +15,7 @@ namespace { -class TestKeyEvent : public aura::KeyEvent { +class TestKeyEvent : public ui::KeyEvent { public: TestKeyEvent(const base::NativeEvent& native_event, int flags) : KeyEvent(native_event, false /* is_char */) { @@ -23,13 +23,13 @@ class TestKeyEvent : public aura::KeyEvent { } }; -class TestTouchEvent : public aura::TouchEvent { +class TestTouchEvent : public ui::TouchEventImpl { public: TestTouchEvent(ui::EventType type, const gfx::Point& root_location, int flags) - : TouchEvent(type, root_location, 0, - base::Time::NowFromSystemTime() - base::Time()) { + : TouchEventImpl(type, root_location, 0, + base::Time::NowFromSystemTime() - base::Time()) { set_flags(flags); } @@ -40,7 +40,7 @@ class TestTouchEvent : public aura::TouchEvent { gfx::Point CenterOfWindowInRootWindowCoordinate(aura::RootWindow* root_window, aura::Window* window) { gfx::Point center = window->bounds().CenterPoint(); - aura::Window::ConvertPointToWindow(window->parent(), root_window, ¢er); + aura::Window::ConvertPointToTarget(window->parent(), root_window, ¢er); return center; } @@ -73,16 +73,16 @@ EventGenerator::~EventGenerator() { void EventGenerator::PressLeftButton() { if ((flags_ & ui::EF_LEFT_MOUSE_BUTTON) == 0) { flags_ |= ui::EF_LEFT_MOUSE_BUTTON; - MouseEvent mouseev( - ui::ET_MOUSE_PRESSED, current_location_, current_location_, flags_); + ui::MouseEvent mouseev(ui::ET_MOUSE_PRESSED, current_location_, + current_location_, flags_); Dispatch(mouseev); } } void EventGenerator::ReleaseLeftButton() { if (flags_ & ui::EF_LEFT_MOUSE_BUTTON) { - MouseEvent mouseev( - ui::ET_MOUSE_RELEASED, current_location_, current_location_, flags_); + ui::MouseEvent mouseev(ui::ET_MOUSE_RELEASED, current_location_, + current_location_, flags_); Dispatch(mouseev); flags_ ^= ui::EF_LEFT_MOUSE_BUTTON; } @@ -108,7 +108,7 @@ void EventGenerator::MoveMouseTo(const gfx::Point& point, int count) { for (int i = 1; i <= count; i++) { const gfx::Point move_point = current_location_.Add( gfx::Point(diff.x() / count * i, diff.y() / count * i)); - MouseEvent mouseev(event_type, move_point, move_point, flags_); + ui::MouseEvent mouseev(event_type, move_point, move_point, flags_); Dispatch(mouseev); } current_location_ = point; @@ -117,7 +117,7 @@ void EventGenerator::MoveMouseTo(const gfx::Point& point, int count) { void EventGenerator::MoveMouseRelativeTo(const Window* window, const gfx::Point& point) { gfx::Point root_point(point); - aura::Window::ConvertPointToWindow(window, root_window_, &root_point); + Window::ConvertPointToTarget(window, root_window_, &root_point); MoveMouseTo(root_point); } @@ -162,22 +162,25 @@ void EventGenerator::PressMoveAndReleaseTouchToCenterOf(Window* window) { void EventGenerator::GestureTapAt(const gfx::Point& location) { const int kTouchId = 2; - TouchEvent press(ui::ET_TOUCH_PRESSED, location, kTouchId, - base::Time::NowFromSystemTime() - base::Time()); + ui::TouchEventImpl press(ui::ET_TOUCH_PRESSED, location, kTouchId, + base::Time::NowFromSystemTime() - base::Time()); Dispatch(press); - TouchEvent release(ui::ET_TOUCH_RELEASED, location, kTouchId, + ui::TouchEventImpl release( + ui::ET_TOUCH_RELEASED, location, kTouchId, press.time_stamp() + base::TimeDelta::FromMilliseconds(50)); Dispatch(release); } void EventGenerator::GestureTapDownAndUp(const gfx::Point& location) { const int kTouchId = 3; - TouchEvent press(ui::ET_TOUCH_PRESSED, location, kTouchId, + ui::TouchEventImpl press( + ui::ET_TOUCH_PRESSED, location, kTouchId, base::Time::NowFromSystemTime() - base::Time()); Dispatch(press); - TouchEvent release(ui::ET_TOUCH_RELEASED, location, kTouchId, + ui::TouchEventImpl release( + ui::ET_TOUCH_RELEASED, location, kTouchId, press.time_stamp() + base::TimeDelta::FromMilliseconds(1000)); Dispatch(release); } @@ -188,7 +191,7 @@ void EventGenerator::GestureScrollSequence(const gfx::Point& start, int steps) { const int kTouchId = 5; base::TimeDelta timestamp = base::Time::NowFromSystemTime() - base::Time(); - TouchEvent press(ui::ET_TOUCH_PRESSED, start, kTouchId, timestamp); + ui::TouchEventImpl press(ui::ET_TOUCH_PRESSED, start, kTouchId, timestamp); Dispatch(press); int dx = (end.x() - start.x()) / steps; @@ -197,11 +200,11 @@ void EventGenerator::GestureScrollSequence(const gfx::Point& start, for (int i = 0; i < steps; ++i) { location.Offset(dx, dy); timestamp += step_delay; - TouchEvent move(ui::ET_TOUCH_MOVED, location, kTouchId, timestamp); + ui::TouchEventImpl move(ui::ET_TOUCH_MOVED, location, kTouchId, timestamp); Dispatch(move); } - TouchEvent release(ui::ET_TOUCH_RELEASED, end, kTouchId, timestamp); + ui::TouchEventImpl release(ui::ET_TOUCH_RELEASED, end, kTouchId, timestamp); Dispatch(release); } @@ -222,7 +225,7 @@ void EventGenerator::GestureMultiFingerScroll(int count, base::TimeDelta press_time = base::Time::NowFromSystemTime() - base::Time(); for (int i = 0; i < count; ++i) { points[i] = start[i]; - TouchEvent press(ui::ET_TOUCH_PRESSED, points[i], i, press_time); + ui::TouchEventImpl press(ui::ET_TOUCH_PRESSED, points[i], i, press_time); Dispatch(press); } @@ -231,7 +234,7 @@ void EventGenerator::GestureMultiFingerScroll(int count, base::TimeDelta::FromMilliseconds(event_separation_time_ms * step); for (int i = 0; i < count; ++i) { points[i].Offset(delta_x, delta_y); - TouchEvent move(ui::ET_TOUCH_MOVED, points[i], i, move_time); + ui::TouchEventImpl move(ui::ET_TOUCH_MOVED, points[i], i, move_time); Dispatch(move); } } @@ -239,7 +242,8 @@ void EventGenerator::GestureMultiFingerScroll(int count, base::TimeDelta release_time = press_time + base::TimeDelta::FromMilliseconds(event_separation_time_ms * steps); for (int i = 0; i < count; ++i) { - TouchEvent release(ui::ET_TOUCH_RELEASED, points[i], i, release_time); + ui::TouchEventImpl release( + ui::ET_TOUCH_RELEASED, points[i], i, release_time); Dispatch(release); } } @@ -252,12 +256,12 @@ void EventGenerator::ReleaseKey(ui::KeyboardCode key_code, int flags) { DispatchKeyEvent(false, key_code, flags); } -void EventGenerator::Dispatch(Event& event) { +void EventGenerator::Dispatch(ui::Event& event) { switch (event.type()) { case ui::ET_KEY_PRESSED: case ui::ET_KEY_RELEASED: root_window_->AsRootWindowHostDelegate()->OnHostKeyEvent( - static_cast<KeyEvent*>(&event)); + static_cast<ui::KeyEvent*>(&event)); break; case ui::ET_MOUSE_PRESSED: case ui::ET_MOUSE_DRAGGED: @@ -267,7 +271,7 @@ void EventGenerator::Dispatch(Event& event) { case ui::ET_MOUSE_EXITED: case ui::ET_MOUSEWHEEL: root_window_->AsRootWindowHostDelegate()->OnHostMouseEvent( - static_cast<MouseEvent*>(&event)); + static_cast<ui::MouseEvent*>(&event)); break; case ui::ET_TOUCH_RELEASED: case ui::ET_TOUCH_PRESSED: @@ -275,7 +279,7 @@ void EventGenerator::Dispatch(Event& event) { case ui::ET_TOUCH_STATIONARY: case ui::ET_TOUCH_CANCELLED: root_window_->AsRootWindowHostDelegate()->OnHostTouchEvent( - static_cast<TouchEvent*>(&event)); + static_cast<ui::TouchEventImpl*>(&event)); break; default: NOTIMPLEMENTED(); @@ -297,7 +301,7 @@ void EventGenerator::DispatchKeyEvent(bool is_press, ui::InitXKeyEventForTesting(type, key_code, flags, native_event.get()); TestKeyEvent keyev(native_event.get(), flags); #else - KeyEvent keyev(type, key_code, flags); + ui::KeyEvent keyev(type, key_code, flags); #endif // USE_X11 #endif // OS_WIN Dispatch(keyev); diff --git a/ui/aura/test/event_generator.h b/ui/aura/test/event_generator.h index 6b36aa7..4d086c5 100644 --- a/ui/aura/test/event_generator.h +++ b/ui/aura/test/event_generator.h @@ -13,8 +13,11 @@ namespace base { class TimeDelta; } -namespace aura { +namespace ui { class Event; +} + +namespace aura { class RootWindow; class Window; @@ -165,7 +168,7 @@ class EventGenerator { void ReleaseKey(ui::KeyboardCode key_code, int flags); // Dispatch the |event| to the RootWindow. - void Dispatch(Event& event); + void Dispatch(ui::Event& event); private: // Dispatch a key event to the RootWindow. diff --git a/ui/aura/test/test_activation_client.cc b/ui/aura/test/test_activation_client.cc index 35b7532..b451efa 100644 --- a/ui/aura/test/test_activation_client.cc +++ b/ui/aura/test/test_activation_client.cc @@ -62,7 +62,7 @@ Window* TestActivationClient::GetActiveWindow() { } bool TestActivationClient::OnWillFocusWindow(Window* window, - const Event* event) { + const ui::Event* event) { return true; } diff --git a/ui/aura/test/test_activation_client.h b/ui/aura/test/test_activation_client.h index 2ab9f64..835df83 100644 --- a/ui/aura/test/test_activation_client.h +++ b/ui/aura/test/test_activation_client.h @@ -31,7 +31,8 @@ class TestActivationClient : public client::ActivationClient, virtual void ActivateWindow(Window* window) OVERRIDE; virtual void DeactivateWindow(Window* window) OVERRIDE; virtual Window* GetActiveWindow() OVERRIDE; - virtual bool OnWillFocusWindow(Window* window, const Event* event) OVERRIDE; + virtual bool OnWillFocusWindow(Window* window, + const ui::Event* event) OVERRIDE; virtual bool CanActivateWindow(Window* window) const OVERRIDE; // Overridden from WindowObserver: diff --git a/ui/aura/test/test_event_filter.cc b/ui/aura/test/test_event_filter.cc index 7f0b9437..421c9c4 100644 --- a/ui/aura/test/test_event_filter.cc +++ b/ui/aura/test/test_event_filter.cc @@ -25,25 +25,28 @@ void TestEventFilter::ResetCounts() { touch_event_count_ = 0; } -bool TestEventFilter::PreHandleKeyEvent(Window* target, KeyEvent* event) { +bool TestEventFilter::PreHandleKeyEvent(Window* target, ui::KeyEvent* event) { ++key_event_count_; return consumes_key_events_; } -bool TestEventFilter::PreHandleMouseEvent(Window* target, MouseEvent* event) { +bool TestEventFilter::PreHandleMouseEvent(Window* target, + ui::MouseEvent* event) { ++mouse_event_count_; return consumes_mouse_events_; } -ui::TouchStatus TestEventFilter::PreHandleTouchEvent(Window* target, - TouchEvent* event) { +ui::TouchStatus TestEventFilter::PreHandleTouchEvent( + Window* target, + ui::TouchEventImpl* event) { ++touch_event_count_; // TODO(sadrul): ! return ui::TOUCH_STATUS_UNKNOWN; } -ui::GestureStatus TestEventFilter::PreHandleGestureEvent(Window* target, - GestureEvent* event) { +ui::GestureStatus TestEventFilter::PreHandleGestureEvent( + Window* target, + ui::GestureEventImpl* event) { // TODO(sad): return ui::GESTURE_STATUS_UNKNOWN; } diff --git a/ui/aura/test/test_event_filter.h b/ui/aura/test/test_event_filter.h index aa27c64..c850fa9 100644 --- a/ui/aura/test/test_event_filter.h +++ b/ui/aura/test/test_event_filter.h @@ -39,12 +39,15 @@ class TestEventFilter : public EventFilter { } // Overridden from EventFilter: - virtual bool PreHandleKeyEvent(Window* target, KeyEvent* event) OVERRIDE; - virtual bool PreHandleMouseEvent(Window* target, MouseEvent* event) OVERRIDE; - virtual ui::TouchStatus PreHandleTouchEvent(Window* target, - TouchEvent* event) OVERRIDE; - virtual ui::GestureStatus PreHandleGestureEvent(Window* target, - GestureEvent* event) OVERRIDE; + virtual bool PreHandleKeyEvent(Window* target, ui::KeyEvent* event) OVERRIDE; + virtual bool PreHandleMouseEvent(Window* target, + ui::MouseEvent* event) OVERRIDE; + virtual ui::TouchStatus PreHandleTouchEvent( + Window* target, + ui::TouchEventImpl* event) OVERRIDE; + virtual ui::GestureStatus PreHandleGestureEvent( + Window* target, + ui::GestureEventImpl* event) OVERRIDE; private: int key_event_count_; diff --git a/ui/aura/test/test_window_delegate.cc b/ui/aura/test/test_window_delegate.cc index 2ba4f52..4e81a18 100644 --- a/ui/aura/test/test_window_delegate.cc +++ b/ui/aura/test/test_window_delegate.cc @@ -5,8 +5,8 @@ #include "ui/aura/test/test_window_delegate.h" #include "base/stringprintf.h" -#include "ui/aura/event.h" #include "ui/aura/window.h" +#include "ui/base/event.h" #include "ui/base/hit_test.h" #include "ui/gfx/canvas.h" #include "ui/gfx/path.h" @@ -38,7 +38,7 @@ void TestWindowDelegate::OnFocus(Window* old_focused_window) { void TestWindowDelegate::OnBlur() { } -bool TestWindowDelegate::OnKeyEvent(KeyEvent* event) { +bool TestWindowDelegate::OnKeyEvent(ui::KeyEvent* event) { return false; } @@ -56,15 +56,16 @@ bool TestWindowDelegate::ShouldDescendIntoChildForEventHandling( return true; } -bool TestWindowDelegate::OnMouseEvent(MouseEvent* event) { +bool TestWindowDelegate::OnMouseEvent(ui::MouseEvent* event) { return false; } -ui::TouchStatus TestWindowDelegate::OnTouchEvent(TouchEvent* event) { +ui::TouchStatus TestWindowDelegate::OnTouchEvent(ui::TouchEventImpl* event) { return ui::TOUCH_STATUS_UNKNOWN; } -ui::GestureStatus TestWindowDelegate::OnGestureEvent(GestureEvent* event) { +ui::GestureStatus TestWindowDelegate::OnGestureEvent( + ui::GestureEventImpl* event) { return ui::GESTURE_STATUS_UNKNOWN; } @@ -108,7 +109,7 @@ ColorTestWindowDelegate::ColorTestWindowDelegate(SkColor color) ColorTestWindowDelegate::~ColorTestWindowDelegate() { } -bool ColorTestWindowDelegate::OnKeyEvent(KeyEvent* event) { +bool ColorTestWindowDelegate::OnKeyEvent(ui::KeyEvent* event) { last_key_code_ = event->key_code(); return true; } @@ -147,7 +148,7 @@ EventCountDelegate::EventCountDelegate() key_release_count_(0) { } -bool EventCountDelegate::OnMouseEvent(MouseEvent* event) { +bool EventCountDelegate::OnMouseEvent(ui::MouseEvent* event) { switch (event->type()) { case ui::ET_MOUSE_MOVED: mouse_move_count_++; @@ -170,7 +171,7 @@ bool EventCountDelegate::OnMouseEvent(MouseEvent* event) { return false; } -bool EventCountDelegate::OnKeyEvent(KeyEvent* event) { +bool EventCountDelegate::OnKeyEvent(ui::KeyEvent* event) { switch (event->type()) { case ui::ET_KEY_PRESSED: key_press_count_++; diff --git a/ui/aura/test/test_window_delegate.h b/ui/aura/test/test_window_delegate.h index 1a10586..a23bc5d 100644 --- a/ui/aura/test/test_window_delegate.h +++ b/ui/aura/test/test_window_delegate.h @@ -31,15 +31,16 @@ class TestWindowDelegate : public WindowDelegate { const gfx::Rect& new_bounds) OVERRIDE; virtual void OnFocus(Window* old_focused_window) OVERRIDE; virtual void OnBlur() OVERRIDE; - virtual bool OnKeyEvent(KeyEvent* event) OVERRIDE; + virtual bool OnKeyEvent(ui::KeyEvent* event) OVERRIDE; virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE; virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE; virtual bool ShouldDescendIntoChildForEventHandling( Window* child, const gfx::Point& location) OVERRIDE; - virtual bool OnMouseEvent(MouseEvent* event) OVERRIDE; - virtual ui::TouchStatus OnTouchEvent(TouchEvent* event) OVERRIDE; - virtual ui::GestureStatus OnGestureEvent(GestureEvent* event) OVERRIDE; + virtual bool OnMouseEvent(ui::MouseEvent* event) OVERRIDE; + virtual ui::TouchStatus OnTouchEvent(ui::TouchEventImpl* event) OVERRIDE; + virtual ui::GestureStatus OnGestureEvent( + ui::GestureEventImpl* event) OVERRIDE; virtual bool CanFocus() OVERRIDE; virtual void OnCaptureLost() OVERRIDE; virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; @@ -66,7 +67,7 @@ class ColorTestWindowDelegate : public TestWindowDelegate { ui::KeyboardCode last_key_code() const { return last_key_code_; } // Overridden from TestWindowDelegate: - virtual bool OnKeyEvent(KeyEvent* event) OVERRIDE; + virtual bool OnKeyEvent(ui::KeyEvent* event) OVERRIDE; virtual void OnWindowDestroyed() OVERRIDE; virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; @@ -98,8 +99,8 @@ class EventCountDelegate : public TestWindowDelegate { EventCountDelegate(); // Overridden from TestWindowDelegate: - virtual bool OnMouseEvent(MouseEvent* event) OVERRIDE; - virtual bool OnKeyEvent(KeyEvent* event) OVERRIDE; + virtual bool OnMouseEvent(ui::MouseEvent* event) OVERRIDE; + virtual bool OnKeyEvent(ui::KeyEvent* event) OVERRIDE; // Returns the counts of mouse motion events in the // form of "<enter> <move> <leave>". diff --git a/ui/aura/window.cc b/ui/aura/window.cc index cfefe94..d125da1 100644 --- a/ui/aura/window.cc +++ b/ui/aura/window.cc @@ -19,7 +19,6 @@ #include "ui/aura/client/stacking_client.h" #include "ui/aura/client/visibility_client.h" #include "ui/aura/env.h" -#include "ui/aura/event.h" #include "ui/aura/event_filter.h" #include "ui/aura/focus_manager.h" #include "ui/aura/layout_manager.h" @@ -243,7 +242,7 @@ gfx::Rect Window::GetBoundsInRootWindow() const { if (!GetRootWindow()) return bounds(); gfx::Point origin = bounds().origin(); - Window::ConvertPointToWindow(parent_, GetRootWindow(), &origin); + ConvertPointToTarget(parent_, GetRootWindow(), &origin); return gfx::Rect(origin, bounds().size()); } @@ -432,7 +431,7 @@ const Window* Window::GetChildById(int id) const { } // static -void Window::ConvertPointToWindow(const Window* source, +void Window::ConvertPointToTarget(const Window* source, const Window* target, gfx::Point* point) { if (!source) @@ -459,7 +458,7 @@ void Window::MoveCursorTo(const gfx::Point& point_in_window) { RootWindow* root_window = GetRootWindow(); DCHECK(root_window); gfx::Point point_in_root(point_in_window); - ConvertPointToWindow(this, root_window, &point_in_root); + ConvertPointToTarget(this, root_window, &point_in_root); root_window->MoveCursorTo(point_in_root); } @@ -484,7 +483,7 @@ bool Window::ContainsPointInRoot(const gfx::Point& point_in_root) const { if (!root_window) return false; gfx::Point local_point(point_in_root); - ConvertPointToWindow(root_window, this, &local_point); + ConvertPointToTarget(root_window, this, &local_point); return gfx::Rect(GetTargetBounds().size()).Contains(local_point); } @@ -753,7 +752,7 @@ Window* Window::GetWindowForPoint(const gfx::Point& local_point, continue; gfx::Point point_in_child_coords(local_point); - Window::ConvertPointToWindow(this, child, &point_in_child_coords); + ConvertPointToTarget(this, child, &point_in_child_coords); if (for_event_handling && delegate_ && !delegate_->ShouldDescendIntoChildForEventHandling( child, local_point)) { diff --git a/ui/aura/window.h b/ui/aura/window.h index 6616b22..58a0f53 100644 --- a/ui/aura/window.h +++ b/ui/aura/window.h @@ -215,7 +215,7 @@ class AURA_EXPORT Window : public ui::LayerDelegate, // Converts |point| from |source|'s coordinates to |target|'s. If |source| is // NULL, the function returns without modifying |point|. |target| cannot be // NULL. - static void ConvertPointToWindow(const Window* source, + static void ConvertPointToTarget(const Window* source, const Window* target, gfx::Point* point); diff --git a/ui/aura/window_delegate.h b/ui/aura/window_delegate.h index 6549bed..f5cf12f 100644 --- a/ui/aura/window_delegate.h +++ b/ui/aura/window_delegate.h @@ -17,13 +17,14 @@ class Rect; class Size; } -namespace aura { - -class Event; -class GestureEvent; +namespace ui { +class GestureEventImpl; class KeyEvent; class MouseEvent; -class TouchEvent; +class TouchEventImpl; +} + +namespace aura { // Delegate interface for aura::Window. class AURA_EXPORT WindowDelegate { @@ -39,7 +40,7 @@ class AURA_EXPORT WindowDelegate { virtual void OnFocus(aura::Window* old_focused_window) = 0; virtual void OnBlur() = 0; - virtual bool OnKeyEvent(KeyEvent* event) = 0; + virtual bool OnKeyEvent(ui::KeyEvent* event) = 0; // Returns the native cursor for the specified point, in window coordinates, // or NULL for the default cursor. @@ -55,11 +56,11 @@ class AURA_EXPORT WindowDelegate { Window* child, const gfx::Point& location) = 0; - virtual bool OnMouseEvent(MouseEvent* event) = 0; + virtual bool OnMouseEvent(ui::MouseEvent* event) = 0; - virtual ui::TouchStatus OnTouchEvent(TouchEvent* event) = 0; + virtual ui::TouchStatus OnTouchEvent(ui::TouchEventImpl* event) = 0; - virtual ui::GestureStatus OnGestureEvent(GestureEvent* event) = 0; + virtual ui::GestureStatus OnGestureEvent(ui::GestureEventImpl* event) = 0; // Returns true of the window can be focused. virtual bool CanFocus() = 0; diff --git a/ui/aura/window_unittest.cc b/ui/aura/window_unittest.cc index 941684f..af8a470 100644 --- a/ui/aura/window_unittest.cc +++ b/ui/aura/window_unittest.cc @@ -13,7 +13,6 @@ #include "ui/aura/client/capture_client.h" #include "ui/aura/client/stacking_client.h" #include "ui/aura/client/visibility_client.h" -#include "ui/aura/event.h" #include "ui/aura/layout_manager.h" #include "ui/aura/root_window.h" #include "ui/aura/root_window_host.h" @@ -25,6 +24,7 @@ #include "ui/aura/window_delegate.h" #include "ui/aura/window_observer.h" #include "ui/aura/window_property.h" +#include "ui/base/event.h" #include "ui/base/gestures/gesture_configuration.h" #include "ui/base/hit_test.h" #include "ui/base/keycodes/keyboard_codes.h" @@ -164,17 +164,18 @@ class CaptureWindowDelegateImpl : public TestWindowDelegate { int touch_event_count() const { return touch_event_count_; } int gesture_event_count() const { return gesture_event_count_; } - virtual bool OnMouseEvent(MouseEvent* event) OVERRIDE { + virtual bool OnMouseEvent(ui::MouseEvent* event) OVERRIDE { if (event->type() == ui::ET_MOUSE_CAPTURE_CHANGED) capture_changed_event_count_++; mouse_event_count_++; return false; } - virtual ui::TouchStatus OnTouchEvent(TouchEvent* event) OVERRIDE { + virtual ui::TouchStatus OnTouchEvent(ui::TouchEventImpl* event) OVERRIDE { touch_event_count_++; return ui::TOUCH_STATUS_UNKNOWN; } - virtual ui::GestureStatus OnGestureEvent(GestureEvent* event) OVERRIDE { + virtual ui::GestureStatus OnGestureEvent( + ui::GestureEventImpl* event) OVERRIDE { gesture_event_count_++; return ui::GESTURE_STATUS_UNKNOWN; } @@ -216,7 +217,8 @@ class GestureTrackPositionDelegate : public TestWindowDelegate { public: GestureTrackPositionDelegate() {} - virtual ui::GestureStatus OnGestureEvent(GestureEvent* event) OVERRIDE { + virtual ui::GestureStatus OnGestureEvent( + ui::GestureEventImpl* event) OVERRIDE { position_ = event->location(); return ui::GESTURE_STATUS_CONSUMED; } @@ -294,7 +296,7 @@ TEST_F(WindowTest, ConvertPointToWindow) { scoped_ptr<Window> w1(CreateTestWindowWithId(1, NULL)); gfx::Point reference_point(100, 100); gfx::Point test_point = reference_point; - Window::ConvertPointToWindow(NULL, w1.get(), &test_point); + Window::ConvertPointToTarget(NULL, w1.get(), &test_point); EXPECT_EQ(reference_point, test_point); } @@ -753,7 +755,8 @@ TEST_F(WindowTest, CaptureTests) { EXPECT_EQ(2, delegate.mouse_event_count()); delegate.ResetCounts(); - TouchEvent touchev(ui::ET_TOUCH_PRESSED, gfx::Point(50, 50), 0, getTime()); + ui::TouchEventImpl touchev( + ui::ET_TOUCH_PRESSED, gfx::Point(50, 50), 0, getTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&touchev); EXPECT_EQ(1, delegate.touch_event_count()); delegate.ResetCounts(); @@ -768,7 +771,8 @@ TEST_F(WindowTest, CaptureTests) { generator.PressLeftButton(); EXPECT_EQ(1, delegate.mouse_event_count()); - TouchEvent touchev2(ui::ET_TOUCH_PRESSED, gfx::Point(250, 250), 1, getTime()); + ui::TouchEventImpl touchev2( + ui::ET_TOUCH_PRESSED, gfx::Point(250, 250), 1, getTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&touchev2); EXPECT_EQ(1, delegate.touch_event_count()); @@ -790,8 +794,8 @@ TEST_F(WindowTest, TouchCaptureCancelsOtherTouches) { &delegate2, 0, gfx::Rect(20, 20, 20, 20), NULL)); // Press on w1. - TouchEvent press(ui::ET_TOUCH_PRESSED, - gfx::Point(10, 10), 0, getTime()); + ui::TouchEventImpl press( + ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); // We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN. EXPECT_EQ(2, delegate1.gesture_event_count()); @@ -806,24 +810,23 @@ TEST_F(WindowTest, TouchCaptureCancelsOtherTouches) { delegate1.ResetCounts(); delegate2.ResetCounts(); - TouchEvent move(ui::ET_TOUCH_MOVED, - gfx::Point(10, 10), 0, getTime()); + ui::TouchEventImpl move(ui::ET_TOUCH_MOVED, gfx::Point(10, 10), 0, getTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move); // This touch id is now ignored, no scroll fired. EXPECT_EQ(0, delegate1.gesture_event_count()); EXPECT_EQ(0, delegate2.gesture_event_count()); - TouchEvent release(ui::ET_TOUCH_RELEASED, - gfx::Point(10, 10), 0, getTime()); + ui::TouchEventImpl release( + ui::ET_TOUCH_RELEASED, gfx::Point(10, 10), 0, getTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_EQ(0, delegate1.gesture_event_count()); EXPECT_EQ(0, delegate2.gesture_event_count()); // A new press is captured by w2. - TouchEvent press2(ui::ET_TOUCH_PRESSED, - gfx::Point(10, 10), 0, getTime()); + ui::TouchEventImpl press2( + ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); EXPECT_EQ(0, delegate1.gesture_event_count()); // We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN. @@ -835,8 +838,8 @@ TEST_F(WindowTest, TouchCaptureDoesntCancelCapturedTouches) { scoped_ptr<Window> window(CreateTestWindowWithDelegate( &delegate, 0, gfx::Rect(0, 0, 20, 20), NULL)); - TouchEvent press(ui::ET_TOUCH_PRESSED, - gfx::Point(10, 10), 0, getTime()); + ui::TouchEventImpl press( + ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); // We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN. @@ -849,9 +852,9 @@ TEST_F(WindowTest, TouchCaptureDoesntCancelCapturedTouches) { // The move event should still create a gesture, as this touch was // on the window which was captured. - TouchEvent release(ui::ET_TOUCH_RELEASED, - gfx::Point(10, 10), 0, getTime() + - base::TimeDelta::FromMilliseconds(50)); + ui::TouchEventImpl release(ui::ET_TOUCH_RELEASED, + gfx::Point(10, 10), 0, getTime() + + base::TimeDelta::FromMilliseconds(50)); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_EQ(2, delegate.gesture_event_count()); } @@ -862,7 +865,7 @@ TEST_F(WindowTest, TransferCaptureTouchEvents) { CaptureWindowDelegateImpl d1; scoped_ptr<Window> w1(CreateTestWindowWithDelegate( &d1, 0, gfx::Rect(0, 0, 20, 20), NULL)); - TouchEvent p1(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime()); + ui::TouchEventImpl p1(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&p1); // We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN. EXPECT_EQ(2, d1.gesture_event_count()); @@ -872,7 +875,7 @@ TEST_F(WindowTest, TransferCaptureTouchEvents) { CaptureWindowDelegateImpl d2; scoped_ptr<Window> w2(CreateTestWindowWithDelegate( &d2, 0, gfx::Rect(40, 0, 40, 20), NULL)); - TouchEvent p2(ui::ET_TOUCH_PRESSED, gfx::Point(41, 10), 1, getTime()); + ui::TouchEventImpl p2(ui::ET_TOUCH_PRESSED, gfx::Point(41, 10), 1, getTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&p2); EXPECT_EQ(0, d1.gesture_event_count()); // We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN for new target window. @@ -898,7 +901,7 @@ TEST_F(WindowTest, TransferCaptureTouchEvents) { // Move touch id originally associated with |w2|. Since capture was transfered // from 2 to 3 only |w3| should get the event. - TouchEvent m3(ui::ET_TOUCH_MOVED, gfx::Point(110, 105), 1, getTime()); + ui::TouchEventImpl m3(ui::ET_TOUCH_MOVED, gfx::Point(110, 105), 1, getTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&m3); EXPECT_EQ(0, d1.gesture_event_count()); EXPECT_EQ(0, d2.gesture_event_count()); @@ -986,7 +989,7 @@ class MouseEnterExitWindowDelegate : public TestWindowDelegate { public: MouseEnterExitWindowDelegate() : entered_(false), exited_(false) {} - virtual bool OnMouseEvent(MouseEvent* event) OVERRIDE { + virtual bool OnMouseEvent(ui::MouseEvent* event) OVERRIDE { switch (event->type()) { case ui::ET_MOUSE_ENTERED: entered_ = true; @@ -1310,8 +1313,8 @@ TEST_F(WindowTest, TransformGesture) { transform.ConcatTranslate(size.height(), 0); root_window()->SetTransform(transform); - TouchEvent press(ui::ET_TOUCH_PRESSED, - gfx::Point(size.height() - 10, 10), 0, getTime()); + ui::TouchEventImpl press( + ui::ET_TOUCH_PRESSED, gfx::Point(size.height() - 10, 10), 0, getTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); EXPECT_EQ(gfx::Point(10, 10).ToString(), delegate->position().ToString()); } diff --git a/ui/base/event.cc b/ui/base/event.cc index 1433f02..b25c09a 100644 --- a/ui/base/event.cc +++ b/ui/base/event.cc @@ -106,6 +106,12 @@ LocatedEvent::LocatedEvent(EventType type, root_location_(root_location) { } +LocatedEvent::LocatedEvent(const LocatedEvent& model) + : Event(model), + location_(model.location_), + root_location_(model.root_location_) { +} + void LocatedEvent::UpdateForRootTransform(const Transform& root_transform) { // Transform has to be done at root level. DCHECK_EQ(root_location_.x(), location_.x()); @@ -168,7 +174,7 @@ int MouseEvent::GetRepeatCount(const MouseEvent& event) { click_count = last_click_event_->GetClickCount() + 1; delete last_click_event_; } - last_click_event_ = new MouseEvent(event.native_event()); + last_click_event_ = new MouseEvent(event); if (click_count > 3) click_count = 3; last_click_event_->SetClickCount(click_count); @@ -215,6 +221,9 @@ void MouseEvent::SetClickCount(int click_count) { set_flags(f); } +MouseEvent::MouseEvent(const MouseEvent& model) : LocatedEvent(model) { +} + TouchEventImpl::TouchEventImpl(const base::NativeEvent& native_event) : LocatedEvent(native_event), touch_id_(ui::GetTouchId(native_event)), diff --git a/ui/base/event.h b/ui/base/event.h index 1e20fa1..86d5488 100644 --- a/ui/base/event.h +++ b/ui/base/event.h @@ -132,12 +132,11 @@ class UI_EXPORT LocatedEvent : public Event { const gfx::Point& root_location, int flags); + LocatedEvent(const LocatedEvent& model); + gfx::Point location_; gfx::Point root_location_; - - private: - DISALLOW_COPY_AND_ASSIGN(LocatedEvent); }; class UI_EXPORT MouseEvent : public LocatedEvent { @@ -183,14 +182,14 @@ class UI_EXPORT MouseEvent : public LocatedEvent { void SetClickCount(int click_count); private: + explicit MouseEvent(const MouseEvent& model); + gfx::Point root_location_; static MouseEvent* last_click_event_; // Returns the repeat count based on the previous mouse click, if it is // recent enough and within a small enough distance. static int GetRepeatCount(const MouseEvent& click_event); - - DISALLOW_COPY_AND_ASSIGN(MouseEvent); }; // TODO(beng): rename to TouchEvent after conversion is complete. diff --git a/ui/gfx/native_widget_types.h b/ui/gfx/native_widget_types.h index 243c0f5..7e33950 100644 --- a/ui/gfx/native_widget_types.h +++ b/ui/gfx/native_widget_types.h @@ -46,9 +46,11 @@ class SkRegion; namespace aura { -class Event; class Window; } +namespace ui { +class Event; +} #endif // defined(USE_AURA) #if defined(OS_WIN) @@ -101,7 +103,7 @@ typedef ui::Cursor NativeCursor; typedef aura::Window* NativeView; typedef aura::Window* NativeWindow; typedef SkRegion* NativeRegion; -typedef aura::Event* NativeEvent; +typedef ui::Event* NativeEvent; #elif defined(OS_WIN) typedef HCURSOR NativeCursor; typedef HWND NativeView; diff --git a/ui/views/controls/webview/web_dialog_view.cc b/ui/views/controls/webview/web_dialog_view.cc index c4d8282..2c6626a 100644 --- a/ui/views/controls/webview/web_dialog_view.cc +++ b/ui/views/controls/webview/web_dialog_view.cc @@ -24,7 +24,7 @@ #include "ui/web_dialogs/web_dialog_ui.h" #if defined(USE_AURA) -#include "ui/aura/event.h" +#include "ui/base/event.h" #include "ui/views/widget/native_widget_aura.h" #endif @@ -249,7 +249,7 @@ void WebDialogView::MoveContents(WebContents* source, const gfx::Rect& pos) { void WebDialogView::HandleKeyboardEvent(content::WebContents* source, const NativeWebKeyboardEvent& event) { #if defined(USE_AURA) - aura::KeyEvent aura_event(event.os_event->native_event(), false); + ui::KeyEvent aura_event(event.os_event->native_event(), false); views::NativeWidgetAura* aura_widget = static_cast<views::NativeWidgetAura*>(GetWidget()->native_widget()); aura_widget->OnKeyEvent(&aura_event); diff --git a/ui/views/drag_utils.cc b/ui/views/drag_utils.cc index 09812d9..f9efd2e 100644 --- a/ui/views/drag_utils.cc +++ b/ui/views/drag_utils.cc @@ -47,7 +47,7 @@ void RunShellDrag(gfx::NativeView view, #if defined(USE_AURA) gfx::Point root_location(location); aura::RootWindow* root_window = view->GetRootWindow(); - aura::Window::ConvertPointToWindow(view, root_window, &root_location); + aura::Window::ConvertPointToTarget(view, root_window, &root_location); if (aura::client::GetDragDropClient(root_window)) { aura::client::GetDragDropClient(root_window)->StartDragAndDrop( data, root_location, operation); diff --git a/ui/views/events/event.h b/ui/views/events/event.h index 433d5cf..1a518d3 100644 --- a/ui/views/events/event.h +++ b/ui/views/events/event.h @@ -1,3 +1,4 @@ + // Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -16,19 +17,15 @@ #include "ui/views/views_export.h" namespace ui { +class Event; class OSExchangeData; } -#if defined(USE_AURA) -namespace aura { -class Event; -} -#endif namespace views { #if defined(USE_AURA) -typedef aura::Event* NativeEvent; +typedef ui::Event* NativeEvent; #else typedef base::NativeEvent NativeEvent; #endif diff --git a/ui/views/events/event_aura.cc b/ui/views/events/event_aura.cc index 56793d7..f7a13d8 100644 --- a/ui/views/events/event_aura.cc +++ b/ui/views/events/event_aura.cc @@ -5,7 +5,7 @@ #include "ui/views/events/event.h" #include "base/logging.h" -#include "ui/aura/event.h" +#include "ui/base/event.h" #include "ui/base/keycodes/keyboard_code_conversion.h" namespace views { @@ -15,7 +15,7 @@ namespace views { LocatedEvent::LocatedEvent(const NativeEvent& native_event) : Event(native_event, native_event->type(), native_event->flags()), - location_(static_cast<aura::LocatedEvent*>(native_event)->location()) { + location_(static_cast<ui::LocatedEvent*>(native_event)->location()) { } //////////////////////////////////////////////////////////////////////////////// @@ -23,11 +23,12 @@ LocatedEvent::LocatedEvent(const NativeEvent& native_event) TouchEvent::TouchEvent(const NativeEvent& event) : LocatedEvent(event), - touch_id_(static_cast<aura::TouchEvent*>(event)->touch_id()), - radius_x_(static_cast<aura::TouchEvent*>(event)->radius_x()), - radius_y_(static_cast<aura::TouchEvent*>(event)->radius_y()), - rotation_angle_(static_cast<aura::TouchEvent*>(event)->rotation_angle()), - force_(static_cast<aura::TouchEvent*>(event)->force()) { + touch_id_(static_cast<ui::TouchEventImpl*>(event)->touch_id()), + radius_x_(static_cast<ui::TouchEventImpl*>(event)->radius_x()), + radius_y_(static_cast<ui::TouchEventImpl*>(event)->radius_y()), + rotation_angle_( + static_cast<ui::TouchEventImpl*>(event)->rotation_angle()), + force_(static_cast<ui::TouchEventImpl*>(event)->force()) { } //////////////////////////////////////////////////////////////////////////////// @@ -35,7 +36,7 @@ TouchEvent::TouchEvent(const NativeEvent& event) KeyEvent::KeyEvent(const NativeEvent& native_event) : Event(native_event, native_event->type(), native_event->flags()), - key_code_(static_cast<aura::KeyEvent*>(native_event)->key_code()), + key_code_(static_cast<ui::KeyEvent*>(native_event)->key_code()), character_(ui::GetCharacterFromKeyCode(key_code_, flags())), unmodified_character_(0) { } @@ -73,11 +74,11 @@ ScrollEvent::ScrollEvent(const NativeEvent& native_event) GestureEvent::GestureEvent(const NativeEvent& event) : LocatedEvent(event), - details_(static_cast<aura::GestureEvent*>(event)->details()) { + details_(static_cast<ui::GestureEventImpl*>(event)->details()) { } int GestureEvent::GetLowestTouchId() const { - return native_event() ? static_cast<aura::GestureEvent*>( + return native_event() ? static_cast<ui::GestureEventImpl*>( native_event())->GetLowestTouchId() : 0; } diff --git a/ui/views/view_unittest.cc b/ui/views/view_unittest.cc index 3759915..876a7712 100644 --- a/ui/views/view_unittest.cc +++ b/ui/views/view_unittest.cc @@ -40,7 +40,6 @@ #include "ui/views/test/test_views_delegate.h" #endif #if defined(USE_AURA) -#include "ui/aura/event.h" #include "ui/aura/root_window.h" #include "ui/base/gestures/gesture_recognizer.h" #endif diff --git a/ui/views/widget/desktop_native_widget_helper_aura.cc b/ui/views/widget/desktop_native_widget_helper_aura.cc index 8606789..3c12720 100644 --- a/ui/views/widget/desktop_native_widget_helper_aura.cc +++ b/ui/views/widget/desktop_native_widget_helper_aura.cc @@ -46,7 +46,7 @@ class DesktopScreenPositionClient virtual void ConvertPointToScreen(const aura::Window* window, gfx::Point* point) OVERRIDE { const aura::RootWindow* root_window = window->GetRootWindow(); - aura::Window::ConvertPointToWindow(window, root_window, point); + aura::Window::ConvertPointToTarget(window, root_window, point); gfx::Point origin = root_window->GetHostOrigin(); point->Offset(origin.x(), origin.y()); } @@ -56,14 +56,14 @@ class DesktopScreenPositionClient const aura::RootWindow* root_window = window->GetRootWindow(); gfx::Point origin = root_window->GetHostOrigin(); point->Offset(-origin.x(), -origin.y()); - aura::Window::ConvertPointToWindow(root_window, window, point); + aura::Window::ConvertPointToTarget(root_window, window, point); } virtual void SetBounds(aura::Window* window, const gfx::Rect& bounds) OVERRIDE { gfx::Point origin = bounds.origin(); aura::RootWindow* root = window->GetRootWindow(); - aura::Window::ConvertPointToWindow(window->parent(), root, &origin); + aura::Window::ConvertPointToTarget(window->parent(), root, &origin); #if !defined(OS_WIN) if (window->type() == aura::client::WINDOW_TYPE_CONTROL) { diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc index 6de58a7..a26e75d 100644 --- a/ui/views/widget/native_widget_aura.cc +++ b/ui/views/widget/native_widget_aura.cc @@ -16,11 +16,11 @@ #include "ui/aura/client/window_move_client.h" #include "ui/aura/client/window_types.h" #include "ui/aura/env.h" -#include "ui/aura/event.h" #include "ui/aura/focus_manager.h" #include "ui/aura/root_window.h" #include "ui/aura/window.h" #include "ui/aura/window_observer.h" +#include "ui/base/event.h" #include "ui/base/dragdrop/os_exchange_data.h" #include "ui/base/ui_base_types.h" #include "ui/compositor/layer.h" @@ -387,7 +387,7 @@ void NativeWidgetAura::CenterWindow(const gfx::Size& size) { // Convert the bounds back relative to the parent. gfx::Point origin = window_bounds.origin(); - aura::Window::ConvertPointToWindow(window_->GetRootWindow(), + aura::Window::ConvertPointToTarget(window_->GetRootWindow(), window_->parent(), &origin); window_bounds.set_origin(origin); window_->SetBounds(window_bounds); @@ -734,7 +734,7 @@ void NativeWidgetAura::OnBlur() { delegate_->OnNativeBlur(window_->GetFocusManager()->GetFocusedWindow()); } -bool NativeWidgetAura::OnKeyEvent(aura::KeyEvent* event) { +bool NativeWidgetAura::OnKeyEvent(ui::KeyEvent* event) { if (event->is_char()) { // If a ui::InputMethod object is attached to the root window, character // events are handled inside the object and are not passed to this function. @@ -791,14 +791,14 @@ bool NativeWidgetAura::ShouldDescendIntoChildForEventHandling( return true; } -bool NativeWidgetAura::OnMouseEvent(aura::MouseEvent* event) { +bool NativeWidgetAura::OnMouseEvent(ui::MouseEvent* event) { DCHECK(window_->IsVisible()); if (event->type() == ui::ET_MOUSEWHEEL) { MouseWheelEvent wheel_event(event); return delegate_->OnMouseEvent(wheel_event); } if (event->type() == ui::ET_SCROLL) { - ScrollEvent scroll_event(static_cast<aura::ScrollEvent*>(event)); + ScrollEvent scroll_event(static_cast<ui::ScrollEvent*>(event)); if (delegate_->OnMouseEvent(scroll_event)) return true; @@ -812,13 +812,14 @@ bool NativeWidgetAura::OnMouseEvent(aura::MouseEvent* event) { return delegate_->OnMouseEvent(mouse_event); } -ui::TouchStatus NativeWidgetAura::OnTouchEvent(aura::TouchEvent* event) { +ui::TouchStatus NativeWidgetAura::OnTouchEvent(ui::TouchEventImpl* event) { DCHECK(window_->IsVisible()); TouchEvent touch_event(event); return delegate_->OnTouchEvent(touch_event); } -ui::GestureStatus NativeWidgetAura::OnGestureEvent(aura::GestureEvent* event) { +ui::GestureStatus NativeWidgetAura::OnGestureEvent( + ui::GestureEventImpl* event) { DCHECK(window_->IsVisible()); GestureEvent gesture_event(event); return delegate_->OnGestureEvent(gesture_event); @@ -871,7 +872,7 @@ void NativeWidgetAura::GetHitTestMask(gfx::Path* mask) const { //////////////////////////////////////////////////////////////////////////////// // NativeWidgetAura, aura::ActivationDelegate implementation: -bool NativeWidgetAura::ShouldActivate(const aura::Event* event) { +bool NativeWidgetAura::ShouldActivate(const ui::Event* event) { return can_activate_ && delegate_->CanActivate(); } @@ -894,13 +895,13 @@ void NativeWidgetAura::OnLostActive() { //////////////////////////////////////////////////////////////////////////////// // NativeWidgetAura, aura::WindowDragDropDelegate implementation: -void NativeWidgetAura::OnDragEntered(const aura::DropTargetEvent& event) { +void NativeWidgetAura::OnDragEntered(const ui::DropTargetEvent& event) { DCHECK(drop_helper_.get() != NULL); last_drop_operation_ = drop_helper_->OnDragOver(event.data(), event.location(), event.source_operations()); } -int NativeWidgetAura::OnDragUpdated(const aura::DropTargetEvent& event) { +int NativeWidgetAura::OnDragUpdated(const ui::DropTargetEvent& event) { DCHECK(drop_helper_.get() != NULL); last_drop_operation_ = drop_helper_->OnDragOver(event.data(), event.location(), event.source_operations()); @@ -912,7 +913,7 @@ void NativeWidgetAura::OnDragExited() { drop_helper_->OnDragExit(); } -int NativeWidgetAura::OnPerformDrop(const aura::DropTargetEvent& event) { +int NativeWidgetAura::OnPerformDrop(const ui::DropTargetEvent& event) { DCHECK(drop_helper_.get() != NULL); return drop_helper_->OnDrop(event.data(), event.location(), last_drop_operation_); diff --git a/ui/views/widget/native_widget_aura.h b/ui/views/widget/native_widget_aura.h index 6a60174..3d8e5ca 100644 --- a/ui/views/widget/native_widget_aura.h +++ b/ui/views/widget/native_widget_aura.h @@ -132,15 +132,16 @@ class VIEWS_EXPORT NativeWidgetAura : public internal::NativeWidgetPrivate, const gfx::Rect& new_bounds) OVERRIDE; virtual void OnFocus(aura::Window* old_focused_window) OVERRIDE; virtual void OnBlur() OVERRIDE; - virtual bool OnKeyEvent(aura::KeyEvent* event) OVERRIDE; + virtual bool OnKeyEvent(ui::KeyEvent* event) OVERRIDE; virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE; virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE; virtual bool ShouldDescendIntoChildForEventHandling( aura::Window* child, const gfx::Point& location) OVERRIDE; - virtual bool OnMouseEvent(aura::MouseEvent* event) OVERRIDE; - virtual ui::TouchStatus OnTouchEvent(aura::TouchEvent* event) OVERRIDE; - virtual ui::GestureStatus OnGestureEvent(aura::GestureEvent* event) OVERRIDE; + virtual bool OnMouseEvent(ui::MouseEvent* event) OVERRIDE; + virtual ui::TouchStatus OnTouchEvent(ui::TouchEventImpl* event) OVERRIDE; + virtual ui::GestureStatus OnGestureEvent( + ui::GestureEventImpl* event) OVERRIDE; virtual bool CanFocus() OVERRIDE; virtual void OnCaptureLost() OVERRIDE; virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; @@ -152,15 +153,15 @@ class VIEWS_EXPORT NativeWidgetAura : public internal::NativeWidgetPrivate, virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE; // Overridden from aura::client::ActivationDelegate: - virtual bool ShouldActivate(const aura::Event* event) OVERRIDE; + virtual bool ShouldActivate(const ui::Event* event) OVERRIDE; virtual void OnActivated() OVERRIDE; virtual void OnLostActive() OVERRIDE; // Overridden from aura::client::DragDropDelegate: - virtual void OnDragEntered(const aura::DropTargetEvent& event) OVERRIDE; - virtual int OnDragUpdated(const aura::DropTargetEvent& event) OVERRIDE; + virtual void OnDragEntered(const ui::DropTargetEvent& event) OVERRIDE; + virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; virtual void OnDragExited() OVERRIDE; - virtual int OnPerformDrop(const aura::DropTargetEvent& event) OVERRIDE; + virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE; protected: virtual ~NativeWidgetAura(); diff --git a/ui/views/widget/native_widget_aura_unittest.cc b/ui/views/widget/native_widget_aura_unittest.cc index 8068d3b..a7f0176 100644 --- a/ui/views/widget/native_widget_aura_unittest.cc +++ b/ui/views/widget/native_widget_aura_unittest.cc @@ -11,11 +11,11 @@ #include "testing/gtest/include/gtest/gtest.h" #include "ui/aura/aura_switches.h" #include "ui/aura/env.h" -#include "ui/aura/event.h" #include "ui/aura/layout_manager.h" #include "ui/aura/root_window.h" #include "ui/aura/test/aura_test_helper.h" #include "ui/aura/window.h" +#include "ui/base/event.h" #include "ui/gfx/screen.h" #include "ui/views/layout/fill_layout.h" #include "ui/views/widget/root_view.h" @@ -252,8 +252,8 @@ TEST_F(NativeWidgetAuraTest, DontCaptureOnGesture) { widget->SetContentsView(view); widget->Show(); - aura::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(41, 51), 1, - base::TimeDelta()); + ui::TouchEventImpl press(ui::ET_TOUCH_PRESSED, gfx::Point(41, 51), 1, + base::TimeDelta()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); // Both views should get the press. EXPECT_TRUE(view->got_gesture_event()); @@ -265,8 +265,8 @@ TEST_F(NativeWidgetAuraTest, DontCaptureOnGesture) { // Release touch. Only |view| should get the release since that it consumed // the press. - aura::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(250, 251), 1, - base::TimeDelta()); + ui::TouchEventImpl release(ui::ET_TOUCH_RELEASED, gfx::Point(250, 251), 1, + base::TimeDelta()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_TRUE(view->got_gesture_event()); EXPECT_FALSE(child->got_gesture_event()); @@ -287,8 +287,8 @@ TEST_F(NativeWidgetAuraTest, ReleaseCaptureOnTouchRelease) { widget->SetContentsView(view); widget->Show(); - aura::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(41, 51), 1, - base::TimeDelta()); + ui::TouchEventImpl press(ui::ET_TOUCH_PRESSED, gfx::Point(41, 51), 1, + base::TimeDelta()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); EXPECT_TRUE(view->got_gesture_event()); view->clear_got_gesture_event(); @@ -297,8 +297,8 @@ TEST_F(NativeWidgetAuraTest, ReleaseCaptureOnTouchRelease) { EXPECT_TRUE(widget->HasCapture()); // Generate a release, this should trigger releasing capture. - aura::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(41, 51), 1, - base::TimeDelta()); + ui::TouchEventImpl release(ui::ET_TOUCH_RELEASED, gfx::Point(41, 51), 1, + base::TimeDelta()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_TRUE(view->got_gesture_event()); view->clear_got_gesture_event(); diff --git a/ui/views/widget/tooltip_manager_aura.cc b/ui/views/widget/tooltip_manager_aura.cc index c8d6342..0636dae 100644 --- a/ui/views/widget/tooltip_manager_aura.cc +++ b/ui/views/widget/tooltip_manager_aura.cc @@ -55,7 +55,7 @@ void TooltipManagerAura::UpdateTooltip() { aura::RootWindow* root_window = window->GetRootWindow(); if (aura::client::GetTooltipClient(root_window)) { gfx::Point view_point = root_window->GetLastMouseLocationInRoot(); - aura::Window::ConvertPointToWindow(root_window, window, &view_point); + aura::Window::ConvertPointToTarget(root_window, window, &view_point); View* view = GetViewUnderPoint(view_point); if (view) { View::ConvertPointFromWidget(view, &view_point); @@ -73,7 +73,7 @@ void TooltipManagerAura::TooltipTextChanged(View* view) { aura::RootWindow* root_window = window->GetRootWindow(); if (aura::client::GetTooltipClient(root_window)) { gfx::Point view_point = root_window->GetLastMouseLocationInRoot(); - aura::Window::ConvertPointToWindow(root_window, window, &view_point); + aura::Window::ConvertPointToTarget(root_window, window, &view_point); View* target = GetViewUnderPoint(view_point); if (target != view) return; diff --git a/ui/views/widget/widget_message_filter.cc b/ui/views/widget/widget_message_filter.cc index 557ce07..3cee32d4 100644 --- a/ui/views/widget/widget_message_filter.cc +++ b/ui/views/widget/widget_message_filter.cc @@ -7,7 +7,6 @@ #include "base/event_types.h" #include "base/win/win_util.h" #include "base/win/windows_version.h" -#include "ui/aura/event.h" #include "ui/aura/root_window.h" #include "ui/base/win/hwnd_util.h" #include "ui/gfx/canvas_skia_paint.h" diff --git a/ui/views/widget/x11_window_event_filter.cc b/ui/views/widget/x11_window_event_filter.cc index 4956c51..133f871 100644 --- a/ui/views/widget/x11_window_event_filter.cc +++ b/ui/views/widget/x11_window_event_filter.cc @@ -13,6 +13,7 @@ #include "ui/aura/desktop/desktop_activation_client.h" #include "ui/aura/root_window.h" #include "ui/aura/window_delegate.h" +#include "ui/base/event.h" #include "ui/base/hit_test.h" #include "ui/views/widget/native_widget_aura.h" @@ -90,12 +91,12 @@ void X11WindowEventFilter::SetUseHostWindowBorders(bool use_os_border) { } bool X11WindowEventFilter::PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) { + ui::KeyEvent* event) { return false; } bool X11WindowEventFilter::PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) { + ui::MouseEvent* event) { if (event->type() != ui::ET_MOUSE_PRESSED) return false; @@ -130,13 +131,13 @@ bool X11WindowEventFilter::PreHandleMouseEvent(aura::Window* target, ui::TouchStatus X11WindowEventFilter::PreHandleTouchEvent( aura::Window* target, - aura::TouchEvent* event) { + ui::TouchEventImpl* event) { return ui::TOUCH_STATUS_UNKNOWN; } ui::GestureStatus X11WindowEventFilter::PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) { + ui::GestureEventImpl* event) { return ui::GESTURE_STATUS_UNKNOWN; } diff --git a/ui/views/widget/x11_window_event_filter.h b/ui/views/widget/x11_window_event_filter.h index 935d7e4..41b06e9 100644 --- a/ui/views/widget/x11_window_event_filter.h +++ b/ui/views/widget/x11_window_event_filter.h @@ -11,7 +11,6 @@ #include "base/compiler_specific.h" #include "base/message_loop.h" -#include "ui/aura/event.h" #include "ui/aura/event_filter.h" #include "ui/aura/x11_atom_cache.h" #include "ui/views/views_export.h" @@ -39,14 +38,15 @@ class VIEWS_EXPORT X11WindowEventFilter : public aura::EventFilter { // Overridden from EventFilter: virtual bool PreHandleKeyEvent(aura::Window* target, - aura::KeyEvent* event) OVERRIDE; + ui::KeyEvent* event) OVERRIDE; virtual bool PreHandleMouseEvent(aura::Window* target, - aura::MouseEvent* event) OVERRIDE; - virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, - aura::TouchEvent* event) OVERRIDE; + ui::MouseEvent* event) OVERRIDE; + virtual ui::TouchStatus PreHandleTouchEvent( + aura::Window* target, + ui::TouchEventImpl* event) OVERRIDE; virtual ui::GestureStatus PreHandleGestureEvent( aura::Window* target, - aura::GestureEvent* event) OVERRIDE; + ui::GestureEventImpl* event) OVERRIDE; private: // Dispatches a _NET_WM_MOVERESIZE message to the window manager to tell it |