Index: trunk/src/ui/aura/window_event_dispatcher.cc |
=================================================================== |
--- trunk/src/ui/aura/window_event_dispatcher.cc (revision 255398) |
+++ trunk/src/ui/aura/window_event_dispatcher.cc (working copy) |
@@ -4,7 +4,10 @@ |
#include "ui/aura/window_event_dispatcher.h" |
+#include <vector> |
+ |
#include "base/bind.h" |
+#include "base/command_line.h" |
#include "base/debug/trace_event.h" |
#include "base/logging.h" |
#include "base/message_loop/message_loop.h" |
@@ -21,10 +24,15 @@ |
#include "ui/aura/window_tree_host.h" |
#include "ui/base/hit_test.h" |
#include "ui/compositor/dip_util.h" |
+#include "ui/compositor/layer.h" |
+#include "ui/compositor/layer_animator.h" |
#include "ui/events/event.h" |
#include "ui/events/gestures/gesture_recognizer.h" |
#include "ui/events/gestures/gesture_types.h" |
+#include "ui/gfx/screen.h" |
+using std::vector; |
+ |
typedef ui::EventDispatchDetails DispatchDetails; |
namespace aura { |
@@ -121,6 +129,10 @@ |
} |
} |
+WindowTreeHostDelegate* WindowEventDispatcher::AsWindowTreeHostDelegate() { |
+ return this; |
+} |
+ |
void WindowEventDispatcher::OnMouseEventsEnableStateChanged(bool enabled) { |
// Send entered / exited so that visual state can be updated to match |
// mouse events state. |
@@ -128,17 +140,6 @@ |
// TODO(mazda): Add code to disable mouse events when |enabled| == false. |
} |
-void WindowEventDispatcher::DispatchCancelModeEvent() { |
- ui::CancelModeEvent event; |
- Window* focused_window = client::GetFocusClient(window())->GetFocusedWindow(); |
- if (focused_window && !window()->Contains(focused_window)) |
- focused_window = NULL; |
- DispatchDetails details = |
- DispatchEvent(focused_window ? focused_window : window(), &event); |
- if (details.dispatcher_destroyed) |
- return; |
-} |
- |
Window* WindowEventDispatcher::GetGestureTarget(ui::GestureEvent* event) { |
Window* target = NULL; |
if (!event->IsEndingEvent()) { |
@@ -274,34 +275,6 @@ |
return location; |
} |
-void WindowEventDispatcher::OnHostLostMouseGrab() { |
- mouse_pressed_handler_ = NULL; |
- mouse_moved_handler_ = NULL; |
-} |
- |
-void WindowEventDispatcher::OnHostResized(const gfx::Size& size) { |
- TRACE_EVENT1("ui", "WindowEventDispatcher::OnHostResized", |
- "size", size.ToString()); |
- |
- DispatchDetails details = DispatchHeldEvents(); |
- if (details.dispatcher_destroyed) |
- return; |
- |
- // Constrain the mouse position within the new root Window size. |
- gfx::Point point; |
- if (host_->QueryMouseLocation(&point)) { |
- SetLastMouseLocation(window(), |
- ui::ConvertPointToDIP(window()->layer(), point)); |
- } |
- synthesize_mouse_move_ = false; |
-} |
- |
-void WindowEventDispatcher::OnCursorMovedToRootLocation( |
- const gfx::Point& root_location) { |
- SetLastMouseLocation(window(), root_location); |
- synthesize_mouse_move_ = false; |
-} |
- |
//////////////////////////////////////////////////////////////////////////////// |
// WindowEventDispatcher, private: |
@@ -583,6 +556,86 @@ |
} |
//////////////////////////////////////////////////////////////////////////////// |
+// WindowEventDispatcher, ui::LayerAnimationObserver implementation: |
+ |
+void WindowEventDispatcher::OnLayerAnimationEnded( |
+ ui::LayerAnimationSequence* animation) { |
+ host()->UpdateRootWindowSize(host_->GetBounds().size()); |
+} |
+ |
+void WindowEventDispatcher::OnLayerAnimationScheduled( |
+ ui::LayerAnimationSequence* animation) { |
+} |
+ |
+void WindowEventDispatcher::OnLayerAnimationAborted( |
+ ui::LayerAnimationSequence* animation) { |
+} |
+ |
+//////////////////////////////////////////////////////////////////////////////// |
+// WindowEventDispatcher, WindowTreeHostDelegate implementation: |
+ |
+void WindowEventDispatcher::OnHostCancelMode() { |
+ ui::CancelModeEvent event; |
+ Window* focused_window = client::GetFocusClient(window())->GetFocusedWindow(); |
+ if (focused_window && !window()->Contains(focused_window)) |
+ focused_window = NULL; |
+ DispatchDetails details = |
+ DispatchEvent(focused_window ? focused_window : window(), &event); |
+ if (details.dispatcher_destroyed) |
+ return; |
+} |
+ |
+void WindowEventDispatcher::OnHostActivated() { |
+ Env::GetInstance()->RootWindowActivated(this); |
+} |
+ |
+void WindowEventDispatcher::OnHostLostWindowCapture() { |
+ Window* capture_window = client::GetCaptureWindow(window()); |
+ if (capture_window && capture_window->GetRootWindow() == window()) |
+ capture_window->ReleaseCapture(); |
+} |
+ |
+void WindowEventDispatcher::OnHostLostMouseGrab() { |
+ mouse_pressed_handler_ = NULL; |
+ mouse_moved_handler_ = NULL; |
+} |
+ |
+void WindowEventDispatcher::OnHostResized(const gfx::Size& size) { |
+ TRACE_EVENT1("ui", "WindowEventDispatcher::OnHostResized", |
+ "size", size.ToString()); |
+ |
+ DispatchDetails details = DispatchHeldEvents(); |
+ if (details.dispatcher_destroyed) |
+ return; |
+ |
+ // Constrain the mouse position within the new root Window size. |
+ gfx::Point point; |
+ if (host_->QueryMouseLocation(&point)) { |
+ SetLastMouseLocation(window(), |
+ ui::ConvertPointToDIP(window()->layer(), point)); |
+ } |
+ synthesize_mouse_move_ = false; |
+} |
+ |
+void WindowEventDispatcher::OnCursorMovedToRootLocation( |
+ const gfx::Point& root_location) { |
+ SetLastMouseLocation(window(), root_location); |
+ synthesize_mouse_move_ = false; |
+} |
+ |
+WindowEventDispatcher* WindowEventDispatcher::AsDispatcher() { |
+ return this; |
+} |
+ |
+const WindowEventDispatcher* WindowEventDispatcher::AsDispatcher() const { |
+ return this; |
+} |
+ |
+ui::EventProcessor* WindowEventDispatcher::GetEventProcessor() { |
+ return this; |
+} |
+ |
+//////////////////////////////////////////////////////////////////////////////// |
// WindowEventDispatcher, private: |
ui::EventDispatchDetails WindowEventDispatcher::DispatchHeldEvents() { |