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

Unified Diff: ui/aura_shell/stacking_controller.cc

Issue 8926004: Revert 114095 - Move the concept of Activation to the Shell. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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/aura_shell/stacking_controller.h ('k') | ui/aura_shell/stacking_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « ui/aura_shell/stacking_controller.h ('k') | ui/aura_shell/stacking_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698