Chromium Code Reviews| 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/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
| 15 | 15 |
| 16 namespace gfx { | 16 namespace gfx { |
| 17 class Insets; | 17 class Insets; |
| 18 class Point; | 18 class Point; |
| 19 class Rect; | 19 class Rect; |
| 20 class Size; | 20 class Size; |
| 21 class Transform; | 21 class Transform; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace ui { | 24 namespace ui { |
| 25 class Compositor; | 25 class Compositor; |
| 26 class ViewProp; | |
| 26 } | 27 } |
| 27 | 28 |
| 28 namespace aura { | 29 namespace aura { |
| 29 class RootWindowTransformer; | 30 class RootWindowTransformer; |
| 30 class WindowEventDispatcher; | 31 class WindowEventDispatcher; |
| 31 class WindowTreeHostDelegate; | 32 class WindowTreeHostDelegate; |
| 32 | 33 |
| 33 // WindowTreeHost bridges between a native window and the embedded RootWindow. | 34 // WindowTreeHost bridges between a native window and the embedded RootWindow. |
| 34 // It provides the accelerated widget and maps events from the native os to | 35 // It provides the accelerated widget and maps events from the native os to |
| 35 // aura. | 36 // aura. |
| 36 class AURA_EXPORT WindowTreeHost { | 37 class AURA_EXPORT WindowTreeHost { |
| 37 public: | 38 public: |
| 38 virtual ~WindowTreeHost(); | 39 virtual ~WindowTreeHost(); |
| 39 | 40 |
| 40 // Creates a new WindowTreeHost. The caller owns the returned value. | 41 // Creates a new WindowTreeHost. The caller owns the returned value. |
| 41 static WindowTreeHost* Create(const gfx::Rect& bounds); | 42 static WindowTreeHost* Create(const gfx::Rect& bounds); |
| 42 | 43 |
| 44 // Returns the WindowTreeHost for the specified accelerated widget, or NULL | |
| 45 // if there is none associated. | |
| 46 static WindowTreeHost* GetForAcceleratedWidget(gfx::AcceleratedWidget widget); | |
| 47 | |
| 43 void InitHost(); | 48 void InitHost(); |
| 44 | 49 |
| 45 void InitCompositor(); | 50 void InitCompositor(); |
| 46 | 51 |
| 47 // TODO(beng): these will become trivial accessors in a future CL. | 52 Window* window() { return window_; } |
| 48 Window* window(); | 53 const Window* window() const { return window_; } |
| 49 const Window* window() const; | |
| 50 | 54 |
| 51 WindowEventDispatcher* dispatcher() { | 55 WindowEventDispatcher* dispatcher() { |
| 52 return const_cast<WindowEventDispatcher*>( | 56 return const_cast<WindowEventDispatcher*>( |
| 53 const_cast<const WindowTreeHost*>(this)->dispatcher()); | 57 const_cast<const WindowTreeHost*>(this)->dispatcher()); |
| 54 } | 58 } |
| 55 const WindowEventDispatcher* dispatcher() const { return dispatcher_.get(); } | 59 const WindowEventDispatcher* dispatcher() const { return dispatcher_.get(); } |
| 56 | 60 |
| 57 ui::Compositor* compositor() { return compositor_.get(); } | 61 ui::Compositor* compositor() { return compositor_.get(); } |
| 58 | 62 |
| 59 void SetRootWindowTransformer(scoped_ptr<RootWindowTransformer> transformer); | 63 void SetRootWindowTransformer(scoped_ptr<RootWindowTransformer> transformer); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 186 virtual void OnCursorVisibilityChangedNative(bool show) = 0; | 190 virtual void OnCursorVisibilityChangedNative(bool show) = 0; |
| 187 | 191 |
| 188 WindowTreeHostDelegate* delegate_; | 192 WindowTreeHostDelegate* delegate_; |
| 189 | 193 |
| 190 private: | 194 private: |
| 191 // Moves the cursor to the specified location. This method is internally used | 195 // Moves the cursor to the specified location. This method is internally used |
| 192 // by MoveCursorTo() and MoveCursorToHostLocation(). | 196 // by MoveCursorTo() and MoveCursorToHostLocation(). |
| 193 void MoveCursorToInternal(const gfx::Point& root_location, | 197 void MoveCursorToInternal(const gfx::Point& root_location, |
| 194 const gfx::Point& host_location); | 198 const gfx::Point& host_location); |
| 195 | 199 |
| 200 Window* window_; // Owning. | |
|
sky
2014/03/04 00:25:49
Can you document why this isn't a scoped_ptr.
| |
| 201 | |
| 196 scoped_ptr<WindowEventDispatcher> dispatcher_; | 202 scoped_ptr<WindowEventDispatcher> dispatcher_; |
| 197 | 203 |
| 198 scoped_ptr<ui::Compositor> compositor_; | 204 scoped_ptr<ui::Compositor> compositor_; |
| 199 | 205 |
| 200 scoped_ptr<RootWindowTransformer> transformer_; | 206 scoped_ptr<RootWindowTransformer> transformer_; |
| 201 | 207 |
| 202 // Last cursor set. Used for testing. | 208 // Last cursor set. Used for testing. |
| 203 gfx::NativeCursor last_cursor_; | 209 gfx::NativeCursor last_cursor_; |
| 204 | 210 |
| 211 scoped_ptr<ui::ViewProp> prop_; | |
| 212 | |
| 205 DISALLOW_COPY_AND_ASSIGN(WindowTreeHost); | 213 DISALLOW_COPY_AND_ASSIGN(WindowTreeHost); |
| 206 }; | 214 }; |
| 207 | 215 |
| 208 } // namespace aura | 216 } // namespace aura |
| 209 | 217 |
| 210 #endif // UI_AURA_WINDOW_TREE_HOST_H_ | 218 #endif // UI_AURA_WINDOW_TREE_HOST_H_ |
| OLD | NEW |