| 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/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; | 24 class DesktopHost; |
| 25 class MouseEvent; | 25 class MouseEvent; |
| 26 class Window; |
| 26 | 27 |
| 27 // Desktop is responsible for hosting a set of windows. | 28 // Desktop is responsible for hosting a set of windows. |
| 28 class Desktop { | 29 class Desktop { |
| 29 public: | 30 public: |
| 30 Desktop(); | 31 Desktop(); |
| 31 ~Desktop(); | 32 ~Desktop(); |
| 32 | 33 |
| 33 // Shows the desktop host. | |
| 34 void Show(); | |
| 35 | |
| 36 // Sets the size of the desktop. | |
| 37 void SetSize(const gfx::Size& size); | |
| 38 | |
| 39 // Shows the desktop host and runs an event loop for it. | 34 // Shows the desktop host and runs an event loop for it. |
| 40 void Run(); | 35 void Run(); |
| 41 | 36 |
| 42 // Draws the necessary set of windows. | 37 // Draws the necessary set of windows. |
| 43 void Draw(); | 38 void Draw(); |
| 44 | 39 |
| 45 // Handles a mouse event. Returns true if handled. | 40 // Handles a mouse event. Returns true if handled. |
| 46 bool OnMouseEvent(const MouseEvent& event); | 41 bool OnMouseEvent(const MouseEvent& event); |
| 47 | 42 |
| 48 // Compositor we're drawing to. | 43 // Compositor we're drawing to. |
| 49 ui::Compositor* compositor() { return compositor_.get(); } | 44 ui::Compositor* compositor() { return compositor_.get(); } |
| 50 | 45 |
| 51 Window* window() { return window_.get(); } | 46 Window* window() { return window_.get(); } |
| 52 | 47 |
| 53 static Desktop* GetInstance(); | 48 static Desktop* GetInstance(); |
| 54 | 49 |
| 55 private: | 50 private: |
| 56 scoped_refptr<ui::Compositor> compositor_; | 51 scoped_refptr<ui::Compositor> compositor_; |
| 57 | 52 |
| 58 scoped_ptr<internal::RootWindow> window_; | 53 scoped_ptr<Window> window_; |
| 59 | 54 |
| 60 DesktopHost* host_; | 55 DesktopHost* host_; |
| 61 | 56 |
| 62 static Desktop* instance_; | 57 static Desktop* instance_; |
| 63 | 58 |
| 64 DISALLOW_COPY_AND_ASSIGN(Desktop); | 59 DISALLOW_COPY_AND_ASSIGN(Desktop); |
| 65 }; | 60 }; |
| 66 | 61 |
| 67 } // namespace aura | 62 } // namespace aura |
| 68 | 63 |
| 69 #endif // AURA_DESKTOP_H_ | 64 #endif // AURA_DESKTOP_H_ |
| OLD | NEW |