| Index: ui/aura/window_tree_host.cc
|
| diff --git a/ui/aura/window_tree_host.cc b/ui/aura/window_tree_host.cc
|
| index 93c624b174b9a6a0b97ddd574095c8df6cf7c66e..2f60c7c3a732431dd9074f2487e899d934474005 100644
|
| --- a/ui/aura/window_tree_host.cc
|
| +++ b/ui/aura/window_tree_host.cc
|
| @@ -5,13 +5,13 @@
|
| #include "ui/aura/window_tree_host.h"
|
|
|
| #include "base/debug/trace_event.h"
|
| -#include "ui/aura/client/capture_client.h"
|
| #include "ui/aura/client/cursor_client.h"
|
| #include "ui/aura/env.h"
|
| #include "ui/aura/root_window_transformer.h"
|
| #include "ui/aura/window.h"
|
| #include "ui/aura/window_event_dispatcher.h"
|
| #include "ui/aura/window_targeter.h"
|
| +#include "ui/aura/window_tree_host_delegate.h"
|
| #include "ui/aura/window_tree_host_observer.h"
|
| #include "ui/base/view_prop.h"
|
| #include "ui/compositor/dip_util.h"
|
| @@ -84,17 +84,6 @@
|
| DCHECK(!compositor_) << "compositor must be destroyed before root window";
|
| }
|
|
|
| -#if defined(OS_ANDROID)
|
| -// static
|
| -WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds) {
|
| - // This is only hit for tests and ash, right now these aren't an issue so
|
| - // adding the CHECK.
|
| - // TODO(sky): decide if we want a factory.
|
| - CHECK(false);
|
| - return NULL;
|
| -}
|
| -#endif
|
| -
|
| // static
|
| WindowTreeHost* WindowTreeHost::GetForAcceleratedWidget(
|
| gfx::AcceleratedWidget widget) {
|
| @@ -105,7 +94,7 @@
|
| void WindowTreeHost::InitHost() {
|
| InitCompositor();
|
| UpdateRootWindowSize(GetBounds().size());
|
| - Env::GetInstance()->NotifyRootWindowInitialized(dispatcher());
|
| + Env::GetInstance()->NotifyRootWindowInitialized(delegate_->AsDispatcher());
|
| window()->Show();
|
| }
|
|
|
| @@ -198,8 +187,8 @@
|
| // visible because that can only happen in response to a mouse event, which
|
| // will trigger its own mouse enter.
|
| if (!show) {
|
| - dispatcher()->DispatchMouseExitAtPoint(
|
| - dispatcher()->GetLastMouseLocationInRoot());
|
| + delegate_->AsDispatcher()->DispatchMouseExitAtPoint(
|
| + delegate_->AsDispatcher()->GetLastMouseLocationInRoot());
|
| }
|
|
|
| OnCursorVisibilityChangedNative(show);
|
| @@ -217,11 +206,16 @@
|
| MoveCursorToInternal(root_location, host_location);
|
| }
|
|
|
| +WindowEventDispatcher* WindowTreeHost::GetDispatcher() {
|
| + return delegate_->AsDispatcher();
|
| +}
|
| +
|
| ////////////////////////////////////////////////////////////////////////////////
|
| // WindowTreeHost, protected:
|
|
|
| WindowTreeHost::WindowTreeHost()
|
| - : window_(new Window(NULL)),
|
| + : delegate_(NULL),
|
| + window_(new Window(NULL)),
|
| last_cursor_(ui::kCursorNull) {
|
| }
|
|
|
| @@ -231,6 +225,10 @@
|
| }
|
|
|
| void WindowTreeHost::DestroyDispatcher() {
|
| + // An observer may have been added by an animation on the
|
| + // WindowEventDispatcher.
|
| + window()->layer()->GetAnimator()->RemoveObserver(dispatcher());
|
| +
|
| delete window_;
|
| window_ = NULL;
|
| dispatcher_.reset();
|
| @@ -262,6 +260,7 @@
|
| this));
|
| dispatcher_.reset(new WindowEventDispatcher(this));
|
| }
|
| + delegate_ = dispatcher();
|
| }
|
|
|
| void WindowTreeHost::OnHostMoved(const gfx::Point& new_location) {
|
| @@ -283,26 +282,13 @@
|
| // transformed size of the root window.
|
| UpdateRootWindowSize(layer_size);
|
| FOR_EACH_OBSERVER(WindowTreeHostObserver, observers_, OnHostResized(this));
|
| - dispatcher()->OnHostResized(layer_size);
|
| + delegate_->OnHostResized(layer_size);
|
| }
|
|
|
| void WindowTreeHost::OnHostCloseRequested() {
|
| FOR_EACH_OBSERVER(WindowTreeHostObserver, observers_,
|
| OnHostCloseRequested(this));
|
| }
|
| -
|
| -void WindowTreeHost::OnHostActivated() {
|
| - Env::GetInstance()->RootWindowActivated(dispatcher());
|
| -}
|
| -
|
| -void WindowTreeHost::OnHostLostWindowCapture() {
|
| - Window* capture_window = client::GetCaptureWindow(window());
|
| - if (capture_window && capture_window->GetRootWindow() == window())
|
| - capture_window->ReleaseCapture();
|
| -}
|
| -
|
| -////////////////////////////////////////////////////////////////////////////////
|
| -// WindowTreeHost, private:
|
|
|
| void WindowTreeHost::MoveCursorToInternal(const gfx::Point& root_location,
|
| const gfx::Point& host_location) {
|
| @@ -313,7 +299,18 @@
|
| gfx::Screen::GetScreenFor(window())->GetDisplayNearestWindow(window());
|
| cursor_client->SetDisplay(display);
|
| }
|
| - dispatcher()->OnCursorMovedToRootLocation(root_location);
|
| -}
|
| + delegate_->OnCursorMovedToRootLocation(root_location);
|
| +}
|
| +
|
| +#if defined(OS_ANDROID)
|
| +// static
|
| +WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds) {
|
| + // This is only hit for tests and ash, right now these aren't an issue so
|
| + // adding the CHECK.
|
| + // TODO(sky): decide if we want a factory.
|
| + CHECK(false);
|
| + return NULL;
|
| +}
|
| +#endif
|
|
|
| } // namespace aura
|
|
|