| 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 17 matching lines...) Expand all Loading... |
| 28 class CopyOutputRequest; | 28 class CopyOutputRequest; |
| 29 class SurfaceIdAllocator; | 29 class SurfaceIdAllocator; |
| 30 class SurfaceManager; | 30 class SurfaceManager; |
| 31 } // namespace cc | 31 } // namespace cc |
| 32 | 32 |
| 33 namespace gles2 { | 33 namespace gles2 { |
| 34 class GpuState; | 34 class GpuState; |
| 35 } // namespace gles2 | 35 } // namespace gles2 |
| 36 | 36 |
| 37 namespace mojo { | 37 namespace mojo { |
| 38 class Shell; | 38 class Connector; |
| 39 } // namespace mojo | 39 } // namespace mojo |
| 40 | 40 |
| 41 namespace ui { | 41 namespace ui { |
| 42 class CursorLoader; | 42 class CursorLoader; |
| 43 class PlatformWindow; | 43 class PlatformWindow; |
| 44 struct TextInputState; | 44 struct TextInputState; |
| 45 } // namespace ui | 45 } // namespace ui |
| 46 | 46 |
| 47 namespace mus { | 47 namespace mus { |
| 48 | 48 |
| 49 class GpuState; | 49 class GpuState; |
| 50 class SurfacesState; | 50 class SurfacesState; |
| 51 class TopLevelDisplayClient; | 51 class TopLevelDisplayClient; |
| 52 | 52 |
| 53 namespace ws { | 53 namespace ws { |
| 54 | 54 |
| 55 class DisplayManagerFactory; | 55 class DisplayManagerFactory; |
| 56 class EventDispatcher; | 56 class EventDispatcher; |
| 57 class ServerWindow; | 57 class ServerWindow; |
| 58 | 58 |
| 59 // DisplayManager is used to connect the root ServerWindow to a display. | 59 // DisplayManager is used to connect the root ServerWindow to a display. |
| 60 // TODO(sky): rename this given we have a mojom type with the same name now. | 60 // TODO(sky): rename this given we have a mojom type with the same name now. |
| 61 class DisplayManager { | 61 class DisplayManager { |
| 62 public: | 62 public: |
| 63 virtual ~DisplayManager() {} | 63 virtual ~DisplayManager() {} |
| 64 | 64 |
| 65 static DisplayManager* Create( | 65 static DisplayManager* Create( |
| 66 mojo::Shell* shell, | 66 mojo::Connector* connector, |
| 67 const scoped_refptr<GpuState>& gpu_state, | 67 const scoped_refptr<GpuState>& gpu_state, |
| 68 const scoped_refptr<SurfacesState>& surfaces_state); | 68 const scoped_refptr<SurfacesState>& surfaces_state); |
| 69 | 69 |
| 70 virtual void Init(DisplayManagerDelegate* delegate) = 0; | 70 virtual void Init(DisplayManagerDelegate* delegate) = 0; |
| 71 | 71 |
| 72 // Schedules a paint for the specified region in the coordinates of |window|. | 72 // Schedules a paint for the specified region in the coordinates of |window|. |
| 73 virtual void SchedulePaint(const ServerWindow* window, | 73 virtual void SchedulePaint(const ServerWindow* window, |
| 74 const gfx::Rect& bounds) = 0; | 74 const gfx::Rect& bounds) = 0; |
| 75 | 75 |
| 76 virtual void SetViewportSize(const gfx::Size& size) = 0; | 76 virtual void SetViewportSize(const gfx::Size& size) = 0; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 105 private: | 105 private: |
| 106 // Static factory instance (always NULL for non-test). | 106 // Static factory instance (always NULL for non-test). |
| 107 static DisplayManagerFactory* factory_; | 107 static DisplayManagerFactory* factory_; |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 // DisplayManager implementation that connects to the services necessary to | 110 // DisplayManager implementation that connects to the services necessary to |
| 111 // actually display. | 111 // actually display. |
| 112 class DefaultDisplayManager : public DisplayManager, | 112 class DefaultDisplayManager : public DisplayManager, |
| 113 public ui::PlatformWindowDelegate { | 113 public ui::PlatformWindowDelegate { |
| 114 public: | 114 public: |
| 115 DefaultDisplayManager(mojo::Shell* shell, | 115 DefaultDisplayManager(mojo::Connector* connector, |
| 116 const scoped_refptr<GpuState>& gpu_state, | 116 const scoped_refptr<GpuState>& gpu_state, |
| 117 const scoped_refptr<SurfacesState>& surfaces_state); | 117 const scoped_refptr<SurfacesState>& surfaces_state); |
| 118 ~DefaultDisplayManager() override; | 118 ~DefaultDisplayManager() override; |
| 119 | 119 |
| 120 // DisplayManager: | 120 // DisplayManager: |
| 121 void Init(DisplayManagerDelegate* delegate) override; | 121 void Init(DisplayManagerDelegate* delegate) override; |
| 122 void SchedulePaint(const ServerWindow* window, | 122 void SchedulePaint(const ServerWindow* window, |
| 123 const gfx::Rect& bounds) override; | 123 const gfx::Rect& bounds) override; |
| 124 void SetViewportSize(const gfx::Size& size) override; | 124 void SetViewportSize(const gfx::Size& size) override; |
| 125 void SetTitle(const base::string16& title) override; | 125 void SetTitle(const base::string16& title) override; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 155 void DispatchEvent(ui::Event* event) override; | 155 void DispatchEvent(ui::Event* event) override; |
| 156 void OnCloseRequest() override; | 156 void OnCloseRequest() override; |
| 157 void OnClosed() override; | 157 void OnClosed() override; |
| 158 void OnWindowStateChanged(ui::PlatformWindowState new_state) override; | 158 void OnWindowStateChanged(ui::PlatformWindowState new_state) override; |
| 159 void OnLostCapture() override; | 159 void OnLostCapture() override; |
| 160 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, | 160 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, |
| 161 float device_pixel_ratio) override; | 161 float device_pixel_ratio) override; |
| 162 void OnAcceleratedWidgetDestroyed() override; | 162 void OnAcceleratedWidgetDestroyed() override; |
| 163 void OnActivationChanged(bool active) override; | 163 void OnActivationChanged(bool active) override; |
| 164 | 164 |
| 165 mojo::Shell* shell_; | 165 mojo::Connector* connector_; |
| 166 scoped_refptr<GpuState> gpu_state_; | 166 scoped_refptr<GpuState> gpu_state_; |
| 167 scoped_refptr<SurfacesState> surfaces_state_; | 167 scoped_refptr<SurfacesState> surfaces_state_; |
| 168 DisplayManagerDelegate* delegate_; | 168 DisplayManagerDelegate* delegate_; |
| 169 | 169 |
| 170 mojom::ViewportMetrics metrics_; | 170 mojom::ViewportMetrics metrics_; |
| 171 gfx::Rect dirty_rect_; | 171 gfx::Rect dirty_rect_; |
| 172 base::Timer draw_timer_; | 172 base::Timer draw_timer_; |
| 173 bool frame_pending_; | 173 bool frame_pending_; |
| 174 | 174 |
| 175 scoped_ptr<TopLevelDisplayClient> top_level_display_client_; | 175 scoped_ptr<TopLevelDisplayClient> top_level_display_client_; |
| 176 scoped_ptr<ui::PlatformWindow> platform_window_; | 176 scoped_ptr<ui::PlatformWindow> platform_window_; |
| 177 | 177 |
| 178 #if !defined(OS_ANDROID) | 178 #if !defined(OS_ANDROID) |
| 179 scoped_ptr<ui::CursorLoader> cursor_loader_; | 179 scoped_ptr<ui::CursorLoader> cursor_loader_; |
| 180 #endif | 180 #endif |
| 181 | 181 |
| 182 base::WeakPtrFactory<DefaultDisplayManager> weak_factory_; | 182 base::WeakPtrFactory<DefaultDisplayManager> weak_factory_; |
| 183 | 183 |
| 184 DISALLOW_COPY_AND_ASSIGN(DefaultDisplayManager); | 184 DISALLOW_COPY_AND_ASSIGN(DefaultDisplayManager); |
| 185 }; | 185 }; |
| 186 | 186 |
| 187 } // namespace ws | 187 } // namespace ws |
| 188 | 188 |
| 189 } // namespace mus | 189 } // namespace mus |
| 190 | 190 |
| 191 #endif // COMPONENTS_MUS_WS_DISPLAY_MANAGER_H_ | 191 #endif // COMPONENTS_MUS_WS_DISPLAY_MANAGER_H_ |
| OLD | NEW |