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 #include "services/ui/display/screen_manager_forwarding.h" | 5 #include "services/ui/display/screen_manager_forwarding.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "services/service_manager/public/cpp/bind_source_info.h" | 10 #include "services/service_manager/public/cpp/bind_source_info.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 mode->refresh_rate() == mode_to_find->refresh_rate()) { | 30 mode->refresh_rate() == mode_to_find->refresh_rate()) { |
31 return mode.get(); | 31 return mode.get(); |
32 } | 32 } |
33 } | 33 } |
34 NOTREACHED(); | 34 NOTREACHED(); |
35 return nullptr; | 35 return nullptr; |
36 } | 36 } |
37 | 37 |
38 } // namespace | 38 } // namespace |
39 | 39 |
40 ScreenManagerForwarding::ScreenManagerForwarding() | 40 ScreenManagerForwarding::ScreenManagerForwarding(bool in_process) |
41 : screen_(base::MakeUnique<display::ScreenBase>()), binding_(this) { | 41 : screen_(base::MakeUnique<display::ScreenBase>()), binding_(this) { |
42 Screen::SetScreenInstance(screen_.get()); | 42 // TODO: We should probably have Mus use Ash's screen and not create a screen |
| 43 // here at all for the in-process case. We'd need to add GetAllDisplays() to |
| 44 // display::Screen to achieve that. |
| 45 // Currently WS still uses this Screen, accessing it via |
| 46 // ScreenManager::GetInstance()->GetScreen() (rather than Screen::GetScreen()) |
| 47 if (!in_process) |
| 48 Screen::SetScreenInstance(screen_.get()); |
43 } | 49 } |
44 | 50 |
45 ScreenManagerForwarding::~ScreenManagerForwarding() { | 51 ScreenManagerForwarding::~ScreenManagerForwarding() { |
46 if (native_display_delegate_) | 52 if (native_display_delegate_) |
47 native_display_delegate_->RemoveObserver(this); | 53 native_display_delegate_->RemoveObserver(this); |
48 Screen::SetScreenInstance(nullptr); | 54 Screen::SetScreenInstance(nullptr); |
49 } | 55 } |
50 | 56 |
51 void ScreenManagerForwarding::AddInterfaces( | 57 void ScreenManagerForwarding::AddInterfaces( |
52 service_manager::BinderRegistry* registry) { | 58 service_manager::BinderRegistry* registry) { |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 if (status) { | 217 if (status) { |
212 // Modify display snapshot similar to how ConfigureDisplaysTask would. Ozone | 218 // Modify display snapshot similar to how ConfigureDisplaysTask would. Ozone |
213 // DRM needs these to be changed and ConfigureDisplaysTasks can't do it. | 219 // DRM needs these to be changed and ConfigureDisplaysTasks can't do it. |
214 snapshot->set_current_mode(mode); | 220 snapshot->set_current_mode(mode); |
215 snapshot->set_origin(origin); | 221 snapshot->set_origin(origin); |
216 } | 222 } |
217 callback.Run(status); | 223 callback.Run(status); |
218 } | 224 } |
219 | 225 |
220 } // namespace display | 226 } // namespace display |
OLD | NEW |