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> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
17 #include "components/mus/public/interfaces/window_manager_constants.mojom.h" | |
18 #include "components/mus/public/interfaces/window_tree.mojom.h" | 17 #include "components/mus/public/interfaces/window_tree.mojom.h" |
19 #include "components/mus/ws/display_manager_delegate.h" | 18 #include "components/mus/ws/display_manager_delegate.h" |
20 #include "mojo/public/cpp/bindings/callback.h" | 19 #include "mojo/public/cpp/bindings/callback.h" |
21 #include "ui/gfx/geometry/rect.h" | 20 #include "ui/gfx/geometry/rect.h" |
22 #include "ui/platform_window/platform_window_delegate.h" | 21 #include "ui/platform_window/platform_window_delegate.h" |
23 | 22 |
24 namespace cc { | 23 namespace cc { |
25 class CompositorFrame; | 24 class CompositorFrame; |
26 class SurfaceIdAllocator; | 25 class SurfaceIdAllocator; |
27 class SurfaceManager; | 26 class SurfaceManager; |
(...skipping 19 matching lines...) Expand all Loading... |
47 class SurfacesState; | 46 class SurfacesState; |
48 class TopLevelDisplayClient; | 47 class TopLevelDisplayClient; |
49 | 48 |
50 namespace ws { | 49 namespace ws { |
51 | 50 |
52 class DisplayManagerFactory; | 51 class DisplayManagerFactory; |
53 class EventDispatcher; | 52 class EventDispatcher; |
54 class ServerWindow; | 53 class ServerWindow; |
55 | 54 |
56 // DisplayManager is used to connect the root ServerWindow to a display. | 55 // DisplayManager is used to connect the root ServerWindow to a display. |
57 // TODO(sky): rename this given we have a mojom type with the same name now. | |
58 class DisplayManager { | 56 class DisplayManager { |
59 public: | 57 public: |
60 virtual ~DisplayManager() {} | 58 virtual ~DisplayManager() {} |
61 | 59 |
62 static DisplayManager* Create( | 60 static DisplayManager* Create( |
63 mojo::ApplicationImpl* app_impl, | 61 mojo::ApplicationImpl* app_impl, |
64 const scoped_refptr<GpuState>& gpu_state, | 62 const scoped_refptr<GpuState>& gpu_state, |
65 const scoped_refptr<SurfacesState>& surfaces_state); | 63 const scoped_refptr<SurfacesState>& surfaces_state); |
66 | 64 |
67 virtual void Init(DisplayManagerDelegate* delegate) = 0; | 65 virtual void Init(DisplayManagerDelegate* delegate) = 0; |
68 | 66 |
69 // Schedules a paint for the specified region in the coordinates of |window|. | 67 // Schedules a paint for the specified region in the coordinates of |window|. |
70 virtual void SchedulePaint(const ServerWindow* window, | 68 virtual void SchedulePaint(const ServerWindow* window, |
71 const gfx::Rect& bounds) = 0; | 69 const gfx::Rect& bounds) = 0; |
72 | 70 |
73 virtual void SetViewportSize(const gfx::Size& size) = 0; | 71 virtual void SetViewportSize(const gfx::Size& size) = 0; |
74 | 72 |
75 virtual void SetTitle(const base::string16& title) = 0; | 73 virtual void SetTitle(const base::string16& title) = 0; |
76 | 74 |
77 virtual void SetCursorById(int32_t cursor) = 0; | 75 virtual void SetCursorById(int32_t cursor) = 0; |
78 | 76 |
79 virtual mojom::Rotation GetRotation() = 0; | |
80 | |
81 virtual const mojom::ViewportMetrics& GetViewportMetrics() = 0; | 77 virtual const mojom::ViewportMetrics& GetViewportMetrics() = 0; |
82 | 78 |
83 virtual void UpdateTextInputState(const ui::TextInputState& state) = 0; | 79 virtual void UpdateTextInputState(const ui::TextInputState& state) = 0; |
84 virtual void SetImeVisibility(bool visible) = 0; | 80 virtual void SetImeVisibility(bool visible) = 0; |
85 | 81 |
86 // Returns true if a compositor frame has been submitted but not drawn yet. | 82 // Returns true if a compositor frame has been submitted but not drawn yet. |
87 virtual bool IsFramePending() const = 0; | 83 virtual bool IsFramePending() const = 0; |
88 | 84 |
89 // Overrides factory for testing. Default (NULL) value indicates regular | 85 // Overrides factory for testing. Default (NULL) value indicates regular |
90 // (non-test) environment. | 86 // (non-test) environment. |
(...skipping 17 matching lines...) Expand all Loading... |
108 ~DefaultDisplayManager() override; | 104 ~DefaultDisplayManager() override; |
109 | 105 |
110 // DisplayManager: | 106 // DisplayManager: |
111 void Init(DisplayManagerDelegate* delegate) override; | 107 void Init(DisplayManagerDelegate* delegate) override; |
112 void SchedulePaint(const ServerWindow* window, | 108 void SchedulePaint(const ServerWindow* window, |
113 const gfx::Rect& bounds) override; | 109 const gfx::Rect& bounds) override; |
114 void SetViewportSize(const gfx::Size& size) override; | 110 void SetViewportSize(const gfx::Size& size) override; |
115 void SetTitle(const base::string16& title) override; | 111 void SetTitle(const base::string16& title) override; |
116 void SetCursorById(int32_t cursor) override; | 112 void SetCursorById(int32_t cursor) override; |
117 const mojom::ViewportMetrics& GetViewportMetrics() override; | 113 const mojom::ViewportMetrics& GetViewportMetrics() override; |
118 mojom::Rotation GetRotation() override; | |
119 void UpdateTextInputState(const ui::TextInputState& state) override; | 114 void UpdateTextInputState(const ui::TextInputState& state) override; |
120 void SetImeVisibility(bool visible) override; | 115 void SetImeVisibility(bool visible) override; |
121 bool IsFramePending() const override; | 116 bool IsFramePending() const override; |
122 | 117 |
123 private: | 118 private: |
124 void WantToDraw(); | 119 void WantToDraw(); |
125 | 120 |
126 // This method initiates a top level redraw of the display. | 121 // This method initiates a top level redraw of the display. |
127 // TODO(fsamuel): This should use vblank as a signal rather than a timer | 122 // TODO(fsamuel): This should use vblank as a signal rather than a timer |
128 // http://crbug.com/533042 | 123 // http://crbug.com/533042 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 base::WeakPtrFactory<DefaultDisplayManager> weak_factory_; | 163 base::WeakPtrFactory<DefaultDisplayManager> weak_factory_; |
169 | 164 |
170 DISALLOW_COPY_AND_ASSIGN(DefaultDisplayManager); | 165 DISALLOW_COPY_AND_ASSIGN(DefaultDisplayManager); |
171 }; | 166 }; |
172 | 167 |
173 } // namespace ws | 168 } // namespace ws |
174 | 169 |
175 } // namespace mus | 170 } // namespace mus |
176 | 171 |
177 #endif // COMPONENTS_MUS_WS_DISPLAY_MANAGER_H_ | 172 #endif // COMPONENTS_MUS_WS_DISPLAY_MANAGER_H_ |
OLD | NEW |