| Index: services/ui/display/platform_screen_ozone.cc
|
| diff --git a/services/ui/display/platform_screen_ozone.cc b/services/ui/display/platform_screen_ozone.cc
|
| index 7032ed26d61c001ae6266f7fd1f581d35c677844..22aef84ef3644b9687a92424c4e3331f7c390260 100644
|
| --- a/services/ui/display/platform_screen_ozone.cc
|
| +++ b/services/ui/display/platform_screen_ozone.cc
|
| @@ -73,6 +73,8 @@ void PlatformScreenOzone::Init(PlatformScreenDelegate* delegate) {
|
| std::unique_ptr<ui::NativeDisplayDelegate> native_display_delegate =
|
| ui::OzonePlatform::GetInstance()->CreateNativeDisplayDelegate();
|
|
|
| + // The FakeDisplayController gives us a way to make the NativeDisplayDelegate
|
| + // pretend something display related has happened.
|
| if (!base::SysInfo::IsRunningOnChromeOS()) {
|
| fake_display_controller_ =
|
| native_display_delegate->GetFakeDisplayController();
|
| @@ -103,7 +105,7 @@ int64_t PlatformScreenOzone::GetPrimaryDisplayId() const {
|
| return primary_display_id_;
|
| }
|
|
|
| -void PlatformScreenOzone::ToggleVirtualDisplay() {
|
| +void PlatformScreenOzone::ToggleAddRemoveDisplay() {
|
| if (!fake_display_controller_ || wait_for_display_config_update_)
|
| return;
|
|
|
| @@ -120,6 +122,45 @@ void PlatformScreenOzone::ToggleVirtualDisplay() {
|
| }
|
| }
|
|
|
| +void PlatformScreenOzone::SwapPrimaryDisplay() {
|
| + const size_t num_displays = cached_displays_.size();
|
| + if (num_displays <= 1)
|
| + return;
|
| +
|
| + // Find index of current primary display.
|
| + size_t primary_display_index = 0;
|
| + for (size_t i = 0; i < num_displays; i++) {
|
| + if (cached_displays_[i].id == primary_display_id_) {
|
| + primary_display_index = i;
|
| + break;
|
| + }
|
| + }
|
| +
|
| + // Set next display index as primary, or loop back to first display if last.
|
| + if (primary_display_index + 1 == num_displays) {
|
| + primary_display_id_ = cached_displays_[0].id;
|
| + } else {
|
| + primary_display_id_ = cached_displays_[primary_display_index + 1].id;
|
| + }
|
| +
|
| + // TODO(kylechar): Update ws::DisplayManager.
|
| +}
|
| +
|
| +void PlatformScreenOzone::SetDisplayWorkArea(int64_t display_id,
|
| + const gfx::Size& size,
|
| + const gfx::Insets& insets) {
|
| + CachedDisplayIterator iter = GetCachedDisplayIterator(display_id);
|
| + if (iter == cached_displays_.end()) {
|
| + NOTREACHED() << display_id;
|
| + return;
|
| + }
|
| +
|
| + DisplayInfo& display_info = *iter;
|
| + if (display_info.bounds.size() == size) {
|
| + // TODO(kylechar): Change workarea and update ws::DisplayManager.
|
| + }
|
| +}
|
| +
|
| void PlatformScreenOzone::ProcessRemovedDisplays(
|
| const ui::DisplayConfigurator::DisplayStateList& snapshots) {
|
| std::vector<int64_t> current_ids;
|
|
|