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/window.h" | 9 #include "aura/window.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "ui/gfx/native_widget_types.h" | 12 #include "ui/gfx/native_widget_types.h" |
13 | 13 |
14 namespace gfx { | 14 namespace gfx { |
15 class Size; | 15 class Size; |
16 } | 16 } |
17 | 17 |
18 namespace ui { | 18 namespace ui { |
19 class Compositor; | 19 class Compositor; |
20 } | 20 } |
21 | 21 |
22 namespace aura { | 22 namespace aura { |
23 | 23 |
24 class DesktopHost; | |
25 class MouseEvent; | 24 class MouseEvent; |
26 class Window; | 25 class Window; |
27 | 26 |
28 // Desktop is responsible for hosting a set of windows. | 27 // Desktop is responsible for hosting a set of windows. |
29 class Desktop { | 28 class Desktop { |
30 public: | 29 public: |
31 Desktop(); | 30 Desktop(gfx::AcceleratedWidget widget, const gfx::Size& size); |
32 ~Desktop(); | 31 ~Desktop(); |
33 | 32 |
34 // Shows the desktop host and runs an event loop for it. | |
35 void Run(); | |
36 | |
37 // Draws the necessary set of windows. | 33 // Draws the necessary set of windows. |
38 void Draw(); | 34 void Draw(); |
39 | 35 |
40 // Handles a mouse event. Returns true if handled. | 36 // Handles a mouse event. Returns true if handled. |
41 bool OnMouseEvent(const MouseEvent& event); | 37 bool OnMouseEvent(const MouseEvent& event); |
42 | 38 |
43 // Compositor we're drawing to. | 39 // Compositor we're drawing to. |
44 ui::Compositor* compositor() { return compositor_.get(); } | 40 ui::Compositor* compositor() { return compositor_.get(); } |
45 | 41 |
46 Window* window() { return window_.get(); } | 42 Window* window() { return window_.get(); } |
47 | 43 |
48 static Desktop* GetInstance(); | |
49 | |
50 private: | 44 private: |
51 scoped_refptr<ui::Compositor> compositor_; | 45 scoped_refptr<ui::Compositor> compositor_; |
52 | 46 |
53 scoped_ptr<Window> window_; | 47 scoped_ptr<Window> window_; |
54 | 48 |
55 DesktopHost* host_; | |
56 | |
57 static Desktop* instance_; | |
58 | |
59 DISALLOW_COPY_AND_ASSIGN(Desktop); | 49 DISALLOW_COPY_AND_ASSIGN(Desktop); |
60 }; | 50 }; |
61 | 51 |
62 } // namespace aura | 52 } // namespace aura |
63 | 53 |
64 #endif // AURA_DESKTOP_H_ | 54 #endif // AURA_DESKTOP_H_ |
OLD | NEW |