OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_WINDOW_TREE_HOST_H_ | 5 #ifndef UI_AURA_WINDOW_TREE_HOST_H_ |
6 #define UI_AURA_WINDOW_TREE_HOST_H_ | 6 #define UI_AURA_WINDOW_TREE_HOST_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/event_types.h" | 10 #include "base/event_types.h" |
11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
12 #include "ui/aura/aura_export.h" | 12 #include "ui/aura/aura_export.h" |
13 #include "ui/base/cursor/cursor.h" | 13 #include "ui/base/cursor/cursor.h" |
14 #include "ui/events/event_source.h" | 14 #include "ui/events/event_source.h" |
15 #include "ui/gfx/native_widget_types.h" | 15 #include "ui/gfx/native_widget_types.h" |
16 | 16 |
17 namespace gfx { | 17 namespace gfx { |
18 class Insets; | 18 class Insets; |
19 class Point; | 19 class Point; |
20 class Rect; | 20 class Rect; |
21 class Size; | 21 class Size; |
22 class Transform; | 22 class Transform; |
23 } | 23 } |
24 | 24 |
25 namespace ui { | 25 namespace ui { |
26 class Compositor; | 26 class Compositor; |
| 27 class ContextFactory; |
27 class EventProcessor; | 28 class EventProcessor; |
28 class ViewProp; | 29 class ViewProp; |
29 } | 30 } |
30 | 31 |
31 namespace aura { | 32 namespace aura { |
32 namespace test { | 33 namespace test { |
33 class WindowTreeHostTestApi; | 34 class WindowTreeHostTestApi; |
34 } | 35 } |
35 | 36 |
36 class WindowEventDispatcher; | 37 class WindowEventDispatcher; |
37 class WindowTreeHostObserver; | 38 class WindowTreeHostObserver; |
38 | 39 |
39 // WindowTreeHost bridges between a native window and the embedded RootWindow. | 40 // WindowTreeHost bridges between a native window and the embedded RootWindow. |
40 // It provides the accelerated widget and maps events from the native os to | 41 // It provides the accelerated widget and maps events from the native os to |
41 // aura. | 42 // aura. |
42 class AURA_EXPORT WindowTreeHost { | 43 class AURA_EXPORT WindowTreeHost { |
43 public: | 44 public: |
44 virtual ~WindowTreeHost(); | 45 virtual ~WindowTreeHost(); |
45 | 46 |
46 // Creates a new WindowTreeHost. The caller owns the returned value. | 47 // Creates a new WindowTreeHost. The caller owns the returned value. |
47 static WindowTreeHost* Create(const gfx::Rect& bounds); | 48 static WindowTreeHost* Create(const gfx::Rect& bounds, |
| 49 ui::ContextFactory* context_factory); |
48 | 50 |
49 // Returns the WindowTreeHost for the specified accelerated widget, or NULL | 51 // Returns the WindowTreeHost for the specified accelerated widget, or NULL |
50 // if there is none associated. | 52 // if there is none associated. |
51 static WindowTreeHost* GetForAcceleratedWidget(gfx::AcceleratedWidget widget); | 53 static WindowTreeHost* GetForAcceleratedWidget(gfx::AcceleratedWidget widget); |
52 | 54 |
53 void InitHost(); | 55 void InitHost(); |
54 | 56 |
55 void InitCompositor(); | 57 void InitCompositor(); |
56 | 58 |
57 void AddObserver(WindowTreeHostObserver* observer); | 59 void AddObserver(WindowTreeHostObserver* observer); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 // Called when the device scale factor of the root window has chagned. | 147 // Called when the device scale factor of the root window has chagned. |
146 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) = 0; | 148 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) = 0; |
147 | 149 |
148 protected: | 150 protected: |
149 friend class TestScreen; // TODO(beng): see if we can remove/consolidate. | 151 friend class TestScreen; // TODO(beng): see if we can remove/consolidate. |
150 | 152 |
151 WindowTreeHost(); | 153 WindowTreeHost(); |
152 void DestroyCompositor(); | 154 void DestroyCompositor(); |
153 void DestroyDispatcher(); | 155 void DestroyDispatcher(); |
154 | 156 |
155 void CreateCompositor(gfx::AcceleratedWidget accelerated_widget); | 157 void CreateCompositor(gfx::AcceleratedWidget accelerated_widget, |
| 158 ui::ContextFactory* context_factory); |
156 | 159 |
157 // Returns the location of the RootWindow on native screen. | 160 // Returns the location of the RootWindow on native screen. |
158 virtual gfx::Point GetLocationOnNativeScreen() const = 0; | 161 virtual gfx::Point GetLocationOnNativeScreen() const = 0; |
159 | 162 |
160 void OnHostMoved(const gfx::Point& new_location); | 163 void OnHostMoved(const gfx::Point& new_location); |
161 void OnHostResized(const gfx::Size& new_size); | 164 void OnHostResized(const gfx::Size& new_size); |
162 void OnHostCloseRequested(); | 165 void OnHostCloseRequested(); |
163 void OnHostActivated(); | 166 void OnHostActivated(); |
164 void OnHostLostWindowCapture(); | 167 void OnHostLostWindowCapture(); |
165 | 168 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 gfx::Point last_cursor_request_position_in_host_; | 200 gfx::Point last_cursor_request_position_in_host_; |
198 | 201 |
199 scoped_ptr<ui::ViewProp> prop_; | 202 scoped_ptr<ui::ViewProp> prop_; |
200 | 203 |
201 DISALLOW_COPY_AND_ASSIGN(WindowTreeHost); | 204 DISALLOW_COPY_AND_ASSIGN(WindowTreeHost); |
202 }; | 205 }; |
203 | 206 |
204 } // namespace aura | 207 } // namespace aura |
205 | 208 |
206 #endif // UI_AURA_WINDOW_TREE_HOST_H_ | 209 #endif // UI_AURA_WINDOW_TREE_HOST_H_ |
OLD | NEW |