| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 Shell::Shell(ShellDelegate* delegate) | 85 Shell::Shell(ShellDelegate* delegate) |
| 86 : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), | 86 : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), |
| 87 delegate_(delegate) { | 87 delegate_(delegate) { |
| 88 aura::Desktop::GetInstance()->SetEventFilter( | 88 aura::Desktop::GetInstance()->SetEventFilter( |
| 89 new internal::DesktopEventFilter); | 89 new internal::DesktopEventFilter); |
| 90 aura::Desktop::GetInstance()->SetStackingClient( | 90 aura::Desktop::GetInstance()->SetStackingClient( |
| 91 new internal::StackingController); | 91 new internal::StackingController); |
| 92 } | 92 } |
| 93 | 93 |
| 94 Shell::~Shell() { | 94 Shell::~Shell() { |
| 95 DCHECK(instance_ == this); |
| 96 instance_ = NULL; |
| 97 |
| 95 // Make sure we delete WorkspaceController before launcher is | 98 // Make sure we delete WorkspaceController before launcher is |
| 96 // deleted as it has a reference to launcher model. | 99 // deleted as it has a reference to launcher model. |
| 97 workspace_controller_.reset(); | 100 workspace_controller_.reset(); |
| 98 } | 101 } |
| 99 | 102 |
| 100 // static | 103 // static |
| 101 Shell* Shell::CreateInstance(ShellDelegate* delegate) { | 104 Shell* Shell::CreateInstance(ShellDelegate* delegate) { |
| 102 CHECK(!instance_); | 105 CHECK(!instance_); |
| 103 instance_ = new Shell(delegate); | 106 instance_ = new Shell(delegate); |
| 104 instance_->Init(); | 107 instance_->Init(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 123 | 126 |
| 124 aura::Window::Windows containers; | 127 aura::Window::Windows containers; |
| 125 CreateSpecialContainers(&containers); | 128 CreateSpecialContainers(&containers); |
| 126 aura::Window::Windows::const_iterator i; | 129 aura::Window::Windows::const_iterator i; |
| 127 for (i = containers.begin(); i != containers.end(); ++i) { | 130 for (i = containers.begin(); i != containers.end(); ++i) { |
| 128 (*i)->Init(ui::Layer::LAYER_HAS_NO_TEXTURE); | 131 (*i)->Init(ui::Layer::LAYER_HAS_NO_TEXTURE); |
| 129 desktop_window->AddChild(*i); | 132 desktop_window->AddChild(*i); |
| 130 (*i)->Show(); | 133 (*i)->Show(); |
| 131 } | 134 } |
| 132 | 135 |
| 136 internal::StackingController* stacking_controller = |
| 137 static_cast<internal::StackingController*>( |
| 138 desktop_window->stacking_client()); |
| 139 stacking_controller->Init(); |
| 140 |
| 133 internal::DesktopLayoutManager* desktop_layout = | 141 internal::DesktopLayoutManager* desktop_layout = |
| 134 new internal::DesktopLayoutManager(desktop_window); | 142 new internal::DesktopLayoutManager(desktop_window); |
| 135 desktop_window->SetLayoutManager(desktop_layout); | 143 desktop_window->SetLayoutManager(desktop_layout); |
| 136 | 144 |
| 137 desktop_layout->set_background_widget(internal::CreateDesktopBackground()); | 145 desktop_layout->set_background_widget(internal::CreateDesktopBackground()); |
| 138 aura::Window* default_container = | 146 aura::Window* default_container = |
| 139 GetContainer(internal::kShellWindowId_DefaultContainer); | 147 GetContainer(internal::kShellWindowId_DefaultContainer); |
| 140 launcher_.reset(new Launcher(default_container)); | 148 launcher_.reset(new Launcher(default_container)); |
| 141 | 149 |
| 142 views::Widget* status_widget = NULL; | 150 views::Widget* status_widget = NULL; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 new internal::WorkspaceController(default_container)); | 196 new internal::WorkspaceController(default_container)); |
| 189 workspace_controller_->SetLauncherModel(launcher_->model()); | 197 workspace_controller_->SetLauncherModel(launcher_->model()); |
| 190 default_container->SetEventFilter( | 198 default_container->SetEventFilter( |
| 191 new internal::DefaultContainerEventFilter(default_container)); | 199 new internal::DefaultContainerEventFilter(default_container)); |
| 192 default_container->SetLayoutManager( | 200 default_container->SetLayoutManager( |
| 193 new internal::DefaultContainerLayoutManager( | 201 new internal::DefaultContainerLayoutManager( |
| 194 workspace_controller_->workspace_manager())); | 202 workspace_controller_->workspace_manager())); |
| 195 } | 203 } |
| 196 | 204 |
| 197 } // namespace aura_shell | 205 } // namespace aura_shell |
| OLD | NEW |