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

Unified Diff: ash/wm/workspace/workspace_layout_manager.cc

Issue 9764008: Makes the launcher auto-hide for maximized windows. This turned out to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add null checks and cleanup Created 8 years, 9 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
Index: ash/wm/workspace/workspace_layout_manager.cc
diff --git a/ash/wm/workspace/workspace_layout_manager.cc b/ash/wm/workspace/workspace_layout_manager.cc
index 6773d52b5234a6c5d33192b89b5b5110868f422c..455facce36d92898431413229e69364d125ac5bb 100644
--- a/ash/wm/workspace/workspace_layout_manager.cc
+++ b/ash/wm/workspace/workspace_layout_manager.cc
@@ -96,14 +96,13 @@ void WorkspaceLayoutManager::SetChildBounds(
BaseLayoutManager::SetChildBounds(child, requested_bounds);
else
SetChildBoundsDirect(child, requested_bounds);
-}
-
-void WorkspaceLayoutManager::OnRootWindowResized(const gfx::Size& new_size) {
- workspace_manager_->SetWorkspaceSize(new_size);
+ workspace_manager_->UpdateShelfVisibility();
}
void WorkspaceLayoutManager::OnMonitorWorkAreaInsetsChanged() {
- workspace_manager_->OnMonitorWorkAreaInsetsChanged();
+ // The workspace is currently the only one that updates the shelf, so we can
+ // safely ignore this. If we don't there are timing issues when transitioning
+ // between maximized/fullscreen windows and normal windows.
}
void WorkspaceLayoutManager::OnWindowPropertyChanged(aura::Window* window,
@@ -112,35 +111,7 @@ void WorkspaceLayoutManager::OnWindowPropertyChanged(aura::Window* window,
BaseLayoutManager::OnWindowPropertyChanged(window, key, old);
if (key == aura::client::kShowStateKey &&
workspace_manager_->IsManagedWindow(window)) {
- ui::WindowShowState last_show_state = static_cast<ui::WindowShowState>(old);
- if (wm::IsWindowMinimized(window)) {
- // Save the previous show state so that we can correctly restore it.
- window->SetProperty(kRestoreShowStateKey, last_show_state);
- workspace_manager_->RemoveWindow(window);
- SetWindowVisibilityAnimationType(
- window, WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE);
-
- // Effectively hide the window.
- window->Hide();
- // Activate another window.
- if (wm::IsActiveWindow(window))
- wm::DeactivateWindow(window);
- return;
- }
- // We can end up here if the window was minimized and we are transitioning
- // to another state. In that case the window is hidden.
- if ((window->TargetVisibility() ||
- (last_show_state == ui::SHOW_STATE_MINIMIZED)) &&
- !workspace_manager_->IsManagingWindow(window)) {
- workspace_manager_->AddWindow(window);
- if (!window->layer()->visible()) {
- // The layer may be hidden if the window was previously minimized. Make
- // sure it's visible.
- window->Show();
- }
- return;
- }
- workspace_manager_->ShowStateChanged(window);
+ ShowStateChanged(window, static_cast<ui::WindowShowState>(old));
} else if (key == ash::kWindowTrackedByWorkspaceSplitPropKey &&
ash::GetTrackedByWorkspace(window)) {
// We currently don't need to support transitioning from true to false, so
@@ -149,5 +120,38 @@ void WorkspaceLayoutManager::OnWindowPropertyChanged(aura::Window* window,
}
}
+void WorkspaceLayoutManager::ShowStateChanged(
+ aura::Window* window,
+ ui::WindowShowState last_show_state) {
+ if (wm::IsWindowMinimized(window)) {
+ // Save the previous show state so that we can correctly restore it.
+ window->SetProperty(kRestoreShowStateKey, last_show_state);
+ workspace_manager_->RemoveWindow(window);
+ SetWindowVisibilityAnimationType(
+ window, WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE);
+
+ // Hide the window.
+ window->Hide();
+ // Activate another window.
+ if (wm::IsActiveWindow(window))
+ wm::DeactivateWindow(window);
+ return;
+ }
+ // We can end up here if the window was minimized and we are transitioning
+ // to another state. In that case the window is hidden.
+ if ((window->TargetVisibility() ||
+ (last_show_state == ui::SHOW_STATE_MINIMIZED)) &&
+ !workspace_manager_->IsManagingWindow(window)) {
+ workspace_manager_->AddWindow(window);
+ if (!window->layer()->visible()) {
+ // The layer may be hidden if the window was previously minimized. Make
+ // sure it's visible.
+ window->Show();
+ }
+ return;
+ }
+ workspace_manager_->ShowStateChanged(window);
+}
+
} // namespace internal
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698