diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-07 19:52:52 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-07 19:52:52 +0000 |
commit | 751b13df3b768295e4b215aca45b9f1ea8bd373c (patch) | |
tree | 50660265c2fe6a4e81d834117c2e1f5a03d50a0e /ui/wm | |
parent | 691b2001018e28625ceeb0d4710472ff66ef9857 (diff) | |
download | chromium_src-751b13df3b768295e4b215aca45b9f1ea8bd373c.zip chromium_src-751b13df3b768295e4b215aca45b9f1ea8bd373c.tar.gz chromium_src-751b13df3b768295e4b215aca45b9f1ea8bd373c.tar.bz2 |
Moves management of transients out of Window
And into TransientWindowManager. Additionally moves handling of NULL
layer stacking into TransientStackingWindowClient. The tests that were
exercising these code paths have all been moved to ui/views/corewm.
Also wires up TransientStackingWindowClient in a couple of places that
didn't have it.
The order of removing from transient parent as well as destroying of
transient children is slightly differently than before. To get the
order exactly as it was would require some new specific observer
functions. I'm hoping we don't need those. Hopefully this doesn't
cause issues, if it does I'll revisit.
I ended up exposing convenience functions. That's because typing
something like:
views::corewm::TransientWindowManager::Get(window)->AddTransientChild()
was too much for me. There is also some subtlety in so far as the
Get() function that takes a const Window* may return NULL, where as
non-const never returns NULL.
Lastly I had to make Window friend TransientWindowManager. This is
temporary until I create a specific TransientWindowManagerObserver
that contains the two transient related observer functions in
WindowObserver.
BUG=none
TEST=none
R=ben@chromium.org
Review URL: https://codereview.chromium.org/115453004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243368 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/wm')
-rw-r--r-- | ui/wm/core/easy_resize_window_targeter.cc | 20 | ||||
-rw-r--r-- | ui/wm/public/easy_resize_window_targeter.h | 4 |
2 files changed, 20 insertions, 4 deletions
diff --git a/ui/wm/core/easy_resize_window_targeter.cc b/ui/wm/core/easy_resize_window_targeter.cc index f3a2b0a..1f0e90a 100644 --- a/ui/wm/core/easy_resize_window_targeter.cc +++ b/ui/wm/core/easy_resize_window_targeter.cc @@ -4,6 +4,7 @@ #include "ui/wm/public/easy_resize_window_targeter.h" +#include "ui/aura/client/transient_window_client.h" #include "ui/aura/window.h" #include "ui/gfx/geometry/insets_f.h" #include "ui/gfx/geometry/rect.h" @@ -25,10 +26,7 @@ EasyResizeWindowTargeter::~EasyResizeWindowTargeter() { bool EasyResizeWindowTargeter::EventLocationInsideBounds( aura::Window* window, const ui::LocatedEvent& event) const { - // Use the extended bounds only for immediate child windows of |container_|. - // Use the default targetter otherwise. - if (window->parent() == container_ && (!window->transient_parent() || - window->transient_parent() == container_)) { + if (ShouldUseExtendedBounds(window)) { gfx::RectF bounds(window->bounds()); gfx::Transform transform = window->layer()->transform(); transform.TransformRect(&bounds); @@ -45,4 +43,18 @@ bool EasyResizeWindowTargeter::EventLocationInsideBounds( return WindowTargeter::EventLocationInsideBounds(window, event); } +bool EasyResizeWindowTargeter::ShouldUseExtendedBounds( + const aura::Window* window) const { + // Use the extended bounds only for immediate child windows of |container_|. + // Use the default targetter otherwise. + if (window->parent() != container_) + return false; + + aura::client::TransientWindowClient* transient_window_client = + aura::client::GetTransientWindowClient(); + return !transient_window_client || + !transient_window_client->GetTransientParent(window) || + transient_window_client->GetTransientParent(window) == container_; +} + } // namespace wm diff --git a/ui/wm/public/easy_resize_window_targeter.h b/ui/wm/public/easy_resize_window_targeter.h index c4c7137..f873509 100644 --- a/ui/wm/public/easy_resize_window_targeter.h +++ b/ui/wm/public/easy_resize_window_targeter.h @@ -36,6 +36,10 @@ class EasyResizeWindowTargeter : public aura::WindowTargeter { const ui::LocatedEvent& event) const OVERRIDE; private: + // Returns true if the hit testing (EventLocationInsideBounds()) should use + // the extended bounds. + bool ShouldUseExtendedBounds(const aura::Window* window) const; + aura::Window* container_; gfx::Insets mouse_extend_; gfx::Insets touch_extend_; |