Index: aura/desktop.cc |
=================================================================== |
--- aura/desktop.cc (revision 98234) |
+++ aura/desktop.cc (working copy) |
@@ -4,21 +4,35 @@ |
#include "aura/desktop.h" |
+#include "aura/desktop_host.h" |
#include "aura/window.h" |
#include "base/logging.h" |
+#include "base/message_loop.h" |
#include "ui/gfx/compositor/compositor.h" |
namespace aura { |
-Desktop::Desktop(gfx::AcceleratedWidget widget, const gfx::Size& size) |
- : compositor_(ui::Compositor::Create(widget, size)) { |
+// static |
+Desktop* Desktop::instance_ = NULL; |
+ |
+Desktop::Desktop() |
+ : host_(aura::DesktopHost::Create(gfx::Rect(200, 200, 1024, 768))) { |
+ compositor_ = ui::Compositor::Create(host_->GetAcceleratedWidget(), |
+ host_->GetSize()); |
+ host_->SetDesktop(this); |
DCHECK(compositor_.get()); |
- window_.reset(new Window(this)); |
+ window_.reset(new Window(NULL)); |
} |
Desktop::~Desktop() { |
} |
+void Desktop::Run() { |
+ host_->Show(); |
+ MessageLoop main_message_loop(MessageLoop::TYPE_UI); |
+ MessageLoopForUI::current()->Run(host_); |
+} |
+ |
void Desktop::Draw() { |
// Second pass renders the layers. |
compositor_->NotifyStart(); |
@@ -30,4 +44,13 @@ |
return window_->OnMouseEvent(event); |
} |
+// static |
+Desktop* Desktop::GetInstance() { |
+ if (!instance_) { |
+ instance_ = new Desktop; |
+ instance_->window_->Init(); |
+ } |
+ return instance_; |
+} |
+ |
} // namespace aura |