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