OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 SERVICES_UI_DISPLAY_SCREEN_MANAGER_FORWARDING_H_ | 5 #ifndef SERVICES_UI_DISPLAY_SCREEN_MANAGER_FORWARDING_H_ |
6 #define SERVICES_UI_DISPLAY_SCREEN_MANAGER_FORWARDING_H_ | 6 #define SERVICES_UI_DISPLAY_SCREEN_MANAGER_FORWARDING_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 class NativeDisplayDelegate; | 26 class NativeDisplayDelegate; |
27 | 27 |
28 // ScreenManager implementation that implements mojom::NativeDisplayDelegate. | 28 // ScreenManager implementation that implements mojom::NativeDisplayDelegate. |
29 // This will own a real NativeDisplayDelegate and forwards calls to and | 29 // This will own a real NativeDisplayDelegate and forwards calls to and |
30 // responses from it over Mojo. | 30 // responses from it over Mojo. |
31 class ScreenManagerForwarding : public ScreenManager, | 31 class ScreenManagerForwarding : public ScreenManager, |
32 public mojom::TestDisplayController, | 32 public mojom::TestDisplayController, |
33 public NativeDisplayObserver, | 33 public NativeDisplayObserver, |
34 public mojom::NativeDisplayDelegate { | 34 public mojom::NativeDisplayDelegate { |
35 public: | 35 public: |
36 ScreenManagerForwarding(); | 36 enum class Mode { |
| 37 IN_WM_PROCESS, |
| 38 OWN_PROCESS, |
| 39 }; |
| 40 |
| 41 // |in_process| is true if the UI Service runs inside WM's process, false if |
| 42 // it runs inside its own process. |
| 43 explicit ScreenManagerForwarding(Mode mode); |
37 ~ScreenManagerForwarding() override; | 44 ~ScreenManagerForwarding() override; |
38 | 45 |
39 // ScreenManager: | 46 // ScreenManager: |
40 void AddInterfaces(service_manager::BinderRegistry* registry) override; | 47 void AddInterfaces(service_manager::BinderRegistry* registry) override; |
41 void Init(ScreenManagerDelegate* delegate) override; | 48 void Init(ScreenManagerDelegate* delegate) override; |
42 void RequestCloseDisplay(int64_t display_id) override; | 49 void RequestCloseDisplay(int64_t display_id) override; |
43 display::ScreenBase* GetScreen() override; | 50 display::ScreenBase* GetScreen() override; |
44 | 51 |
45 // NativeDisplayObserver: | 52 // NativeDisplayObserver: |
46 void OnConfigurationChanged() override; | 53 void OnConfigurationChanged() override; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 const std::vector<DisplaySnapshot*>& displays); | 91 const std::vector<DisplaySnapshot*>& displays); |
85 | 92 |
86 // Forwards results from call to Configure() back with |callback|. | 93 // Forwards results from call to Configure() back with |callback|. |
87 void ForwardConfigure( | 94 void ForwardConfigure( |
88 DisplaySnapshot* snapshot, | 95 DisplaySnapshot* snapshot, |
89 const DisplayMode* mode, | 96 const DisplayMode* mode, |
90 const gfx::Point& origin, | 97 const gfx::Point& origin, |
91 const mojom::NativeDisplayDelegate::ConfigureCallback& callback, | 98 const mojom::NativeDisplayDelegate::ConfigureCallback& callback, |
92 bool status); | 99 bool status); |
93 | 100 |
| 101 // True if the UI Service runs inside WM's process, false if it runs inside |
| 102 // its own process. |
| 103 const bool is_in_process_; |
94 std::unique_ptr<display::ScreenBase> screen_; | 104 std::unique_ptr<display::ScreenBase> screen_; |
95 mojo::Binding<mojom::NativeDisplayDelegate> binding_; | 105 mojo::Binding<mojom::NativeDisplayDelegate> binding_; |
96 mojom::NativeDisplayObserverPtr observer_; | 106 mojom::NativeDisplayObserverPtr observer_; |
97 | 107 |
98 mojo::Binding<mojom::TestDisplayController> test_controller_binding_; | 108 mojo::Binding<mojom::TestDisplayController> test_controller_binding_; |
99 | 109 |
100 std::unique_ptr<display::NativeDisplayDelegate> native_display_delegate_; | 110 std::unique_ptr<display::NativeDisplayDelegate> native_display_delegate_; |
101 | 111 |
102 // Cached pointers to snapshots owned by the |native_display_delegate_|. | 112 // Cached pointers to snapshots owned by the |native_display_delegate_|. |
103 base::flat_map<int64_t, DisplaySnapshot*> snapshot_map_; | 113 base::flat_map<int64_t, DisplaySnapshot*> snapshot_map_; |
104 | 114 |
105 // If not null it provides a way to modify the display state when running off | 115 // If not null it provides a way to modify the display state when running off |
106 // device (eg. running mustash on Linux). | 116 // device (eg. running mustash on Linux). |
107 FakeDisplayController* fake_display_controller_ = nullptr; | 117 FakeDisplayController* fake_display_controller_ = nullptr; |
108 | 118 |
109 DISALLOW_COPY_AND_ASSIGN(ScreenManagerForwarding); | 119 DISALLOW_COPY_AND_ASSIGN(ScreenManagerForwarding); |
110 }; | 120 }; |
111 | 121 |
112 } // namespace display | 122 } // namespace display |
113 | 123 |
114 #endif // SERVICES_UI_DISPLAY_SCREEN_MANAGER_FORWARDING_H_ | 124 #endif // SERVICES_UI_DISPLAY_SCREEN_MANAGER_FORWARDING_H_ |
OLD | NEW |