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 UI_AURA_DESKTOP_HOST_H_ | 5 #ifndef UI_AURA_ROOT_WINDOW_HOST_H_ |
6 #define UI_AURA_DESKTOP_HOST_H_ | 6 #define UI_AURA_ROOT_WINDOW_HOST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "ui/aura/cursor.h" | 10 #include "ui/aura/cursor.h" |
11 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
12 | 12 |
13 namespace gfx { | 13 namespace gfx { |
14 class Point; | 14 class Point; |
15 class Rect; | 15 class Rect; |
16 class Size; | 16 class Size; |
17 } | 17 } |
18 | 18 |
19 namespace aura { | 19 namespace aura { |
20 | 20 |
21 class Desktop; | 21 class RootWindow; |
22 | 22 |
23 // DesktopHost bridges between a native window and the embedded Desktop. It | 23 // RootWindowHost bridges between a native window and the embedded RootWindow. |
24 // provides the accelerated widget and maps events from the native os to aura. | 24 // It provides the accelerated widget and maps events from the native os to |
25 class DesktopHost : public MessageLoop::Dispatcher { | 25 // aura. |
| 26 class RootWindowHost : public MessageLoop::Dispatcher { |
26 public: | 27 public: |
27 virtual ~DesktopHost() {} | 28 virtual ~RootWindowHost() {} |
28 | 29 |
29 // Creates a new DesktopHost. The caller owns the returned value. | 30 // Creates a new RootWindowHost. The caller owns the returned value. |
30 static DesktopHost* Create(const gfx::Rect& bounds); | 31 static RootWindowHost* Create(const gfx::Rect& bounds); |
31 | 32 |
32 // Returns the actual size of the screen. | 33 // Returns the actual size of the screen. |
33 // (gfx::Screen only reports on the virtual desktop exposed by Aura.) | 34 // (gfx::Screen only reports on the virtual desktop exposed by Aura.) |
34 static gfx::Size GetNativeScreenSize(); | 35 static gfx::Size GetNativeScreenSize(); |
35 | 36 |
36 // Sets the Desktop this DesktopHost is hosting. DesktopHost does not own the | 37 // Sets the RootWindow this RootWindowHost is hosting. RootWindowHost does not |
37 // Desktop. | 38 // own the RootWindow. |
38 virtual void SetDesktop(Desktop* desktop) = 0; | 39 virtual void SetRootWindow(RootWindow* root_window) = 0; |
39 | 40 |
40 // Returns the accelerated widget. | 41 // Returns the accelerated widget. |
41 virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; | 42 virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; |
42 | 43 |
43 // Shows the DesktopHost. | 44 // Shows the RootWindowHost. |
44 virtual void Show() = 0; | 45 virtual void Show() = 0; |
45 | 46 |
46 // Toggles the host's full screen state. | 47 // Toggles the host's full screen state. |
47 virtual void ToggleFullScreen() = 0; | 48 virtual void ToggleFullScreen() = 0; |
48 | 49 |
49 // Gets/Sets the size of the DesktopHost. | 50 // Gets/Sets the size of the RootWindowHost. |
50 virtual gfx::Size GetSize() const = 0; | 51 virtual gfx::Size GetSize() const = 0; |
51 virtual void SetSize(const gfx::Size& size) = 0; | 52 virtual void SetSize(const gfx::Size& size) = 0; |
52 | 53 |
53 // Returns the location of the desktop on native screen. | 54 // Returns the location of the RootWindow on native screen. |
54 virtual gfx::Point GetLocationOnNativeScreen() const = 0; | 55 virtual gfx::Point GetLocationOnNativeScreen() const = 0; |
55 | 56 |
56 // Sets the currently displayed cursor. | 57 // Sets the currently displayed cursor. |
57 virtual void SetCursor(gfx::NativeCursor cursor) = 0; | 58 virtual void SetCursor(gfx::NativeCursor cursor) = 0; |
58 | 59 |
59 // Queries the mouse's current position relative to the host window. | 60 // Queries the mouse's current position relative to the host window. |
60 // The position is constrained within the host window. | 61 // The position is constrained within the host window. |
61 // You should probably call Desktop::last_mouse_location() instead; this | 62 // You should probably call RootWindow::last_mouse_location() instead; this |
62 // method can be expensive. | 63 // method can be expensive. |
63 virtual gfx::Point QueryMouseLocation() = 0; | 64 virtual gfx::Point QueryMouseLocation() = 0; |
64 | 65 |
65 // Posts |native_event| to the platform's event queue. | 66 // Posts |native_event| to the platform's event queue. |
66 virtual void PostNativeEvent(const base::NativeEvent& native_event) = 0; | 67 virtual void PostNativeEvent(const base::NativeEvent& native_event) = 0; |
67 }; | 68 }; |
68 | 69 |
69 } // namespace aura | 70 } // namespace aura |
70 | 71 |
71 #endif // UI_AURA_DESKTOP_HOST_H_ | 72 #endif // UI_AURA_ROOT_WINDOW_HOST_H_ |
OLD | NEW |