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 COMPONENTS_MUS_WS_DISPLAY_MANAGER_H_ | 5 #ifndef COMPONENTS_MUS_WS_DISPLAY_MANAGER_H_ |
6 #define COMPONENTS_MUS_WS_DISPLAY_MANAGER_H_ | 6 #define COMPONENTS_MUS_WS_DISPLAY_MANAGER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 15 matching lines...) Expand all Loading... |
26 class CompositorFrame; | 26 class CompositorFrame; |
27 class SurfaceIdAllocator; | 27 class SurfaceIdAllocator; |
28 class SurfaceManager; | 28 class SurfaceManager; |
29 } // namespace cc | 29 } // namespace cc |
30 | 30 |
31 namespace gles2 { | 31 namespace gles2 { |
32 class GpuState; | 32 class GpuState; |
33 } // namespace gles2 | 33 } // namespace gles2 |
34 | 34 |
35 namespace mojo { | 35 namespace mojo { |
36 class ApplicationImpl; | 36 class Shell; |
37 } // namespace mojo | 37 } // namespace mojo |
38 | 38 |
39 namespace ui { | 39 namespace ui { |
40 class CursorLoader; | 40 class CursorLoader; |
41 class PlatformWindow; | 41 class PlatformWindow; |
42 struct TextInputState; | 42 struct TextInputState; |
43 } // namespace ui | 43 } // namespace ui |
44 | 44 |
45 namespace mus { | 45 namespace mus { |
46 | 46 |
47 class GpuState; | 47 class GpuState; |
48 class SurfacesState; | 48 class SurfacesState; |
49 class TopLevelDisplayClient; | 49 class TopLevelDisplayClient; |
50 | 50 |
51 namespace ws { | 51 namespace ws { |
52 | 52 |
53 class DisplayManagerFactory; | 53 class DisplayManagerFactory; |
54 class EventDispatcher; | 54 class EventDispatcher; |
55 class ServerWindow; | 55 class ServerWindow; |
56 | 56 |
57 // DisplayManager is used to connect the root ServerWindow to a display. | 57 // DisplayManager is used to connect the root ServerWindow to a display. |
58 // TODO(sky): rename this given we have a mojom type with the same name now. | 58 // TODO(sky): rename this given we have a mojom type with the same name now. |
59 class DisplayManager { | 59 class DisplayManager { |
60 public: | 60 public: |
61 virtual ~DisplayManager() {} | 61 virtual ~DisplayManager() {} |
62 | 62 |
63 static DisplayManager* Create( | 63 static DisplayManager* Create( |
64 mojo::ApplicationImpl* app_impl, | 64 mojo::Shell* shell, |
65 const scoped_refptr<GpuState>& gpu_state, | 65 const scoped_refptr<GpuState>& gpu_state, |
66 const scoped_refptr<SurfacesState>& surfaces_state); | 66 const scoped_refptr<SurfacesState>& surfaces_state); |
67 | 67 |
68 virtual void Init(DisplayManagerDelegate* delegate) = 0; | 68 virtual void Init(DisplayManagerDelegate* delegate) = 0; |
69 | 69 |
70 // Schedules a paint for the specified region in the coordinates of |window|. | 70 // Schedules a paint for the specified region in the coordinates of |window|. |
71 virtual void SchedulePaint(const ServerWindow* window, | 71 virtual void SchedulePaint(const ServerWindow* window, |
72 const gfx::Rect& bounds) = 0; | 72 const gfx::Rect& bounds) = 0; |
73 | 73 |
74 virtual void SetViewportSize(const gfx::Size& size) = 0; | 74 virtual void SetViewportSize(const gfx::Size& size) = 0; |
(...skipping 21 matching lines...) Expand all Loading... |
96 private: | 96 private: |
97 // Static factory instance (always NULL for non-test). | 97 // Static factory instance (always NULL for non-test). |
98 static DisplayManagerFactory* factory_; | 98 static DisplayManagerFactory* factory_; |
99 }; | 99 }; |
100 | 100 |
101 // DisplayManager implementation that connects to the services necessary to | 101 // DisplayManager implementation that connects to the services necessary to |
102 // actually display. | 102 // actually display. |
103 class DefaultDisplayManager : public DisplayManager, | 103 class DefaultDisplayManager : public DisplayManager, |
104 public ui::PlatformWindowDelegate { | 104 public ui::PlatformWindowDelegate { |
105 public: | 105 public: |
106 DefaultDisplayManager(mojo::ApplicationImpl* app_impl, | 106 DefaultDisplayManager(mojo::Shell* shell, |
107 const scoped_refptr<GpuState>& gpu_state, | 107 const scoped_refptr<GpuState>& gpu_state, |
108 const scoped_refptr<SurfacesState>& surfaces_state); | 108 const scoped_refptr<SurfacesState>& surfaces_state); |
109 ~DefaultDisplayManager() override; | 109 ~DefaultDisplayManager() override; |
110 | 110 |
111 // DisplayManager: | 111 // DisplayManager: |
112 void Init(DisplayManagerDelegate* delegate) override; | 112 void Init(DisplayManagerDelegate* delegate) override; |
113 void SchedulePaint(const ServerWindow* window, | 113 void SchedulePaint(const ServerWindow* window, |
114 const gfx::Rect& bounds) override; | 114 const gfx::Rect& bounds) override; |
115 void SetViewportSize(const gfx::Size& size) override; | 115 void SetViewportSize(const gfx::Size& size) override; |
116 void SetTitle(const base::string16& title) override; | 116 void SetTitle(const base::string16& title) override; |
(...skipping 25 matching lines...) Expand all Loading... |
142 void DispatchEvent(ui::Event* event) override; | 142 void DispatchEvent(ui::Event* event) override; |
143 void OnCloseRequest() override; | 143 void OnCloseRequest() override; |
144 void OnClosed() override; | 144 void OnClosed() override; |
145 void OnWindowStateChanged(ui::PlatformWindowState new_state) override; | 145 void OnWindowStateChanged(ui::PlatformWindowState new_state) override; |
146 void OnLostCapture() override; | 146 void OnLostCapture() override; |
147 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, | 147 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, |
148 float device_pixel_ratio) override; | 148 float device_pixel_ratio) override; |
149 void OnAcceleratedWidgetDestroyed() override; | 149 void OnAcceleratedWidgetDestroyed() override; |
150 void OnActivationChanged(bool active) override; | 150 void OnActivationChanged(bool active) override; |
151 | 151 |
152 mojo::ApplicationImpl* app_impl_; | 152 mojo::Shell* shell_; |
153 scoped_refptr<GpuState> gpu_state_; | 153 scoped_refptr<GpuState> gpu_state_; |
154 scoped_refptr<SurfacesState> surfaces_state_; | 154 scoped_refptr<SurfacesState> surfaces_state_; |
155 DisplayManagerDelegate* delegate_; | 155 DisplayManagerDelegate* delegate_; |
156 | 156 |
157 mojom::ViewportMetrics metrics_; | 157 mojom::ViewportMetrics metrics_; |
158 gfx::Rect dirty_rect_; | 158 gfx::Rect dirty_rect_; |
159 base::Timer draw_timer_; | 159 base::Timer draw_timer_; |
160 bool frame_pending_; | 160 bool frame_pending_; |
161 | 161 |
162 scoped_ptr<TopLevelDisplayClient> top_level_display_client_; | 162 scoped_ptr<TopLevelDisplayClient> top_level_display_client_; |
163 scoped_ptr<ui::PlatformWindow> platform_window_; | 163 scoped_ptr<ui::PlatformWindow> platform_window_; |
164 | 164 |
165 #if !defined(OS_ANDROID) | 165 #if !defined(OS_ANDROID) |
166 scoped_ptr<ui::CursorLoader> cursor_loader_; | 166 scoped_ptr<ui::CursorLoader> cursor_loader_; |
167 #endif | 167 #endif |
168 | 168 |
169 base::WeakPtrFactory<DefaultDisplayManager> weak_factory_; | 169 base::WeakPtrFactory<DefaultDisplayManager> weak_factory_; |
170 | 170 |
171 DISALLOW_COPY_AND_ASSIGN(DefaultDisplayManager); | 171 DISALLOW_COPY_AND_ASSIGN(DefaultDisplayManager); |
172 }; | 172 }; |
173 | 173 |
174 } // namespace ws | 174 } // namespace ws |
175 | 175 |
176 } // namespace mus | 176 } // namespace mus |
177 | 177 |
178 #endif // COMPONENTS_MUS_WS_DISPLAY_MANAGER_H_ | 178 #endif // COMPONENTS_MUS_WS_DISPLAY_MANAGER_H_ |
OLD | NEW |