Index: ui/aura_shell/stacking_controller.cc |
=================================================================== |
--- ui/aura_shell/stacking_controller.cc (revision 114099) |
+++ ui/aura_shell/stacking_controller.cc (working copy) |
@@ -19,6 +19,14 @@ |
return Shell::GetInstance()->GetContainer(id); |
} |
+// Returns true if children of |window| can be activated. |
+bool SupportsChildActivation(aura::Window* window) { |
+ return window->id() == kShellWindowId_DefaultContainer || |
+ window->id() == kShellWindowId_AlwaysOnTopContainer || |
+ window->id() == kShellWindowId_ModalContainer || |
+ window->id() == kShellWindowId_LockModalContainer; |
+} |
+ |
bool IsWindowModal(aura::Window* window) { |
return window->transient_parent() && window->GetIntProperty(aura::kModalKey); |
} |
@@ -42,6 +50,23 @@ |
GetContainer(internal::kShellWindowId_AlwaysOnTopContainer)); |
} |
+// static |
+aura::Window* StackingController::GetActivatableWindow(aura::Window* window) { |
+ aura::Window* parent = window->parent(); |
+ aura::Window* child = window; |
+ while (parent) { |
+ if (SupportsChildActivation(parent)) |
+ return child; |
+ // If |child| isn't activatable, but has transient parent, trace |
+ // that path instead. |
+ if (child->transient_parent()) |
+ return GetActivatableWindow(child->transient_parent()); |
+ parent = parent->parent(); |
+ child = child->parent(); |
+ } |
+ return NULL; |
+} |
+ |
//////////////////////////////////////////////////////////////////////////////// |
// StackingController, aura::StackingClient implementation: |
@@ -68,6 +93,24 @@ |
parent->AddChild(window); |
} |
+bool StackingController::CanActivateWindow(aura::Window* window) const { |
+ return window && SupportsChildActivation(window->parent()); |
+} |
+ |
+aura::Window* StackingController::GetTopmostWindowToActivate( |
+ aura::Window* ignore) const { |
+ const aura::Window* container = GetContainer(kShellWindowId_DefaultContainer); |
+ for (aura::Window::Windows::const_reverse_iterator i = |
+ container->children().rbegin(); |
+ i != container->children().rend(); |
+ ++i) { |
+ if (*i != ignore && (*i)->CanActivate()) |
+ return *i; |
+ } |
+ return NULL; |
+} |
+ |
+ |
//////////////////////////////////////////////////////////////////////////////// |
// StackingController, private: |
Property changes on: ui\aura_shell\stacking_controller.cc |
___________________________________________________________________ |
Added: svn:mergeinfo |