Index: ui/aura_shell/shell.cc |
diff --git a/ui/aura_shell/shell.cc b/ui/aura_shell/shell.cc |
index 58d3d78f798adfba4f29f8bbd88c8bead63c7494..1f4a89c4856febaf9197a18d3e34d64fffa7b420 100644 |
--- a/ui/aura_shell/shell.cc |
+++ b/ui/aura_shell/shell.cc |
@@ -81,8 +81,9 @@ Shell* Shell::instance_ = NULL; |
//////////////////////////////////////////////////////////////////////////////// |
// Shell, public: |
-Shell::Shell() |
- : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { |
+Shell::Shell(ShellDelegate* delegate) |
+ : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), |
+ delegate_(delegate) { |
aura::Desktop::GetInstance()->SetStackingClient(this); |
} |
@@ -93,11 +94,15 @@ Shell::~Shell() { |
} |
// static |
+Shell* Shell::CreateInstance(ShellDelegate* delegate) { |
+ CHECK(!instance_); |
+ instance_ = new Shell(delegate); |
+ instance_->Init(); |
+ return instance_; |
+} |
+// static |
Shell* Shell::GetInstance() { |
- if (!instance_) { |
- instance_ = new Shell; |
- instance_->Init(); |
- } |
+ DCHECK(instance_); |
return instance_; |
} |
@@ -119,13 +124,21 @@ void Shell::Init() { |
desktop_window->SetLayoutManager(desktop_layout); |
desktop_layout->set_background_widget(internal::CreateDesktopBackground()); |
+ |
aura::ToplevelWindowContainer* toplevel_container = |
GetContainer(internal::kShellWindowId_DefaultContainer)-> |
AsToplevelWindowContainer(); |
launcher_.reset(new Launcher(toplevel_container)); |
+ views::Widget* status_widget = NULL; |
+ if (delegate_.get()) |
+ status_widget = delegate_->CreateStatusArea(); |
+ if (!status_widget) |
+ status_widget = internal::CreateStatusArea(); |
+ |
shelf_layout_controller_.reset(new internal::ShelfLayoutController( |
- launcher_->widget(), internal::CreateStatusArea())); |
+ launcher_->widget(), status_widget)); |
+ |
desktop_layout->set_shelf(shelf_layout_controller_.get()); |
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAuraWindows)) { |
@@ -141,10 +154,6 @@ void Shell::Init() { |
desktop_layout->OnWindowResized(); |
} |
-void Shell::SetDelegate(ShellDelegate* delegate) { |
- delegate_.reset(delegate); |
-} |
- |
aura::Window* Shell::GetContainer(int container_id) { |
return const_cast<aura::Window*>( |
const_cast<const aura_shell::Shell*>(this)->GetContainer(container_id)); |