summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-20 23:08:58 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-20 23:08:58 +0000
commit392cb7bd8a59088f06b4ba41ec6225bcd2e36e93 (patch)
tree56a62969ac4ff0c14d8bce47787575ef928f648b /ash
parent218b229ae37b3ec8abcc6e13dd02d7d4b22c9f16 (diff)
downloadchromium_src-392cb7bd8a59088f06b4ba41ec6225bcd2e36e93.zip
chromium_src-392cb7bd8a59088f06b4ba41ec6225bcd2e36e93.tar.gz
chromium_src-392cb7bd8a59088f06b4ba41ec6225bcd2e36e93.tar.bz2
Stack un-parented control windows in their own container. This prevents them from interfering in existing window layout heuristics/animations.
BUG=none TEST=existing Review URL: https://chromiumcodereview.appspot.com/9138026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118541 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/shell.cc8
-rw-r--r--ash/shell_window_ids.h26
-rw-r--r--ash/wm/stacking_controller.cc7
-rw-r--r--ash/wm/toplevel_layout_manager.cc17
4 files changed, 32 insertions, 26 deletions
diff --git a/ash/shell.cc b/ash/shell.cc
index 9480898..5a631b0 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -67,6 +67,11 @@ const int kCompactWindowModeWidthThreshold = 1366;
// the z-index.
void CreateSpecialContainers(aura::Window::Windows* containers,
bool is_window_mode_compact) {
+ aura::Window* unparented_control_container = new aura::Window(NULL);
+ unparented_control_container->set_id(
+ internal::kShellWindowId_UnparentedControlContainer);
+ containers->push_back(unparented_control_container);
+
aura::Window* background_container = new aura::Window(NULL);
background_container->set_id(
internal::kShellWindowId_DesktopBackgroundContainer);
@@ -242,7 +247,8 @@ void Shell::Init() {
for (i = containers.begin(); i != containers.end(); ++i) {
(*i)->Init(ui::Layer::LAYER_HAS_NO_TEXTURE);
root_window->AddChild(*i);
- (*i)->Show();
+ if ((*i)->id() != internal::kShellWindowId_UnparentedControlContainer)
+ (*i)->Show();
}
stacking_controller_.reset(new internal::StackingController);
diff --git a/ash/shell_window_ids.h b/ash/shell_window_ids.h
index 6376ef7..fcca022 100644
--- a/ash/shell_window_ids.h
+++ b/ash/shell_window_ids.h
@@ -12,39 +12,43 @@ namespace ash {
namespace internal {
+// A container used for windows of WINDOW_TYPE_CONTROL that have no parent.
+// This container is not visible.
+const int kShellWindowId_UnparentedControlContainer = 0;
+
// The desktop background window.
-const int kShellWindowId_DesktopBackgroundContainer = 0;
+const int kShellWindowId_DesktopBackgroundContainer = 1;
// The container for standard top-level windows.
-const int kShellWindowId_DefaultContainer = 1;
+const int kShellWindowId_DefaultContainer = 2;
// The container for top-level windows with the 'always-on-top' flag set.
-const int kShellWindowId_AlwaysOnTopContainer = 2;
+const int kShellWindowId_AlwaysOnTopContainer = 3;
// The container for panel windows.
-const int kShellWindowId_PanelContainer = 3;
+const int kShellWindowId_PanelContainer = 4;
// The container for the launcher.
-const int kShellWindowId_LauncherContainer = 4;
+const int kShellWindowId_LauncherContainer = 5;
// The container for user-specific modal windows.
-const int kShellWindowId_SystemModalContainer = 5;
+const int kShellWindowId_SystemModalContainer = 6;
// The container for the lock screen.
-const int kShellWindowId_LockScreenContainer = 6;
+const int kShellWindowId_LockScreenContainer = 7;
// The container for the lock screen modal windows.
-const int kShellWindowId_LockSystemModalContainer = 7;
+const int kShellWindowId_LockSystemModalContainer = 8;
// The container for the status area.
-const int kShellWindowId_StatusContainer = 8;
+const int kShellWindowId_StatusContainer = 9;
// The container for menus and tooltips.
-const int kShellWindowId_MenuAndTooltipContainer = 9;
+const int kShellWindowId_MenuAndTooltipContainer = 10;
// The container for bubbles briefly overlaid onscreen to show settings changes
// (volume, brightness, etc.).
-const int kShellWindowId_SettingBubbleContainer = 10;
+const int kShellWindowId_SettingBubbleContainer = 11;
} // namespace internal
diff --git a/ash/wm/stacking_controller.cc b/ash/wm/stacking_controller.cc
index 51f8216..e3d34c2 100644
--- a/ash/wm/stacking_controller.cc
+++ b/ash/wm/stacking_controller.cc
@@ -48,11 +48,6 @@ aura::Window* StackingController::GetDefaultParent(aura::Window* window) {
switch (window->type()) {
case aura::client::WINDOW_TYPE_NORMAL:
case aura::client::WINDOW_TYPE_POPUP:
- // TODO(beng): control windows with NULL parents should be parented to a
- // unique, probably hidden, container. Adding here now for
- // compatibility, since these windows were WINDOW_TYPE_POPUP
- // until now.
- case aura::client::WINDOW_TYPE_CONTROL:
if (IsSystemModal(window))
return GetSystemModalContainer(window);
return always_on_top_controller_->GetContainer(window);
@@ -61,6 +56,8 @@ aura::Window* StackingController::GetDefaultParent(aura::Window* window) {
case aura::client::WINDOW_TYPE_MENU:
case aura::client::WINDOW_TYPE_TOOLTIP:
return GetContainer(internal::kShellWindowId_MenuAndTooltipContainer);
+ case aura::client::WINDOW_TYPE_CONTROL:
+ return GetContainer(internal::kShellWindowId_UnparentedControlContainer);
default:
NOTREACHED() << "Window " << window->id()
<< " has unhandled type " << window->type();
diff --git a/ash/wm/toplevel_layout_manager.cc b/ash/wm/toplevel_layout_manager.cc
index 30fac07..f954309 100644
--- a/ash/wm/toplevel_layout_manager.cc
+++ b/ash/wm/toplevel_layout_manager.cc
@@ -53,6 +53,8 @@ void ToplevelLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
}
void ToplevelLayoutManager::OnWillRemoveWindowFromLayout(aura::Window* child) {
+ DCHECK(child->type() == aura::client::WINDOW_TYPE_NORMAL ||
+ child->type() == aura::client::WINDOW_TYPE_POPUP);
BaseLayoutManager::OnWillRemoveWindowFromLayout(child);
UpdateShelfVisibility();
}
@@ -60,15 +62,12 @@ void ToplevelLayoutManager::OnWillRemoveWindowFromLayout(aura::Window* child) {
void ToplevelLayoutManager::OnChildWindowVisibilityChanged(aura::Window* child,
bool visible) {
BaseLayoutManager::OnChildWindowVisibilityChanged(child, visible);
- if (child->type() == aura::client::WINDOW_TYPE_NORMAL ||
- child->type() == aura::client::WINDOW_TYPE_POPUP) {
- if (visible) {
- AnimateShowWindow(child);
- } else {
- // Don't start hiding the window again if it's already being hidden.
- if (child->layer()->GetTargetOpacity() != 0.0f)
- AnimateHideWindow(child);
- }
+ if (visible) {
+ AnimateShowWindow(child);
+ } else {
+ // Don't start hiding the window again if it's already being hidden.
+ if (child->layer()->GetTargetOpacity() != 0.0f)
+ AnimateHideWindow(child);
}
UpdateShelfVisibility();
}