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_DESKTOP_HOST_H_ |
6 #define UI_AURA_DESKTOP_HOST_H_ | 6 #define UI_AURA_DESKTOP_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/base/ime/input_method_delegate.h" | |
12 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
13 | 12 |
14 namespace ui { | |
15 class InputMethod; | |
16 } | |
17 | |
18 namespace gfx { | 13 namespace gfx { |
19 class Point; | 14 class Point; |
20 class Rect; | 15 class Rect; |
21 class Size; | 16 class Size; |
22 } | 17 } |
23 | 18 |
24 namespace aura { | 19 namespace aura { |
25 | 20 |
26 class Desktop; | 21 class Desktop; |
27 | 22 |
28 // DesktopHost bridges between a native window and the embedded Desktop. It | 23 // DesktopHost bridges between a native window and the embedded Desktop. It |
29 // provides the accelerated widget and maps events from the native os to aura. | 24 // provides the accelerated widget and maps events from the native os to aura. |
30 class DesktopHost : public MessageLoop::Dispatcher, | 25 class DesktopHost : public MessageLoop::Dispatcher { |
31 public ui::internal::InputMethodDelegate { | |
32 public: | 26 public: |
33 virtual ~DesktopHost() {} | 27 virtual ~DesktopHost() {} |
34 | 28 |
35 // Creates a new DesktopHost. The caller owns the returned value. | 29 // Creates a new DesktopHost. The caller owns the returned value. |
36 static DesktopHost* Create(const gfx::Rect& bounds); | 30 static DesktopHost* Create(const gfx::Rect& bounds); |
37 | 31 |
38 // Returns the actual size of the screen. | 32 // Returns the actual size of the screen. |
39 // (gfx::Screen only reports on the virtual desktop exposed by Aura.) | 33 // (gfx::Screen only reports on the virtual desktop exposed by Aura.) |
40 static gfx::Size GetNativeScreenSize(); | 34 static gfx::Size GetNativeScreenSize(); |
41 | 35 |
(...skipping 21 matching lines...) Expand all Loading... |
63 virtual void SetCursor(gfx::NativeCursor cursor) = 0; | 57 virtual void SetCursor(gfx::NativeCursor cursor) = 0; |
64 | 58 |
65 // Queries the mouse's current position relative to the host window. | 59 // Queries the mouse's current position relative to the host window. |
66 // The position is constrained within the host window. | 60 // The position is constrained within the host window. |
67 // You should probably call Desktop::last_mouse_location() instead; this | 61 // You should probably call Desktop::last_mouse_location() instead; this |
68 // method can be expensive. | 62 // method can be expensive. |
69 virtual gfx::Point QueryMouseLocation() = 0; | 63 virtual gfx::Point QueryMouseLocation() = 0; |
70 | 64 |
71 // Posts |native_event| to the platform's event queue. | 65 // Posts |native_event| to the platform's event queue. |
72 virtual void PostNativeEvent(const base::NativeEvent& native_event) = 0; | 66 virtual void PostNativeEvent(const base::NativeEvent& native_event) = 0; |
73 | |
74 // Sets the input method for the desktop. DesktopHost owns the input method. | |
75 // The function is only for unit tests. | |
76 virtual void SetInputMethod(ui::InputMethod* input_method) = 0; | |
77 | |
78 // Gets the input method for the desktop. The caller does not own the returned | |
79 // value. | |
80 virtual ui::InputMethod* GetInputMethod() const = 0; | |
81 }; | 67 }; |
82 | 68 |
83 } // namespace aura | 69 } // namespace aura |
84 | 70 |
85 #endif // UI_AURA_DESKTOP_HOST_H_ | 71 #endif // UI_AURA_DESKTOP_HOST_H_ |
OLD | NEW |