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 "ui/aura_shell/default_container_layout_manager.h" | 5 #include "ui/aura_shell/default_container_layout_manager.h" |
6 | 6 |
7 #include "ui/aura/client/aura_constants.h" | 7 #include "ui/aura/client/aura_constants.h" |
8 #include "ui/aura/event.h" | 8 #include "ui/aura/event.h" |
9 #include "ui/aura/root_window.h" | 9 #include "ui/aura/root_window.h" |
10 #include "ui/aura/screen_aura.h" | 10 #include "ui/aura/screen_aura.h" |
11 #include "ui/aura/window.h" | 11 #include "ui/aura/window.h" |
12 #include "ui/aura/window_observer.h" | 12 #include "ui/aura/window_observer.h" |
13 #include "ui/aura/window_types.h" | 13 #include "ui/aura/window_types.h" |
14 #include "ui/aura_shell/property_util.h" | 14 #include "ui/aura_shell/property_util.h" |
15 #include "ui/aura_shell/show_state_controller.h" | 15 #include "ui/aura_shell/show_state_controller.h" |
16 #include "ui/aura_shell/window_util.h" | |
17 #include "ui/aura_shell/workspace/workspace.h" | 16 #include "ui/aura_shell/workspace/workspace.h" |
18 #include "ui/aura_shell/workspace/workspace_manager.h" | 17 #include "ui/aura_shell/workspace/workspace_manager.h" |
19 #include "ui/base/ui_base_types.h" | 18 #include "ui/base/ui_base_types.h" |
20 #include "ui/gfx/rect.h" | 19 #include "ui/gfx/rect.h" |
21 #include "ui/views/widget/native_widget_aura.h" | 20 #include "ui/views/widget/native_widget_aura.h" |
22 | 21 |
23 namespace aura_shell { | 22 namespace aura_shell { |
24 namespace internal { | 23 namespace internal { |
25 | 24 |
26 //////////////////////////////////////////////////////////////////////////////// | 25 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 if (child->type() != aura::WINDOW_TYPE_NORMAL || child->transient_parent()) | 98 if (child->type() != aura::WINDOW_TYPE_NORMAL || child->transient_parent()) |
100 return; | 99 return; |
101 | 100 |
102 if (!child->GetProperty(aura::kShowStateKey)) | 101 if (!child->GetProperty(aura::kShowStateKey)) |
103 child->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_NORMAL); | 102 child->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_NORMAL); |
104 | 103 |
105 child->AddObserver(show_state_controller_.get()); | 104 child->AddObserver(show_state_controller_.get()); |
106 | 105 |
107 Workspace* workspace = workspace_manager_->GetActiveWorkspace(); | 106 Workspace* workspace = workspace_manager_->GetActiveWorkspace(); |
108 if (workspace) { | 107 if (workspace) { |
109 aura::Window* active = aura_shell::GetActiveWindow(); | 108 aura::Window* active = aura::RootWindow::GetInstance()->active_window(); |
110 // Active window may not be in the default container layer. | 109 // Active window may not be in the default container layer. |
111 if (!workspace->Contains(active)) | 110 if (!workspace->Contains(active)) |
112 active = NULL; | 111 active = NULL; |
113 if (workspace->AddWindowAfter(child, active)) | 112 if (workspace->AddWindowAfter(child, active)) |
114 return; | 113 return; |
115 } | 114 } |
116 // Create new workspace if new |child| doesn't fit to current workspace. | 115 // Create new workspace if new |child| doesn't fit to current workspace. |
117 Workspace* new_workspace = workspace_manager_->CreateWorkspace(); | 116 Workspace* new_workspace = workspace_manager_->CreateWorkspace(); |
118 new_workspace->AddWindowAfter(child, NULL); | 117 new_workspace->AddWindowAfter(child, NULL); |
119 new_workspace->Activate(); | 118 new_workspace->Activate(); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 adjusted_bounds = workspace->bounds(); | 179 adjusted_bounds = workspace->bounds(); |
181 // Don't | 180 // Don't |
182 if (child->GetTargetBounds() == adjusted_bounds) | 181 if (child->GetTargetBounds() == adjusted_bounds) |
183 return; | 182 return; |
184 } | 183 } |
185 SetChildBoundsDirect(child, adjusted_bounds); | 184 SetChildBoundsDirect(child, adjusted_bounds); |
186 } | 185 } |
187 | 186 |
188 } // namespace internal | 187 } // namespace internal |
189 } // namespace aura_shell | 188 } // namespace aura_shell |
OLD | NEW |