diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-25 21:24:25 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-25 21:24:25 +0000 |
commit | 0e935c74fd6ca38866df63af66dc535497172950 (patch) | |
tree | 675c767909ac2ac6f140d01407606db7193d591d /aura/desktop.cc | |
parent | bae2bd6410e24c06c64a304bb4be294e835bfb41 (diff) | |
download | chromium_src-0e935c74fd6ca38866df63af66dc535497172950.zip chromium_src-0e935c74fd6ca38866df63af66dc535497172950.tar.gz chromium_src-0e935c74fd6ca38866df63af66dc535497172950.tar.bz2 |
Create a new views_aura_desktop.
Get views::Widget rendering working against an aura::Window NativeWidget.
http://crbug.com/93944
TEST=none
Review URL: http://codereview.chromium.org/7741027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98306 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'aura/desktop.cc')
-rw-r--r-- | aura/desktop.cc | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/aura/desktop.cc b/aura/desktop.cc index 00b130f..f427daf 100644 --- a/aura/desktop.cc +++ b/aura/desktop.cc @@ -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 @@ bool Desktop::OnMouseEvent(const MouseEvent& event) { return window_->OnMouseEvent(event); } +// static +Desktop* Desktop::GetInstance() { + if (!instance_) { + instance_ = new Desktop; + instance_->window_->Init(); + } + return instance_; +} + } // namespace aura |