| 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_layout_manager.h" | 5 #include "ash/wm/workspace/workspace_layout_manager.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/screen_ash.h" | 8 #include "ash/screen_ash.h" |
| 9 #include "ash/session_state_delegate.h" | 9 #include "ash/session_state_delegate.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 typedef std::map<const aura::Window*, gfx::Rect> BoundsMap; | 41 typedef std::map<const aura::Window*, gfx::Rect> BoundsMap; |
| 42 | 42 |
| 43 // Adds an entry from |window| to its bounds and recursively invokes this for | 43 // Adds an entry from |window| to its bounds and recursively invokes this for |
| 44 // all children. | 44 // all children. |
| 45 void BuildWindowBoundsMap(const aura::Window* window, BoundsMap* bounds_map) { | 45 void BuildWindowBoundsMap(const aura::Window* window, BoundsMap* bounds_map) { |
| 46 (*bounds_map)[window] = window->bounds(); | 46 (*bounds_map)[window] = window->bounds(); |
| 47 for (size_t i = 0; i < window->children().size(); ++i) | 47 for (size_t i = 0; i < window->children().size(); ++i) |
| 48 BuildWindowBoundsMap(window->children()[i], bounds_map); | 48 BuildWindowBoundsMap(window->children()[i], bounds_map); |
| 49 } | 49 } |
| 50 | 50 |
| 51 // Resets |window|s bounds from |bounds_map| if currently empty. Recusively | 51 // Resets |window|s bounds from |bounds_map| if currently empty. Recursively |
| 52 // invokes this for all children. | 52 // invokes this for all children. |
| 53 void ResetBoundsIfNecessary(const BoundsMap& bounds_map, aura::Window* window) { | 53 void ResetBoundsIfNecessary(const BoundsMap& bounds_map, aura::Window* window) { |
| 54 if (window->bounds().IsEmpty() && window->GetTargetBounds().IsEmpty()) { | 54 if (window->bounds().IsEmpty() && window->GetTargetBounds().IsEmpty()) { |
| 55 BoundsMap::const_iterator i = bounds_map.find(window); | 55 BoundsMap::const_iterator i = bounds_map.find(window); |
| 56 if (i != bounds_map.end()) | 56 if (i != bounds_map.end()) |
| 57 window->SetBounds(i->second); | 57 window->SetBounds(i->second); |
| 58 } | 58 } |
| 59 for (size_t i = 0; i < window->children().size(); ++i) | 59 for (size_t i = 0; i < window->children().size(); ++i) |
| 60 ResetBoundsIfNecessary(bounds_map, window->children()[i]); | 60 ResetBoundsIfNecessary(bounds_map, window->children()[i]); |
| 61 } | 61 } |
| 62 | 62 |
| 63 // Resets |window|s bounds from |bounds_map| if |window| is marked as a | 63 // Resets |window|s bounds from |bounds_map| if |window| is marked as a |
| 64 // constrained window. Recusively invokes this for all children. | 64 // constrained window. Recursively invokes this for all children. |
| 65 // TODO(sky): this should key off window type. | 65 // TODO(sky): this should key off window type. |
| 66 void ResetConstrainedWindowBoundsIfNecessary(const BoundsMap& bounds_map, | 66 void ResetConstrainedWindowBoundsIfNecessary(const BoundsMap& bounds_map, |
| 67 aura::Window* window) { | 67 aura::Window* window) { |
| 68 if (window->GetProperty(aura::client::kConstrainedWindowKey)) { | 68 if (window->GetProperty(aura::client::kConstrainedWindowKey)) { |
| 69 BoundsMap::const_iterator i = bounds_map.find(window); | 69 BoundsMap::const_iterator i = bounds_map.find(window); |
| 70 if (i != bounds_map.end()) | 70 if (i != bounds_map.end()) |
| 71 window->SetBounds(i->second); | 71 window->SetBounds(i->second); |
| 72 } | 72 } |
| 73 for (size_t i = 0; i < window->children().size(); ++i) | 73 for (size_t i = 0; i < window->children().size(); ++i) |
| 74 ResetConstrainedWindowBoundsIfNecessary(bounds_map, window->children()[i]); | 74 ResetConstrainedWindowBoundsIfNecessary(bounds_map, window->children()[i]); |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 } | 397 } |
| 398 return false; | 398 return false; |
| 399 } | 399 } |
| 400 | 400 |
| 401 WorkspaceManager* WorkspaceLayoutManager::workspace_manager() { | 401 WorkspaceManager* WorkspaceLayoutManager::workspace_manager() { |
| 402 return workspace_->workspace_manager(); | 402 return workspace_->workspace_manager(); |
| 403 } | 403 } |
| 404 | 404 |
| 405 } // namespace internal | 405 } // namespace internal |
| 406 } // namespace ash | 406 } // namespace ash |
| OLD | NEW |