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_DISPLAY_MANAGER_H_ | 5 #ifndef COMPONENTS_MUS_DISPLAY_MANAGER_H_ |
6 #define COMPONENTS_MUS_DISPLAY_MANAGER_H_ | 6 #define COMPONENTS_MUS_DISPLAY_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 } // namespace cc | 24 } // namespace cc |
25 | 25 |
26 namespace gles2 { | 26 namespace gles2 { |
27 class GpuState; | 27 class GpuState; |
28 } // namespace gles2 | 28 } // namespace gles2 |
29 | 29 |
30 namespace mojo { | 30 namespace mojo { |
31 class ApplicationImpl; | 31 class ApplicationImpl; |
32 } // namespace mojo | 32 } // namespace mojo |
33 | 33 |
| 34 namespace surfaces { |
| 35 class SurfacesScheduler; |
| 36 class SurfacesState; |
| 37 } // namespace surfaces |
| 38 |
34 namespace ui { | 39 namespace ui { |
35 class PlatformWindow; | 40 class PlatformWindow; |
36 struct TextInputState; | 41 struct TextInputState; |
37 } // namespace ui | 42 } // namespace ui |
38 | 43 |
39 namespace mus { | 44 namespace view_manager { |
40 | 45 |
41 class DisplayManagerFactory; | 46 class DisplayManagerFactory; |
42 class EventDispatcher; | 47 class EventDispatcher; |
43 class ServerView; | 48 class ServerView; |
44 class SurfacesScheduler; | |
45 class SurfacesState; | |
46 | 49 |
47 // DisplayManager is used to connect the root ServerView to a display. | 50 // DisplayManager is used to connect the root ServerView to a display. |
48 class DisplayManager { | 51 class DisplayManager { |
49 public: | 52 public: |
50 virtual ~DisplayManager() {} | 53 virtual ~DisplayManager() {} |
51 | 54 |
52 static DisplayManager* Create( | 55 static DisplayManager* Create( |
53 bool is_headless, | 56 bool is_headless, |
54 mojo::ApplicationImpl* app_impl, | 57 mojo::ApplicationImpl* app_impl, |
55 const scoped_refptr<GpuState>& gpu_state, | 58 const scoped_refptr<gles2::GpuState>& gpu_state, |
56 const scoped_refptr<SurfacesState>& surfaces_state); | 59 const scoped_refptr<surfaces::SurfacesState>& surfaces_state); |
57 | 60 |
58 virtual void Init(DisplayManagerDelegate* delegate) = 0; | 61 virtual void Init(DisplayManagerDelegate* delegate) = 0; |
59 | 62 |
60 // Schedules a paint for the specified region in the coordinates of |view|. | 63 // Schedules a paint for the specified region in the coordinates of |view|. |
61 virtual void SchedulePaint(const ServerView* view, | 64 virtual void SchedulePaint(const ServerView* view, |
62 const gfx::Rect& bounds) = 0; | 65 const gfx::Rect& bounds) = 0; |
63 | 66 |
64 virtual void SetViewportSize(const gfx::Size& size) = 0; | 67 virtual void SetViewportSize(const gfx::Size& size) = 0; |
65 | 68 |
66 virtual void SetTitle(const base::string16& title) = 0; | 69 virtual void SetTitle(const base::string16& title) = 0; |
(...skipping 12 matching lines...) Expand all Loading... |
79 private: | 82 private: |
80 // Static factory instance (always NULL for non-test). | 83 // Static factory instance (always NULL for non-test). |
81 static DisplayManagerFactory* factory_; | 84 static DisplayManagerFactory* factory_; |
82 }; | 85 }; |
83 | 86 |
84 // DisplayManager implementation that connects to the services necessary to | 87 // DisplayManager implementation that connects to the services necessary to |
85 // actually display. | 88 // actually display. |
86 class DefaultDisplayManager : public DisplayManager, | 89 class DefaultDisplayManager : public DisplayManager, |
87 public ui::PlatformWindowDelegate { | 90 public ui::PlatformWindowDelegate { |
88 public: | 91 public: |
89 DefaultDisplayManager(bool is_headless, | 92 DefaultDisplayManager( |
90 mojo::ApplicationImpl* app_impl, | 93 bool is_headless, |
91 const scoped_refptr<GpuState>& gpu_state, | 94 mojo::ApplicationImpl* app_impl, |
92 const scoped_refptr<SurfacesState>& surfaces_state); | 95 const scoped_refptr<gles2::GpuState>& gpu_state, |
| 96 const scoped_refptr<surfaces::SurfacesState>& surfaces_state); |
93 ~DefaultDisplayManager() override; | 97 ~DefaultDisplayManager() override; |
94 | 98 |
95 // DisplayManager: | 99 // DisplayManager: |
96 void Init(DisplayManagerDelegate* delegate) override; | 100 void Init(DisplayManagerDelegate* delegate) override; |
97 void SchedulePaint(const ServerView* view, const gfx::Rect& bounds) override; | 101 void SchedulePaint(const ServerView* view, const gfx::Rect& bounds) override; |
98 void SetViewportSize(const gfx::Size& size) override; | 102 void SetViewportSize(const gfx::Size& size) override; |
99 void SetTitle(const base::string16& title) override; | 103 void SetTitle(const base::string16& title) override; |
100 const mojo::ViewportMetrics& GetViewportMetrics() override; | 104 const mojo::ViewportMetrics& GetViewportMetrics() override; |
101 void UpdateTextInputState(const ui::TextInputState& state) override; | 105 void UpdateTextInputState(const ui::TextInputState& state) override; |
102 void SetImeVisibility(bool visible) override; | 106 void SetImeVisibility(bool visible) override; |
(...skipping 11 matching lines...) Expand all Loading... |
114 void OnCloseRequest() override; | 118 void OnCloseRequest() override; |
115 void OnClosed() override; | 119 void OnClosed() override; |
116 void OnWindowStateChanged(ui::PlatformWindowState new_state) override; | 120 void OnWindowStateChanged(ui::PlatformWindowState new_state) override; |
117 void OnLostCapture() override; | 121 void OnLostCapture() override; |
118 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, | 122 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, |
119 float device_pixel_ratio) override; | 123 float device_pixel_ratio) override; |
120 void OnActivationChanged(bool active) override; | 124 void OnActivationChanged(bool active) override; |
121 | 125 |
122 bool is_headless_; | 126 bool is_headless_; |
123 mojo::ApplicationImpl* app_impl_; | 127 mojo::ApplicationImpl* app_impl_; |
124 scoped_refptr<GpuState> gpu_state_; | 128 scoped_refptr<gles2::GpuState> gpu_state_; |
125 scoped_refptr<SurfacesState> surfaces_state_; | 129 scoped_refptr<surfaces::SurfacesState> surfaces_state_; |
126 DisplayManagerDelegate* delegate_; | 130 DisplayManagerDelegate* delegate_; |
127 | 131 |
128 mojo::ViewportMetrics metrics_; | 132 mojo::ViewportMetrics metrics_; |
129 gfx::Rect dirty_rect_; | 133 gfx::Rect dirty_rect_; |
130 base::Timer draw_timer_; | 134 base::Timer draw_timer_; |
131 bool frame_pending_; | 135 bool frame_pending_; |
132 | 136 |
133 scoped_ptr<TopLevelDisplayClient> top_level_display_client_; | 137 scoped_ptr<surfaces::TopLevelDisplayClient> top_level_display_client_; |
134 scoped_ptr<ui::PlatformWindow> platform_window_; | 138 scoped_ptr<ui::PlatformWindow> platform_window_; |
135 | 139 |
136 base::WeakPtrFactory<DefaultDisplayManager> weak_factory_; | 140 base::WeakPtrFactory<DefaultDisplayManager> weak_factory_; |
137 | 141 |
138 DISALLOW_COPY_AND_ASSIGN(DefaultDisplayManager); | 142 DISALLOW_COPY_AND_ASSIGN(DefaultDisplayManager); |
139 }; | 143 }; |
140 | 144 |
141 } // namespace mus | 145 } // namespace view_manager |
142 | 146 |
143 #endif // COMPONENTS_MUS_DISPLAY_MANAGER_H_ | 147 #endif // COMPONENTS_MUS_DISPLAY_MANAGER_H_ |
OLD | NEW |