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/shell.h" | 5 #include "ui/aura_shell/shell.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "ui/aura/desktop.h" | 8 #include "ui/aura/desktop.h" |
9 #include "ui/aura/screen_aura.h" | 9 #include "ui/aura/screen_aura.h" |
10 #include "ui/aura/toplevel_window_container.h" | 10 #include "ui/aura/toplevel_window_container.h" |
11 #include "ui/aura/window.h" | 11 #include "ui/aura/window.h" |
12 #include "ui/aura/window_types.h" | 12 #include "ui/aura/window_types.h" |
13 #include "ui/aura_shell/default_container_event_filter.h" | 13 #include "ui/aura_shell/default_container_event_filter.h" |
14 #include "ui/aura_shell/default_container_layout_manager.h" | |
15 #include "ui/aura_shell/desktop_layout_manager.h" | 14 #include "ui/aura_shell/desktop_layout_manager.h" |
16 #include "ui/aura_shell/launcher/launcher.h" | 15 #include "ui/aura_shell/launcher/launcher.h" |
17 #include "ui/aura_shell/shell_delegate.h" | 16 #include "ui/aura_shell/shell_delegate.h" |
18 #include "ui/aura_shell/shell_factory.h" | 17 #include "ui/aura_shell/shell_factory.h" |
19 #include "ui/aura_shell/shell_window_ids.h" | 18 #include "ui/aura_shell/shell_window_ids.h" |
20 #include "ui/aura_shell/workspace/workspace_manager.h" | 19 #include "ui/aura_shell/workspace/workspace_controller.h" |
21 #include "ui/base/view_prop.h" | 20 #include "ui/base/view_prop.h" |
22 #include "ui/gfx/compositor/layer.h" | 21 #include "ui/gfx/compositor/layer.h" |
23 #include "ui/gfx/compositor/layer_animator.h" | 22 #include "ui/gfx/compositor/layer_animator.h" |
24 #include "views/widget/native_widget_aura.h" | 23 #include "views/widget/native_widget_aura.h" |
25 #include "views/widget/widget.h" | 24 #include "views/widget/widget.h" |
26 | 25 |
27 namespace aura_shell { | 26 namespace aura_shell { |
28 | 27 |
29 namespace { | 28 namespace { |
30 | 29 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 launcher_.reset(new Launcher(toplevel_container)); | 119 launcher_.reset(new Launcher(toplevel_container)); |
121 desktop_layout->set_launcher_widget(launcher_->widget()); | 120 desktop_layout->set_launcher_widget(launcher_->widget()); |
122 desktop_layout->set_status_area_widget(internal::CreateStatusArea()); | 121 desktop_layout->set_status_area_widget(internal::CreateStatusArea()); |
123 | 122 |
124 desktop_window->screen()->set_work_area_insets( | 123 desktop_window->screen()->set_work_area_insets( |
125 gfx::Insets( | 124 gfx::Insets( |
126 0, kWorkAreaHorizontalMargin, | 125 0, kWorkAreaHorizontalMargin, |
127 launcher_->widget()->GetWindowScreenBounds().height(), | 126 launcher_->widget()->GetWindowScreenBounds().height(), |
128 kWorkAreaHorizontalMargin)); | 127 kWorkAreaHorizontalMargin)); |
129 | 128 |
130 // Workspace Manager | 129 workspace_controller_.reset( |
131 workspace_manager_.reset(new WorkspaceManager(toplevel_container)); | 130 new internal::WorkspaceController(toplevel_container)); |
132 toplevel_container->SetLayoutManager( | |
133 new internal::DefaultContainerLayoutManager( | |
134 toplevel_container, workspace_manager_.get())); | |
135 | 131 |
136 // Force a layout. | 132 // Force a layout. |
137 desktop_layout->OnWindowResized(); | 133 desktop_layout->OnWindowResized(); |
138 } | 134 } |
139 | 135 |
140 void Shell::SetDelegate(ShellDelegate* delegate) { | 136 void Shell::SetDelegate(ShellDelegate* delegate) { |
141 delegate_.reset(delegate); | 137 delegate_.reset(delegate); |
142 } | 138 } |
143 | 139 |
144 aura::Window* Shell::GetContainer(int container_id) { | 140 aura::Window* Shell::GetContainer(int container_id) { |
145 return const_cast<aura::Window*>( | 141 return const_cast<aura::Window*>( |
146 const_cast<const aura_shell::Shell*>(this)->GetContainer(container_id)); | 142 const_cast<const aura_shell::Shell*>(this)->GetContainer(container_id)); |
147 } | 143 } |
148 | 144 |
149 const aura::Window* Shell::GetContainer(int container_id) const { | 145 const aura::Window* Shell::GetContainer(int container_id) const { |
150 return aura::Desktop::GetInstance()->GetChildById(container_id); | 146 return aura::Desktop::GetInstance()->GetChildById(container_id); |
151 } | 147 } |
152 | 148 |
153 void Shell::ToggleOverview() { | 149 void Shell::ToggleOverview() { |
154 workspace_manager_->SetOverview(!workspace_manager_->is_overview()); | 150 workspace_controller_->ToggleOverview(); |
155 } | 151 } |
156 | 152 |
157 //////////////////////////////////////////////////////////////////////////////// | 153 //////////////////////////////////////////////////////////////////////////////// |
158 // Shell, aura::DesktopDelegate implementation: | 154 // Shell, aura::DesktopDelegate implementation: |
159 | 155 |
160 void Shell::AddChildToDefaultParent(aura::Window* window) { | 156 void Shell::AddChildToDefaultParent(aura::Window* window) { |
161 aura::Window* parent = NULL; | 157 aura::Window* parent = NULL; |
162 intptr_t type = reinterpret_cast<intptr_t>( | 158 intptr_t type = reinterpret_cast<intptr_t>( |
163 ui::ViewProp::GetValue(window, views::NativeWidgetAura::kWindowTypeKey)); | 159 ui::ViewProp::GetValue(window, views::NativeWidgetAura::kWindowTypeKey)); |
164 switch (static_cast<Widget::InitParams::Type>(type)) { | 160 switch (static_cast<Widget::InitParams::Type>(type)) { |
(...skipping 16 matching lines...) Expand all Loading... |
181 } | 177 } |
182 | 178 |
183 aura::Window* Shell::GetTopmostWindowToActivate(aura::Window* ignore) const { | 179 aura::Window* Shell::GetTopmostWindowToActivate(aura::Window* ignore) const { |
184 const aura::ToplevelWindowContainer* container = | 180 const aura::ToplevelWindowContainer* container = |
185 GetContainer(internal::kShellWindowId_DefaultContainer)-> | 181 GetContainer(internal::kShellWindowId_DefaultContainer)-> |
186 AsToplevelWindowContainer(); | 182 AsToplevelWindowContainer(); |
187 return container->GetTopmostWindowToActivate(ignore); | 183 return container->GetTopmostWindowToActivate(ignore); |
188 } | 184 } |
189 | 185 |
190 } // namespace aura_shell | 186 } // namespace aura_shell |
OLD | NEW |