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

Unified Diff: trunk/src/ui/aura/window_tree_host.cc

Issue 188843003: Revert 255368 "Clean up WindowEventDispatcher some more." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « trunk/src/ui/aura/window_tree_host.h ('k') | trunk/src/ui/aura/window_tree_host_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/ui/aura/window_tree_host.cc
===================================================================
--- trunk/src/ui/aura/window_tree_host.cc (revision 255398)
+++ trunk/src/ui/aura/window_tree_host.cc (working copy)
@@ -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,18 +84,7 @@
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) {
return reinterpret_cast<WindowTreeHost*>(
@@ -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,7 +282,7 @@
// 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() {
@@ -291,19 +290,6 @@
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) {
MoveCursorToNative(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
« no previous file with comments | « trunk/src/ui/aura/window_tree_host.h ('k') | trunk/src/ui/aura/window_tree_host_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698