Index: ui/aura/root_window.cc |
=================================================================== |
--- ui/aura/root_window.cc (revision 150582) |
+++ ui/aura/root_window.cc (working copy) |
@@ -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 @@ |
compositor_->ScheduleFullDraw(); |
} |
-bool RootWindow::DispatchGestureEvent(GestureEvent* event) { |
+bool RootWindow::DispatchGestureEvent(ui::GestureEventImpl* event) { |
DispatchHeldMouseMove(); |
Window* target = client::GetCaptureWindow(this); |
@@ -284,7 +284,8 @@ |
} |
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 @@ |
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 @@ |
//////////////////////////////////////////////////////////////////////////////// |
// 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 @@ |
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 @@ |
} |
ui::TouchStatus RootWindow::ProcessTouchEvent(Window* target, |
- TouchEvent* event) { |
+ ui::TouchEventImpl* event) { |
if (!target->IsVisible()) |
return ui::TOUCH_STATUS_UNKNOWN; |
@@ -652,7 +659,7 @@ |
} |
ui::GestureStatus RootWindow::ProcessGestureEvent(Window* target, |
- GestureEvent* event) { |
+ ui::GestureEventImpl* event) { |
if (!target->IsVisible()) |
return ui::GESTURE_STATUS_UNKNOWN; |
@@ -681,8 +688,8 @@ |
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 @@ |
} |
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 @@ |
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 @@ |
//////////////////////////////////////////////////////////////////////////////// |
// 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 @@ |
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 @@ |
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 @@ |
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 @@ |
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, 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 @@ |
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 @@ |
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 @@ |
// 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 |
} |