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 "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "ui/aura/aura_switches.h" | 9 #include "ui/aura/aura_switches.h" |
10 #include "ui/aura/desktop.h" | 10 #include "ui/aura/desktop.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" | 14 #include "ui/aura_shell/default_container_layout_manager.h" |
15 #include "ui/aura_shell/desktop_event_filter.h" | 15 #include "ui/aura_shell/desktop_event_filter.h" |
16 #include "ui/aura_shell/desktop_layout_manager.h" | 16 #include "ui/aura_shell/desktop_layout_manager.h" |
17 #include "ui/aura_shell/launcher/launcher.h" | 17 #include "ui/aura_shell/launcher/launcher.h" |
| 18 #include "ui/aura_shell/modal_container_layout_manager.h" |
18 #include "ui/aura_shell/shelf_layout_controller.h" | 19 #include "ui/aura_shell/shelf_layout_controller.h" |
19 #include "ui/aura_shell/shell_delegate.h" | 20 #include "ui/aura_shell/shell_delegate.h" |
20 #include "ui/aura_shell/shell_factory.h" | 21 #include "ui/aura_shell/shell_factory.h" |
21 #include "ui/aura_shell/shell_window_ids.h" | 22 #include "ui/aura_shell/shell_window_ids.h" |
22 #include "ui/aura_shell/stacking_controller.h" | 23 #include "ui/aura_shell/stacking_controller.h" |
23 #include "ui/aura_shell/toplevel_layout_manager.h" | 24 #include "ui/aura_shell/toplevel_layout_manager.h" |
24 #include "ui/aura_shell/toplevel_window_event_filter.h" | 25 #include "ui/aura_shell/toplevel_window_event_filter.h" |
25 #include "ui/aura_shell/workspace_controller.h" | 26 #include "ui/aura_shell/workspace_controller.h" |
26 #include "ui/gfx/compositor/layer.h" | 27 #include "ui/gfx/compositor/layer.h" |
27 #include "ui/gfx/compositor/layer_animator.h" | 28 #include "ui/gfx/compositor/layer_animator.h" |
(...skipping 25 matching lines...) Expand all Loading... |
53 always_on_top_container->SetEventFilter( | 54 always_on_top_container->SetEventFilter( |
54 new ToplevelWindowEventFilter(always_on_top_container)); | 55 new ToplevelWindowEventFilter(always_on_top_container)); |
55 always_on_top_container->set_id( | 56 always_on_top_container->set_id( |
56 internal::kShellWindowId_AlwaysOnTopContainer); | 57 internal::kShellWindowId_AlwaysOnTopContainer); |
57 containers->push_back(always_on_top_container); | 58 containers->push_back(always_on_top_container); |
58 | 59 |
59 aura::Window* launcher_container = new aura::Window(NULL); | 60 aura::Window* launcher_container = new aura::Window(NULL); |
60 launcher_container->set_id(internal::kShellWindowId_LauncherContainer); | 61 launcher_container->set_id(internal::kShellWindowId_LauncherContainer); |
61 containers->push_back(launcher_container); | 62 containers->push_back(launcher_container); |
62 | 63 |
| 64 aura::Window* modal_container = new aura::Window(NULL); |
| 65 modal_container->SetEventFilter( |
| 66 new ToplevelWindowEventFilter(modal_container)); |
| 67 modal_container->SetLayoutManager( |
| 68 new internal::ModalContainerLayoutManager(modal_container)); |
| 69 modal_container->set_id(internal::kShellWindowId_ModalContainer); |
| 70 containers->push_back(modal_container); |
| 71 |
| 72 // TODO(beng): Figure out if we can make this use ModalityEventFilter instead |
| 73 // of stops_event_propagation. |
63 aura::Window* lock_container = new aura::Window(NULL); | 74 aura::Window* lock_container = new aura::Window(NULL); |
64 lock_container->set_stops_event_propagation(true); | 75 lock_container->set_stops_event_propagation(true); |
65 lock_container->set_id(internal::kShellWindowId_LockScreenContainer); | 76 lock_container->set_id(internal::kShellWindowId_LockScreenContainer); |
66 containers->push_back(lock_container); | 77 containers->push_back(lock_container); |
67 | 78 |
68 aura::Window* status_container = new aura::Window(NULL); | 79 aura::Window* status_container = new aura::Window(NULL); |
69 status_container->set_id(internal::kShellWindowId_StatusContainer); | 80 status_container->set_id(internal::kShellWindowId_StatusContainer); |
70 containers->push_back(status_container); | 81 containers->push_back(status_container); |
71 | 82 |
72 aura::Window* menu_container = new aura::Window(NULL); | 83 aura::Window* menu_container = new aura::Window(NULL); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 184 |
174 aura::Window* Shell::GetContainer(int container_id) { | 185 aura::Window* Shell::GetContainer(int container_id) { |
175 return const_cast<aura::Window*>( | 186 return const_cast<aura::Window*>( |
176 const_cast<const aura_shell::Shell*>(this)->GetContainer(container_id)); | 187 const_cast<const aura_shell::Shell*>(this)->GetContainer(container_id)); |
177 } | 188 } |
178 | 189 |
179 const aura::Window* Shell::GetContainer(int container_id) const { | 190 const aura::Window* Shell::GetContainer(int container_id) const { |
180 return aura::Desktop::GetInstance()->GetChildById(container_id); | 191 return aura::Desktop::GetInstance()->GetChildById(container_id); |
181 } | 192 } |
182 | 193 |
| 194 void Shell::AddDesktopEventFilter(aura::EventFilter* filter) { |
| 195 static_cast<internal::DesktopEventFilter*>( |
| 196 aura::Desktop::GetInstance()->event_filter())->AddFilter(filter); |
| 197 } |
| 198 |
| 199 void Shell::RemoveDesktopEventFilter(aura::EventFilter* filter) { |
| 200 static_cast<internal::DesktopEventFilter*>( |
| 201 aura::Desktop::GetInstance()->event_filter())->RemoveFilter(filter); |
| 202 } |
| 203 |
183 void Shell::ToggleOverview() { | 204 void Shell::ToggleOverview() { |
184 if (workspace_controller_.get()) | 205 if (workspace_controller_.get()) |
185 workspace_controller_->ToggleOverview(); | 206 workspace_controller_->ToggleOverview(); |
186 } | 207 } |
187 | 208 |
188 //////////////////////////////////////////////////////////////////////////////// | 209 //////////////////////////////////////////////////////////////////////////////// |
189 // Shell, private: | 210 // Shell, private: |
190 | 211 |
191 void Shell::EnableWorkspaceManager() { | 212 void Shell::EnableWorkspaceManager() { |
192 aura::Window* default_container = | 213 aura::Window* default_container = |
193 GetContainer(internal::kShellWindowId_DefaultContainer); | 214 GetContainer(internal::kShellWindowId_DefaultContainer); |
194 | 215 |
195 workspace_controller_.reset( | 216 workspace_controller_.reset( |
196 new internal::WorkspaceController(default_container)); | 217 new internal::WorkspaceController(default_container)); |
197 workspace_controller_->SetLauncherModel(launcher_->model()); | 218 workspace_controller_->SetLauncherModel(launcher_->model()); |
198 default_container->SetEventFilter( | 219 default_container->SetEventFilter( |
199 new internal::DefaultContainerEventFilter(default_container)); | 220 new internal::DefaultContainerEventFilter(default_container)); |
200 default_container->SetLayoutManager( | 221 default_container->SetLayoutManager( |
201 new internal::DefaultContainerLayoutManager( | 222 new internal::DefaultContainerLayoutManager( |
202 workspace_controller_->workspace_manager())); | 223 workspace_controller_->workspace_manager())); |
203 } | 224 } |
204 | 225 |
205 } // namespace aura_shell | 226 } // namespace aura_shell |
OLD | NEW |