OLD | NEW |
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/desktop_host.h" |
8 #include "aura/root_window.h" | 8 #include "aura/root_window.h" |
9 #include "aura/window.h" | 9 #include "aura/window.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "ui/gfx/compositor/compositor.h" | 12 #include "ui/gfx/compositor/compositor.h" |
| 13 #include "ui/gfx/compositor/layer.h" |
13 | 14 |
14 namespace aura { | 15 namespace aura { |
15 | 16 |
16 // static | 17 // static |
17 Desktop* Desktop::instance_ = NULL; | 18 Desktop* Desktop::instance_ = NULL; |
18 | 19 |
19 Desktop::Desktop() | 20 Desktop::Desktop() |
20 : host_(aura::DesktopHost::Create(gfx::Rect(200, 200, 1024, 768))), | 21 : host_(aura::DesktopHost::Create(gfx::Rect(200, 200, 1024, 768))), |
21 ALLOW_THIS_IN_INITIALIZER_LIST(schedule_paint_(this)) { | 22 ALLOW_THIS_IN_INITIALIZER_LIST(schedule_paint_(this)) { |
22 DCHECK(MessageLoopForUI::current()) | 23 DCHECK(MessageLoopForUI::current()) |
(...skipping 18 matching lines...) Expand all Loading... |
41 host_->SetSize(size); | 42 host_->SetSize(size); |
42 } | 43 } |
43 | 44 |
44 void Desktop::Run() { | 45 void Desktop::Run() { |
45 Show(); | 46 Show(); |
46 MessageLoopForUI::current()->Run(host_.get()); | 47 MessageLoopForUI::current()->Run(host_.get()); |
47 } | 48 } |
48 | 49 |
49 void Desktop::Draw() { | 50 void Desktop::Draw() { |
50 compositor_->NotifyStart(); | 51 compositor_->NotifyStart(); |
51 window_->DrawTree(); | 52 window_->layer()->DrawTree(); |
52 compositor_->NotifyEnd(); | 53 compositor_->NotifyEnd(); |
53 } | 54 } |
54 | 55 |
55 bool Desktop::OnMouseEvent(const MouseEvent& event) { | 56 bool Desktop::OnMouseEvent(const MouseEvent& event) { |
56 return window_->HandleMouseEvent(event); | 57 return window_->HandleMouseEvent(event); |
57 } | 58 } |
58 | 59 |
59 bool Desktop::OnKeyEvent(const KeyEvent& event) { | 60 bool Desktop::OnKeyEvent(const KeyEvent& event) { |
60 return window_->HandleKeyEvent(event); | 61 return window_->HandleKeyEvent(event); |
61 } | 62 } |
(...skipping 14 matching lines...) Expand all Loading... |
76 // static | 77 // static |
77 Desktop* Desktop::GetInstance() { | 78 Desktop* Desktop::GetInstance() { |
78 if (!instance_) { | 79 if (!instance_) { |
79 instance_ = new Desktop; | 80 instance_ = new Desktop; |
80 instance_->window_->Init(); | 81 instance_->window_->Init(); |
81 } | 82 } |
82 return instance_; | 83 return instance_; |
83 } | 84 } |
84 | 85 |
85 } // namespace aura | 86 } // namespace aura |
OLD | NEW |