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 #ifndef AURA_DESKTOP_H_ | 5 #ifndef AURA_DESKTOP_H_ |
6 #define AURA_DESKTOP_H_ | 6 #define AURA_DESKTOP_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "aura/root_window.h" | 9 #include "aura/root_window.h" |
10 #include "aura/aura_export.h" | 10 #include "aura/aura_export.h" |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/task.h" |
| 14 #include "ui/gfx/compositor/compositor.h" |
13 #include "ui/gfx/native_widget_types.h" | 15 #include "ui/gfx/native_widget_types.h" |
14 | 16 |
15 namespace gfx { | 17 namespace gfx { |
16 class Size; | 18 class Size; |
17 } | 19 } |
18 | 20 |
19 namespace ui { | 21 class MessageLoop; |
20 class Compositor; | |
21 } | |
22 | 22 |
23 namespace aura { | 23 namespace aura { |
24 | 24 |
25 class DesktopHost; | 25 class DesktopHost; |
26 class MouseEvent; | 26 class MouseEvent; |
27 | 27 |
28 // Desktop is responsible for hosting a set of windows. | 28 // Desktop is responsible for hosting a set of windows. |
29 class AURA_EXPORT Desktop { | 29 class AURA_EXPORT Desktop : public ui::CompositorDelegate { |
30 public: | 30 public: |
31 Desktop(); | 31 Desktop(); |
32 ~Desktop(); | 32 ~Desktop(); |
33 | 33 |
34 // Shows the desktop host. | 34 // Shows the desktop host. |
35 void Show(); | 35 void Show(); |
36 | 36 |
37 // Sets the size of the desktop. | 37 // Sets the size of the desktop. |
38 void SetSize(const gfx::Size& size); | 38 void SetSize(const gfx::Size& size); |
39 | 39 |
(...skipping 10 matching lines...) Expand all Loading... |
50 bool OnKeyEvent(const KeyEvent& event); | 50 bool OnKeyEvent(const KeyEvent& event); |
51 | 51 |
52 // Compositor we're drawing to. | 52 // Compositor we're drawing to. |
53 ui::Compositor* compositor() { return compositor_.get(); } | 53 ui::Compositor* compositor() { return compositor_.get(); } |
54 | 54 |
55 Window* window() { return window_.get(); } | 55 Window* window() { return window_.get(); } |
56 | 56 |
57 static Desktop* GetInstance(); | 57 static Desktop* GetInstance(); |
58 | 58 |
59 private: | 59 private: |
| 60 // Overridden from ui::CompositorDelegate |
| 61 virtual void ScheduleCompositorPaint(); |
| 62 |
60 scoped_refptr<ui::Compositor> compositor_; | 63 scoped_refptr<ui::Compositor> compositor_; |
61 | 64 |
62 scoped_ptr<internal::RootWindow> window_; | 65 scoped_ptr<internal::RootWindow> window_; |
63 | 66 |
64 DesktopHost* host_; | 67 DesktopHost* host_; |
65 | 68 |
66 static Desktop* instance_; | 69 static Desktop* instance_; |
67 | 70 |
| 71 // Used to schedule painting. |
| 72 ScopedRunnableMethodFactory<Desktop> schedule_paint_; |
| 73 |
| 74 // The main message loop. |
| 75 scoped_ptr<MessageLoop> main_loop_; |
| 76 |
68 DISALLOW_COPY_AND_ASSIGN(Desktop); | 77 DISALLOW_COPY_AND_ASSIGN(Desktop); |
69 }; | 78 }; |
70 | 79 |
71 } // namespace aura | 80 } // namespace aura |
72 | 81 |
73 #endif // AURA_DESKTOP_H_ | 82 #endif // AURA_DESKTOP_H_ |
OLD | NEW |