| 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 "chromeos/system/devicemode.h" | 10 #include "chromeos/system/devicemode.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 mode->refresh_rate() == mode_to_find->refresh_rate()) { | 32 mode->refresh_rate() == mode_to_find->refresh_rate()) { |
| 33 return mode.get(); | 33 return mode.get(); |
| 34 } | 34 } |
| 35 } | 35 } |
| 36 NOTREACHED(); | 36 NOTREACHED(); |
| 37 return nullptr; | 37 return nullptr; |
| 38 } | 38 } |
| 39 | 39 |
| 40 } // namespace | 40 } // namespace |
| 41 | 41 |
| 42 ScreenManagerForwarding::ScreenManagerForwarding() | 42 ScreenManagerForwarding::ScreenManagerForwarding(Mode mode) |
| 43 : screen_(base::MakeUnique<display::ScreenBase>()), | 43 : is_in_process_(mode == Mode::IN_WM_PROCESS), |
| 44 screen_(base::MakeUnique<display::ScreenBase>()), |
| 44 binding_(this), | 45 binding_(this), |
| 45 test_controller_binding_(this) { | 46 test_controller_binding_(this) { |
| 46 Screen::SetScreenInstance(screen_.get()); | 47 if (!is_in_process_) |
| 48 Screen::SetScreenInstance(screen_.get()); |
| 47 } | 49 } |
| 48 | 50 |
| 49 ScreenManagerForwarding::~ScreenManagerForwarding() { | 51 ScreenManagerForwarding::~ScreenManagerForwarding() { |
| 50 if (native_display_delegate_) | 52 if (native_display_delegate_) |
| 51 native_display_delegate_->RemoveObserver(this); | 53 native_display_delegate_->RemoveObserver(this); |
| 52 Screen::SetScreenInstance(nullptr); | 54 if (!is_in_process_) |
| 55 Screen::SetScreenInstance(nullptr); |
| 53 } | 56 } |
| 54 | 57 |
| 55 void ScreenManagerForwarding::AddInterfaces( | 58 void ScreenManagerForwarding::AddInterfaces( |
| 56 service_manager::BinderRegistry* registry) { | 59 service_manager::BinderRegistry* registry) { |
| 57 registry->AddInterface<mojom::NativeDisplayDelegate>( | 60 registry->AddInterface<mojom::NativeDisplayDelegate>( |
| 58 base::Bind(&ScreenManagerForwarding::BindNativeDisplayDelegateRequest, | 61 base::Bind(&ScreenManagerForwarding::BindNativeDisplayDelegateRequest, |
| 59 base::Unretained(this))); | 62 base::Unretained(this))); |
| 60 registry->AddInterface<mojom::TestDisplayController>( | 63 registry->AddInterface<mojom::TestDisplayController>( |
| 61 base::Bind(&ScreenManagerForwarding::BindTestDisplayControllerRequest, | 64 base::Bind(&ScreenManagerForwarding::BindTestDisplayControllerRequest, |
| 62 base::Unretained(this))); | 65 base::Unretained(this))); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 if (status) { | 267 if (status) { |
| 265 // Modify display snapshot similar to how ConfigureDisplaysTask would. Ozone | 268 // Modify display snapshot similar to how ConfigureDisplaysTask would. Ozone |
| 266 // DRM needs these to be changed and ConfigureDisplaysTasks can't do it. | 269 // DRM needs these to be changed and ConfigureDisplaysTasks can't do it. |
| 267 snapshot->set_current_mode(mode); | 270 snapshot->set_current_mode(mode); |
| 268 snapshot->set_origin(origin); | 271 snapshot->set_origin(origin); |
| 269 } | 272 } |
| 270 callback.Run(status); | 273 callback.Run(status); |
| 271 } | 274 } |
| 272 | 275 |
| 273 } // namespace display | 276 } // namespace display |
| OLD | NEW |