OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/default_container_layout_manager.h" | 5 #include "ash/wm/default_container_layout_manager.h" |
6 | 6 |
7 #include "ash/wm/property_util.h" | 7 #include "ash/wm/property_util.h" |
8 #include "ash/wm/show_state_controller.h" | 8 #include "ash/wm/show_state_controller.h" |
9 #include "ash/wm/window_util.h" | 9 #include "ash/wm/window_util.h" |
10 #include "ash/wm/workspace/workspace.h" | 10 #include "ash/wm/workspace/workspace.h" |
11 #include "ash/wm/workspace/workspace_manager.h" | 11 #include "ash/wm/workspace/workspace_manager.h" |
12 #include "ui/aura/client/aura_constants.h" | 12 #include "ui/aura/client/aura_constants.h" |
13 #include "ui/aura/event.h" | 13 #include "ui/aura/event.h" |
14 #include "ui/aura/root_window.h" | 14 #include "ui/aura/root_window.h" |
15 #include "ui/aura/screen_aura.h" | 15 #include "ui/aura/screen_aura.h" |
16 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
17 #include "ui/aura/window_observer.h" | 17 #include "ui/aura/window_observer.h" |
18 #include "ui/base/ui_base_types.h" | 18 #include "ui/base/ui_base_types.h" |
19 #include "ui/gfx/rect.h" | 19 #include "ui/gfx/rect.h" |
20 #include "ui/views/widget/native_widget_aura.h" | 20 #include "ui/views/widget/native_widget_aura.h" |
21 | 21 |
22 namespace aura_shell { | 22 namespace ash { |
23 namespace internal { | 23 namespace internal { |
24 | 24 |
25 //////////////////////////////////////////////////////////////////////////////// | 25 //////////////////////////////////////////////////////////////////////////////// |
26 // DefaultContainerLayoutManager, public: | 26 // DefaultContainerLayoutManager, public: |
27 | 27 |
28 DefaultContainerLayoutManager::DefaultContainerLayoutManager( | 28 DefaultContainerLayoutManager::DefaultContainerLayoutManager( |
29 WorkspaceManager* workspace_manager) | 29 WorkspaceManager* workspace_manager) |
30 : workspace_manager_(workspace_manager), | 30 : workspace_manager_(workspace_manager), |
31 show_state_controller_(new ShowStateController(workspace_manager)) { | 31 show_state_controller_(new ShowStateController(workspace_manager)) { |
32 } | 32 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 return; | 100 return; |
101 } | 101 } |
102 | 102 |
103 if (!child->GetProperty(aura::client::kShowStateKey)) | 103 if (!child->GetProperty(aura::client::kShowStateKey)) |
104 child->SetIntProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); | 104 child->SetIntProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); |
105 | 105 |
106 child->AddObserver(show_state_controller_.get()); | 106 child->AddObserver(show_state_controller_.get()); |
107 | 107 |
108 Workspace* workspace = workspace_manager_->GetActiveWorkspace(); | 108 Workspace* workspace = workspace_manager_->GetActiveWorkspace(); |
109 if (workspace) { | 109 if (workspace) { |
110 aura::Window* active = aura_shell::GetActiveWindow(); | 110 aura::Window* active = ash::GetActiveWindow(); |
111 // Active window may not be in the default container layer. | 111 // Active window may not be in the default container layer. |
112 if (!workspace->Contains(active)) | 112 if (!workspace->Contains(active)) |
113 active = NULL; | 113 active = NULL; |
114 if (workspace->AddWindowAfter(child, active)) | 114 if (workspace->AddWindowAfter(child, active)) |
115 return; | 115 return; |
116 } | 116 } |
117 // Create new workspace if new |child| doesn't fit to current workspace. | 117 // Create new workspace if new |child| doesn't fit to current workspace. |
118 Workspace* new_workspace = workspace_manager_->CreateWorkspace(); | 118 Workspace* new_workspace = workspace_manager_->CreateWorkspace(); |
119 new_workspace->AddWindowAfter(child, NULL); | 119 new_workspace->AddWindowAfter(child, NULL); |
120 new_workspace->Activate(); | 120 new_workspace->Activate(); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 else | 180 else |
181 adjusted_bounds = workspace->bounds(); | 181 adjusted_bounds = workspace->bounds(); |
182 // Don't | 182 // Don't |
183 if (child->GetTargetBounds() == adjusted_bounds) | 183 if (child->GetTargetBounds() == adjusted_bounds) |
184 return; | 184 return; |
185 } | 185 } |
186 SetChildBoundsDirect(child, adjusted_bounds); | 186 SetChildBoundsDirect(child, adjusted_bounds); |
187 } | 187 } |
188 | 188 |
189 } // namespace internal | 189 } // namespace internal |
190 } // namespace aura_shell | 190 } // namespace ash |
OLD | NEW |