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 { | |
20 class Compositor; | |
21 } | |
22 | |
23 namespace aura { | 21 namespace aura { |
24 | 22 |
25 class DesktopHost; | 23 class DesktopHost; |
26 class MouseEvent; | 24 class MouseEvent; |
27 | 25 |
28 // Desktop is responsible for hosting a set of windows. | 26 // Desktop is responsible for hosting a set of windows. |
29 class AURA_EXPORT Desktop { | 27 class AURA_EXPORT Desktop : public ui::CompositorDelegate { |
30 public: | 28 public: |
31 Desktop(); | 29 Desktop(); |
32 ~Desktop(); | 30 ~Desktop(); |
33 | 31 |
34 // Shows the desktop host. | 32 // Shows the desktop host. |
35 void Show(); | 33 void Show(); |
36 | 34 |
37 // Sets the size of the desktop. | 35 // Sets the size of the desktop. |
38 void SetSize(const gfx::Size& size); | 36 void SetSize(const gfx::Size& size); |
39 | 37 |
(...skipping 10 matching lines...) Expand all Loading... |
50 bool OnKeyEvent(const KeyEvent& event); | 48 bool OnKeyEvent(const KeyEvent& event); |
51 | 49 |
52 // Compositor we're drawing to. | 50 // Compositor we're drawing to. |
53 ui::Compositor* compositor() { return compositor_.get(); } | 51 ui::Compositor* compositor() { return compositor_.get(); } |
54 | 52 |
55 Window* window() { return window_.get(); } | 53 Window* window() { return window_.get(); } |
56 | 54 |
57 static Desktop* GetInstance(); | 55 static Desktop* GetInstance(); |
58 | 56 |
59 private: | 57 private: |
| 58 // Overridden from ui::CompositorDelegate |
| 59 virtual void ScheduleCompositorPaint(); |
| 60 |
60 scoped_refptr<ui::Compositor> compositor_; | 61 scoped_refptr<ui::Compositor> compositor_; |
61 | 62 |
62 scoped_ptr<internal::RootWindow> window_; | 63 scoped_ptr<internal::RootWindow> window_; |
63 | 64 |
64 DesktopHost* host_; | 65 DesktopHost* host_; |
65 | 66 |
66 static Desktop* instance_; | 67 static Desktop* instance_; |
67 | 68 |
| 69 // Used to schedule painting. |
| 70 ScopedRunnableMethodFactory<Desktop> schedule_paint_; |
| 71 |
68 DISALLOW_COPY_AND_ASSIGN(Desktop); | 72 DISALLOW_COPY_AND_ASSIGN(Desktop); |
69 }; | 73 }; |
70 | 74 |
71 } // namespace aura | 75 } // namespace aura |
72 | 76 |
73 #endif // AURA_DESKTOP_H_ | 77 #endif // AURA_DESKTOP_H_ |
OLD | NEW |