OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/platform_screen_ozone.h" | 5 #include "services/ui/display/platform_screen_ozone.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 } | 57 } |
58 | 58 |
59 // We want display configuration to happen even off device to keep the control | 59 // We want display configuration to happen even off device to keep the control |
60 // flow similar. | 60 // flow similar. |
61 display_configurator_.set_configure_display(true); | 61 display_configurator_.set_configure_display(true); |
62 display_configurator_.AddObserver(this); | 62 display_configurator_.AddObserver(this); |
63 display_configurator_.Init(std::move(native_display_delegate), false); | 63 display_configurator_.Init(std::move(native_display_delegate), false); |
64 display_configurator_.ForceInitialConfigure(kChromeOsBootColor); | 64 display_configurator_.ForceInitialConfigure(kChromeOsBootColor); |
65 } | 65 } |
66 | 66 |
| 67 void PlatformScreenOzone::RequestCloseDisplay(int64_t display_id) { |
| 68 if (!fake_display_controller_ || wait_for_display_config_update_) |
| 69 return; |
| 70 |
| 71 CachedDisplayIterator iter = GetCachedDisplayIterator(display_id); |
| 72 if (iter != cached_displays_.end()) { |
| 73 // Tell the NDD to remove the display. PlatformScreen will get an update |
| 74 // that the display configuration has changed and the display will be gone. |
| 75 wait_for_display_config_update_ = |
| 76 fake_display_controller_->RemoveDisplay(iter->id); |
| 77 } |
| 78 } |
| 79 |
67 int64_t PlatformScreenOzone::GetPrimaryDisplayId() const { | 80 int64_t PlatformScreenOzone::GetPrimaryDisplayId() const { |
68 return primary_display_id_; | 81 return primary_display_id_; |
69 } | 82 } |
70 | 83 |
71 void PlatformScreenOzone::ToggleVirtualDisplay() { | 84 void PlatformScreenOzone::ToggleVirtualDisplay() { |
72 if (!fake_display_controller_ || wait_for_display_config_update_) | 85 if (!fake_display_controller_ || wait_for_display_config_update_) |
73 return; | 86 return; |
74 | 87 |
75 if (cached_displays_.size() == 1) { | 88 if (cached_displays_.size() == 1) { |
76 const gfx::Size& display_size = cached_displays_[0].bounds.size(); | 89 const gfx::Size& display_size = cached_displays_[0].bounds.size(); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 LOG(ERROR) << "OnDisplayModeChangeFailed from DisplayConfigurator"; | 216 LOG(ERROR) << "OnDisplayModeChangeFailed from DisplayConfigurator"; |
204 wait_for_display_config_update_ = false; | 217 wait_for_display_config_update_ = false; |
205 } | 218 } |
206 | 219 |
207 void PlatformScreenOzone::Create(const shell::Identity& remote_identity, | 220 void PlatformScreenOzone::Create(const shell::Identity& remote_identity, |
208 mojom::DisplayControllerRequest request) { | 221 mojom::DisplayControllerRequest request) { |
209 bindings_.AddBinding(this, std::move(request)); | 222 bindings_.AddBinding(this, std::move(request)); |
210 } | 223 } |
211 | 224 |
212 } // namespace display | 225 } // namespace display |
OLD | NEW |