Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: aura/desktop.cc

Issue 7741027: Create a new views_aura_desktop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « aura/desktop.h ('k') | aura/window.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "aura/desktop.h" 5 #include "aura/desktop.h"
6 6
7 #include "aura/desktop_host.h"
7 #include "aura/window.h" 8 #include "aura/window.h"
8 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h"
9 #include "ui/gfx/compositor/compositor.h" 11 #include "ui/gfx/compositor/compositor.h"
10 12
11 namespace aura { 13 namespace aura {
12 14
13 Desktop::Desktop(gfx::AcceleratedWidget widget, const gfx::Size& size) 15 // static
14 : compositor_(ui::Compositor::Create(widget, size)) { 16 Desktop* Desktop::instance_ = NULL;
17
18 Desktop::Desktop()
19 : host_(aura::DesktopHost::Create(gfx::Rect(200, 200, 1024, 768))) {
20 compositor_ = ui::Compositor::Create(host_->GetAcceleratedWidget(),
21 host_->GetSize());
22 host_->SetDesktop(this);
15 DCHECK(compositor_.get()); 23 DCHECK(compositor_.get());
16 window_.reset(new Window(this)); 24 window_.reset(new Window(NULL));
17 } 25 }
18 26
19 Desktop::~Desktop() { 27 Desktop::~Desktop() {
20 } 28 }
21 29
30 void Desktop::Run() {
31 host_->Show();
32 MessageLoop main_message_loop(MessageLoop::TYPE_UI);
33 MessageLoopForUI::current()->Run(host_);
34 }
35
22 void Desktop::Draw() { 36 void Desktop::Draw() {
23 // Second pass renders the layers. 37 // Second pass renders the layers.
24 compositor_->NotifyStart(); 38 compositor_->NotifyStart();
25 window_->DrawTree(); 39 window_->DrawTree();
26 compositor_->NotifyEnd(); 40 compositor_->NotifyEnd();
27 } 41 }
28 42
29 bool Desktop::OnMouseEvent(const MouseEvent& event) { 43 bool Desktop::OnMouseEvent(const MouseEvent& event) {
30 return window_->OnMouseEvent(event); 44 return window_->OnMouseEvent(event);
31 } 45 }
32 46
47 // static
48 Desktop* Desktop::GetInstance() {
49 if (!instance_) {
50 instance_ = new Desktop;
51 instance_->window_->Init();
52 }
53 return instance_;
54 }
55
33 } // namespace aura 56 } // namespace aura
OLDNEW
« no previous file with comments | « aura/desktop.h ('k') | aura/window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698