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