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

Side by Side Diff: aura/desktop.cc

Issue 7749020: Revert 98306 - Create a new views_aura_desktop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 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"
8 #include "aura/window.h" 7 #include "aura/window.h"
9 #include "base/logging.h" 8 #include "base/logging.h"
10 #include "base/message_loop.h"
11 #include "ui/gfx/compositor/compositor.h" 9 #include "ui/gfx/compositor/compositor.h"
12 10
13 namespace aura { 11 namespace aura {
14 12
15 // static 13 Desktop::Desktop(gfx::AcceleratedWidget widget, const gfx::Size& size)
16 Desktop* Desktop::instance_ = NULL; 14 : compositor_(ui::Compositor::Create(widget, size)) {
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);
23 DCHECK(compositor_.get()); 15 DCHECK(compositor_.get());
24 window_.reset(new Window(NULL)); 16 window_.reset(new Window(this));
25 } 17 }
26 18
27 Desktop::~Desktop() { 19 Desktop::~Desktop() {
28 } 20 }
29 21
30 void Desktop::Run() {
31 host_->Show();
32 MessageLoop main_message_loop(MessageLoop::TYPE_UI);
33 MessageLoopForUI::current()->Run(host_);
34 }
35
36 void Desktop::Draw() { 22 void Desktop::Draw() {
37 // Second pass renders the layers. 23 // Second pass renders the layers.
38 compositor_->NotifyStart(); 24 compositor_->NotifyStart();
39 window_->DrawTree(); 25 window_->DrawTree();
40 compositor_->NotifyEnd(); 26 compositor_->NotifyEnd();
41 } 27 }
42 28
43 bool Desktop::OnMouseEvent(const MouseEvent& event) { 29 bool Desktop::OnMouseEvent(const MouseEvent& event) {
44 return window_->OnMouseEvent(event); 30 return window_->OnMouseEvent(event);
45 } 31 }
46 32
47 // static
48 Desktop* Desktop::GetInstance() {
49 if (!instance_) {
50 instance_ = new Desktop;
51 instance_->window_->Init();
52 }
53 return instance_;
54 }
55
56 } // namespace aura 33 } // 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