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 : in_process_(in_process), |
42 Screen::SetScreenInstance(screen_.get()); | 42 screen_(base::MakeUnique<display::ScreenBase>()), |
| 43 binding_(this) { |
| 44 if (!in_process_) |
| 45 Screen::SetScreenInstance(screen_.get()); |
43 } | 46 } |
44 | 47 |
45 ScreenManagerForwarding::~ScreenManagerForwarding() { | 48 ScreenManagerForwarding::~ScreenManagerForwarding() { |
46 if (native_display_delegate_) | 49 if (native_display_delegate_) |
47 native_display_delegate_->RemoveObserver(this); | 50 native_display_delegate_->RemoveObserver(this); |
48 Screen::SetScreenInstance(nullptr); | 51 if (!in_process_) |
| 52 Screen::SetScreenInstance(nullptr); |
49 } | 53 } |
50 | 54 |
51 void ScreenManagerForwarding::AddInterfaces( | 55 void ScreenManagerForwarding::AddInterfaces( |
52 service_manager::BinderRegistry* registry) { | 56 service_manager::BinderRegistry* registry) { |
53 registry->AddInterface<mojom::NativeDisplayDelegate>( | 57 registry->AddInterface<mojom::NativeDisplayDelegate>( |
54 base::Bind(&ScreenManagerForwarding::BindNativeDisplayDelegateRequest, | 58 base::Bind(&ScreenManagerForwarding::BindNativeDisplayDelegateRequest, |
55 base::Unretained(this))); | 59 base::Unretained(this))); |
56 } | 60 } |
57 | 61 |
58 void ScreenManagerForwarding::Init(ScreenManagerDelegate* delegate) { | 62 void ScreenManagerForwarding::Init(ScreenManagerDelegate* delegate) { |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 if (status) { | 215 if (status) { |
212 // Modify display snapshot similar to how ConfigureDisplaysTask would. Ozone | 216 // Modify display snapshot similar to how ConfigureDisplaysTask would. Ozone |
213 // DRM needs these to be changed and ConfigureDisplaysTasks can't do it. | 217 // DRM needs these to be changed and ConfigureDisplaysTasks can't do it. |
214 snapshot->set_current_mode(mode); | 218 snapshot->set_current_mode(mode); |
215 snapshot->set_origin(origin); | 219 snapshot->set_origin(origin); |
216 } | 220 } |
217 callback.Run(status); | 221 callback.Run(status); |
218 } | 222 } |
219 | 223 |
220 } // namespace display | 224 } // namespace display |
OLD | NEW |