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" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 Shell::Shell() | 85 Shell::Shell() |
86 : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { | 86 : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { |
87 aura::Desktop::GetInstance()->SetEventFilter( | 87 aura::Desktop::GetInstance()->SetEventFilter( |
88 new internal::DesktopEventFilter); | 88 new internal::DesktopEventFilter); |
89 aura::Desktop::GetInstance()->SetStackingClient( | 89 aura::Desktop::GetInstance()->SetStackingClient( |
90 new internal::StackingController); | 90 new internal::StackingController); |
91 } | 91 } |
92 | 92 |
93 Shell::~Shell() { | 93 Shell::~Shell() { |
| 94 DCHECK(instance_ == this); |
| 95 instance_ = NULL; |
| 96 |
94 // Make sure we delete WorkspaceController before launcher is | 97 // Make sure we delete WorkspaceController before launcher is |
95 // deleted as it has a reference to launcher model. | 98 // deleted as it has a reference to launcher model. |
96 workspace_controller_.reset(); | 99 workspace_controller_.reset(); |
97 } | 100 } |
98 | 101 |
99 // static | 102 // static |
100 Shell* Shell::GetInstance() { | 103 Shell* Shell::GetInstance() { |
101 if (!instance_) { | 104 if (!instance_) { |
102 instance_ = new Shell; | 105 instance_ = new Shell; |
103 instance_->Init(); | 106 instance_->Init(); |
(...skipping 13 matching lines...) Expand all Loading... |
117 | 120 |
118 aura::Window::Windows containers; | 121 aura::Window::Windows containers; |
119 CreateSpecialContainers(&containers); | 122 CreateSpecialContainers(&containers); |
120 aura::Window::Windows::const_iterator i; | 123 aura::Window::Windows::const_iterator i; |
121 for (i = containers.begin(); i != containers.end(); ++i) { | 124 for (i = containers.begin(); i != containers.end(); ++i) { |
122 (*i)->Init(ui::Layer::LAYER_HAS_NO_TEXTURE); | 125 (*i)->Init(ui::Layer::LAYER_HAS_NO_TEXTURE); |
123 desktop_window->AddChild(*i); | 126 desktop_window->AddChild(*i); |
124 (*i)->Show(); | 127 (*i)->Show(); |
125 } | 128 } |
126 | 129 |
| 130 internal::StackingController* stacking_controller = |
| 131 static_cast<internal::StackingController*>( |
| 132 desktop_window->stacking_client()); |
| 133 stacking_controller->Init(); |
| 134 |
127 internal::DesktopLayoutManager* desktop_layout = | 135 internal::DesktopLayoutManager* desktop_layout = |
128 new internal::DesktopLayoutManager(desktop_window); | 136 new internal::DesktopLayoutManager(desktop_window); |
129 desktop_window->SetLayoutManager(desktop_layout); | 137 desktop_window->SetLayoutManager(desktop_layout); |
130 | 138 |
131 desktop_layout->set_background_widget(internal::CreateDesktopBackground()); | 139 desktop_layout->set_background_widget(internal::CreateDesktopBackground()); |
132 aura::Window* default_container = | 140 aura::Window* default_container = |
133 GetContainer(internal::kShellWindowId_DefaultContainer); | 141 GetContainer(internal::kShellWindowId_DefaultContainer); |
134 launcher_.reset(new Launcher(default_container)); | 142 launcher_.reset(new Launcher(default_container)); |
135 | 143 |
136 shelf_layout_controller_.reset(new internal::ShelfLayoutController( | 144 shelf_layout_controller_.reset(new internal::ShelfLayoutController( |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 new internal::WorkspaceController(default_container)); | 187 new internal::WorkspaceController(default_container)); |
180 workspace_controller_->SetLauncherModel(launcher_->model()); | 188 workspace_controller_->SetLauncherModel(launcher_->model()); |
181 default_container->SetEventFilter( | 189 default_container->SetEventFilter( |
182 new internal::DefaultContainerEventFilter(default_container)); | 190 new internal::DefaultContainerEventFilter(default_container)); |
183 default_container->SetLayoutManager( | 191 default_container->SetLayoutManager( |
184 new internal::DefaultContainerLayoutManager( | 192 new internal::DefaultContainerLayoutManager( |
185 workspace_controller_->workspace_manager())); | 193 workspace_controller_->workspace_manager())); |
186 } | 194 } |
187 | 195 |
188 } // namespace aura_shell | 196 } // namespace aura_shell |
OLD | NEW |