Chromium Code Reviews| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 fake_display_controller_ = nullptr; | 60 fake_display_controller_ = nullptr; |
| 61 display_configurator_.RemoveObserver(this); | 61 display_configurator_.RemoveObserver(this); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void PlatformScreenOzone::AddInterfaces( | 64 void PlatformScreenOzone::AddInterfaces( |
| 65 service_manager::InterfaceRegistry* registry) { | 65 service_manager::InterfaceRegistry* registry) { |
| 66 registry->AddInterface<mojom::DisplayController>(this); | 66 registry->AddInterface<mojom::DisplayController>(this); |
| 67 registry->AddInterface<mojom::TestDisplayController>(this); | 67 registry->AddInterface<mojom::TestDisplayController>(this); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void PlatformScreenOzone::Init(PlatformScreenDelegate* delegate) { | 70 void PlatformScreenOzone::Init(PlatformScreenDelegate* delegate, |
| 71 WindowMode window_mode) { | |
| 71 DCHECK(delegate); | 72 DCHECK(delegate); |
| 72 delegate_ = delegate; | 73 delegate_ = delegate; |
| 73 | 74 |
| 74 std::unique_ptr<ui::NativeDisplayDelegate> native_display_delegate = | 75 std::unique_ptr<ui::NativeDisplayDelegate> native_display_delegate = |
| 75 ui::OzonePlatform::GetInstance()->CreateNativeDisplayDelegate(); | 76 ui::OzonePlatform::GetInstance()->CreateNativeDisplayDelegate(); |
| 76 | 77 |
| 77 // The FakeDisplayController gives us a way to make the NativeDisplayDelegate | 78 // The FakeDisplayController gives us a way to make the NativeDisplayDelegate |
| 78 // pretend something display related has happened. | 79 // pretend something display related has happened. |
| 79 if (!base::SysInfo::IsRunningOnChromeOS()) { | 80 if (!base::SysInfo::IsRunningOnChromeOS()) { |
|
Tom (Use chromium acct)
2016/11/28 20:47:38
Does anyone know if this should also be wrapped wi
| |
| 80 fake_display_controller_ = | 81 fake_display_controller_ = |
| 81 native_display_delegate->GetFakeDisplayController(); | 82 native_display_delegate->GetFakeDisplayController(); |
| 82 } | 83 } |
| 83 | 84 |
| 84 // We want display configuration to happen even off device to keep the control | 85 if (window_mode == WINDOW_MODE_INTERNAL) { |
| 85 // flow similar. | 86 // We want display configuration to happen even off device to keep the |
| 86 display_configurator_.set_configure_display(true); | 87 // control flow similar. |
| 87 display_configurator_.AddObserver(this); | 88 display_configurator_.set_configure_display(true); |
| 88 display_configurator_.set_state_controller(this); | 89 display_configurator_.AddObserver(this); |
| 89 display_configurator_.Init(std::move(native_display_delegate), false); | 90 display_configurator_.set_state_controller(this); |
| 90 display_configurator_.ForceInitialConfigure(kChromeOsBootColor); | 91 display_configurator_.Init(std::move(native_display_delegate), false); |
| 92 display_configurator_.ForceInitialConfigure(kChromeOsBootColor); | |
| 93 } | |
| 91 } | 94 } |
| 92 | 95 |
| 93 void PlatformScreenOzone::RequestCloseDisplay(int64_t display_id) { | 96 void PlatformScreenOzone::RequestCloseDisplay(int64_t display_id) { |
| 94 if (!fake_display_controller_ || wait_for_display_config_update_) | 97 if (!fake_display_controller_ || wait_for_display_config_update_) |
| 95 return; | 98 return; |
| 96 | 99 |
| 97 CachedDisplayIterator iter = GetCachedDisplayIterator(display_id); | 100 CachedDisplayIterator iter = GetCachedDisplayIterator(display_id); |
| 98 if (iter != cached_displays_.end()) { | 101 if (iter != cached_displays_.end()) { |
| 99 // Tell the NDD to remove the display. PlatformScreen will get an update | 102 // Tell the NDD to remove the display. PlatformScreen will get an update |
| 100 // that the display configuration has changed and the display will be gone. | 103 // that the display configuration has changed and the display will be gone. |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 374 return false; | 377 return false; |
| 375 } | 378 } |
| 376 | 379 |
| 377 void PlatformScreenOzone::Create( | 380 void PlatformScreenOzone::Create( |
| 378 const service_manager::Identity& remote_identity, | 381 const service_manager::Identity& remote_identity, |
| 379 mojom::TestDisplayControllerRequest request) { | 382 mojom::TestDisplayControllerRequest request) { |
| 380 test_bindings_.AddBinding(this, std::move(request)); | 383 test_bindings_.AddBinding(this, std::move(request)); |
| 381 } | 384 } |
| 382 | 385 |
| 383 } // namespace display | 386 } // namespace display |
| OLD | NEW |