OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 MOJO_EXAMPLES_AURA_DEMO_WINDOW_TREE_HOST_VIEW_MANAGER_H_ | 5 #ifndef MOJO_EXAMPLES_AURA_DEMO_WINDOW_TREE_HOST_VIEW_MANAGER_H_ |
6 #define MOJO_EXAMPLES_AURA_DEMO_WINDOW_TREE_HOST_VIEW_MANAGER_H_ | 6 #define MOJO_EXAMPLES_AURA_DEMO_WINDOW_TREE_HOST_VIEW_MANAGER_H_ |
7 | 7 |
8 #include "ui/aura/window_tree_host.h" | 8 #include "ui/aura/window_tree_host.h" |
9 #include "ui/events/event_source.h" | 9 #include "ui/events/event_source.h" |
10 #include "ui/gfx/geometry/rect.h" | 10 #include "ui/gfx/geometry/rect.h" |
11 | 11 |
| 12 class SkBitmap; |
| 13 |
| 14 namespace ui { |
| 15 class Compositor; |
| 16 } |
| 17 |
12 namespace mojo { | 18 namespace mojo { |
13 namespace examples { | |
14 | 19 |
15 class WindowTreeHostViewManager : public aura::WindowTreeHost, | 20 class WindowTreeHostMojoDelegate; |
16 public ui::EventSource { | 21 |
| 22 class WindowTreeHostMojo : public aura::WindowTreeHost, public ui::EventSource { |
17 public: | 23 public: |
18 explicit WindowTreeHostViewManager(const gfx::Rect& bounds); | 24 WindowTreeHostMojo(const gfx::Rect& bounds, |
19 virtual ~WindowTreeHostViewManager(); | 25 WindowTreeHostMojoDelegate* delegate); |
| 26 virtual ~WindowTreeHostMojo(); |
| 27 |
| 28 // Returns the WindowTreeHostMojo for the specified compositor. |
| 29 static WindowTreeHostMojo* ForCompositor(ui::Compositor* compositor); |
20 | 30 |
21 const gfx::Rect& bounds() const { return bounds_; } | 31 const gfx::Rect& bounds() const { return bounds_; } |
22 | 32 |
| 33 // Sets the contents to show in this WindowTreeHost. This forwards to the |
| 34 // delegate. |
| 35 void SetContents(const SkBitmap& contents); |
| 36 |
23 private: | 37 private: |
24 // WindowTreeHost: | 38 // WindowTreeHost: |
25 virtual ui::EventSource* GetEventSource() OVERRIDE; | 39 virtual ui::EventSource* GetEventSource() OVERRIDE; |
26 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; | 40 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; |
27 virtual void Show() OVERRIDE; | 41 virtual void Show() OVERRIDE; |
28 virtual void Hide() OVERRIDE; | 42 virtual void Hide() OVERRIDE; |
29 virtual gfx::Rect GetBounds() const OVERRIDE; | 43 virtual gfx::Rect GetBounds() const OVERRIDE; |
30 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; | 44 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; |
31 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; | 45 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; |
32 virtual void SetCapture() OVERRIDE; | 46 virtual void SetCapture() OVERRIDE; |
33 virtual void ReleaseCapture() OVERRIDE; | 47 virtual void ReleaseCapture() OVERRIDE; |
34 virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; | 48 virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; |
35 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; | 49 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; |
36 virtual void SetCursorNative(gfx::NativeCursor cursor) OVERRIDE; | 50 virtual void SetCursorNative(gfx::NativeCursor cursor) OVERRIDE; |
37 virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE; | 51 virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE; |
38 virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE; | 52 virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE; |
39 | 53 |
40 // ui::EventSource: | 54 // ui::EventSource: |
41 virtual ui::EventProcessor* GetEventProcessor() OVERRIDE; | 55 virtual ui::EventProcessor* GetEventProcessor() OVERRIDE; |
42 | 56 |
43 gfx::Rect bounds_; | 57 gfx::Rect bounds_; |
44 | 58 |
45 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostViewManager); | 59 WindowTreeHostMojoDelegate* delegate_; |
| 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostMojo); |
46 }; | 62 }; |
47 | 63 |
48 } // namespace examples | |
49 } // namespace mojo | 64 } // namespace mojo |
50 | 65 |
51 #endif // MOJO_EXAMPLES_AURA_DEMO_WINDOW_TREE_HOST_VIEW_MANAGER_H_ | 66 #endif // MOJO_EXAMPLES_AURA_DEMO_WINDOW_TREE_HOST_VIEW_MANAGER_H_ |
OLD | NEW |