OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/wm/workspace/workspace_manager2.h" | 5 #include "ash/wm/workspace/workspace_manager2.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 | 9 |
10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 } | 194 } |
195 | 195 |
196 void WorkspaceManager2::SetActiveWorkspaceByWindow(Window* window) { | 196 void WorkspaceManager2::SetActiveWorkspaceByWindow(Window* window) { |
197 Workspace2* workspace = FindBy(window); | 197 Workspace2* workspace = FindBy(window); |
198 if (!workspace) | 198 if (!workspace) |
199 return; | 199 return; |
200 | 200 |
201 if (workspace != active_workspace_) { | 201 if (workspace != active_workspace_) { |
202 // If the window persists across all workspaces, move it to the current | 202 // If the window persists across all workspaces, move it to the current |
203 // workspace. | 203 // workspace. |
204 if (GetPersistsAcrossAllWorkspaces(window) && !IsMaximized(window)) | 204 // A popup which was first maximized, is minimized and getts restored has |
| 205 // to go through the SetActiveWorkspace since it persists across workspaces |
| 206 // and is not (yet) maximized (see crbug.com/151698). |
| 207 if (GetPersistsAcrossAllWorkspaces(window) && !IsMaximized(window) && |
| 208 !(wm::IsWindowMinimized(window) && WillRestoreMaximized(window))) |
205 ReparentWindow(window, active_workspace_->window(), NULL); | 209 ReparentWindow(window, active_workspace_->window(), NULL); |
206 else | 210 else |
207 SetActiveWorkspace(workspace, ANIMATE_OLD_AND_NEW); | 211 SetActiveWorkspace(workspace, ANIMATE_OLD_AND_NEW); |
208 } | 212 } |
209 } | 213 } |
210 | 214 |
211 Window* WorkspaceManager2::GetParentForNewWindow(Window* window) { | 215 Window* WorkspaceManager2::GetParentForNewWindow(Window* window) { |
212 // Try to put windows with transient parents in the same workspace as their | 216 // Try to put windows with transient parents in the same workspace as their |
213 // transient parent. | 217 // transient parent. |
214 if (window->transient_parent() && !IsMaximized(window)) { | 218 if (window->transient_parent() && !IsMaximized(window)) { |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 if (last_show_state == ui::SHOW_STATE_MINIMIZED) | 572 if (last_show_state == ui::SHOW_STATE_MINIMIZED) |
569 SetUnminimizingWorkspace(new_workspace ? new_workspace : workspace); | 573 SetUnminimizingWorkspace(new_workspace ? new_workspace : workspace); |
570 DCHECK(!old_layer); | 574 DCHECK(!old_layer); |
571 } | 575 } |
572 } | 576 } |
573 UpdateShelfVisibility(); | 577 UpdateShelfVisibility(); |
574 } | 578 } |
575 | 579 |
576 } // namespace internal | 580 } // namespace internal |
577 } // namespace ash | 581 } // namespace ash |
OLD | NEW |