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

Unified Diff: ui/wm/core/easy_resize_window_targeter.cc

Issue 115453004: Moves management of transients out of Window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove unneeded parens Created 6 years, 11 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 | « ui/views/widget/native_widget_aura.cc ('k') | ui/wm/public/easy_resize_window_targeter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/wm/core/easy_resize_window_targeter.cc
diff --git a/ui/wm/core/easy_resize_window_targeter.cc b/ui/wm/core/easy_resize_window_targeter.cc
index f3a2b0a77ebcdb09506581d4daa95ca4b2d2c4de..1f0e90a0eb8ea47f2a580ecd46ca03456b11d188 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
« no previous file with comments | « ui/views/widget/native_widget_aura.cc ('k') | ui/wm/public/easy_resize_window_targeter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698