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_impl_ozone.h" | 5 #include "services/ui/display/platform_screen_impl_ozone.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 void PlatformScreenImplOzone::Init() { | 39 void PlatformScreenImplOzone::Init() { |
40 // We want display configuration to happen even off device to keep the control | 40 // We want display configuration to happen even off device to keep the control |
41 // flow similar. | 41 // flow similar. |
42 display_configurator_.set_configure_display(true); | 42 display_configurator_.set_configure_display(true); |
43 display_configurator_.AddObserver(this); | 43 display_configurator_.AddObserver(this); |
44 display_configurator_.Init( | 44 display_configurator_.Init( |
45 ui::OzonePlatform::GetInstance()->CreateNativeDisplayDelegate(), false); | 45 ui::OzonePlatform::GetInstance()->CreateNativeDisplayDelegate(), false); |
46 } | 46 } |
47 | 47 |
48 void PlatformScreenImplOzone::ConfigurePhysicalDisplay( | 48 void PlatformScreenImplOzone::ConfigureDisplays( |
49 const PlatformScreen::ConfiguredDisplayCallback& callback) { | 49 PlatformScreenDelegate* delegate) { |
50 callback_ = callback; | 50 DCHECK(delegate); |
| 51 delegate_ = delegate; |
51 | 52 |
52 if (base::SysInfo::IsRunningOnChromeOS()) { | 53 if (base::SysInfo::IsRunningOnChromeOS()) { |
53 display_configurator_.ForceInitialConfigure(kChromeOsBootColor); | 54 display_configurator_.ForceInitialConfigure(kChromeOsBootColor); |
54 } else { | 55 } else { |
55 if (base::CommandLine::ForCurrentProcess()->HasSwitch("multi-display")) { | 56 if (base::CommandLine::ForCurrentProcess()->HasSwitch("multi-display")) { |
56 // This really doesn't work properly. Use at your own risk. | 57 // This really doesn't work properly. Use at your own risk. |
57 display_configurator_.AddVirtualDisplay(gfx::Size(800, 800)); | 58 display_configurator_.AddVirtualDisplay(gfx::Size(800, 800)); |
58 display_configurator_.AddVirtualDisplay(gfx::Size(800, 800)); | 59 display_configurator_.AddVirtualDisplay(gfx::Size(800, 800)); |
59 } else { | 60 } else { |
60 display_configurator_.AddVirtualDisplay(gfx::Size(1024, 768)); | 61 display_configurator_.AddVirtualDisplay(gfx::Size(1024, 768)); |
(...skipping 28 matching lines...) Expand all Loading... |
89 // Move the origin so that next display is to the right of current display. | 90 // Move the origin so that next display is to the right of current display. |
90 next_display_origin_.Offset(current_mode->size().width(), 0); | 91 next_display_origin_.Offset(current_mode->size().width(), 0); |
91 | 92 |
92 // The first display added will be our primary display. | 93 // The first display added will be our primary display. |
93 if (displays_.empty()) | 94 if (displays_.empty()) |
94 primary_display_id_ = id; | 95 primary_display_id_ = id; |
95 | 96 |
96 // Keep track of what displays have already been added. | 97 // Keep track of what displays have already been added. |
97 displays_.insert(display->display_id()); | 98 displays_.insert(display->display_id()); |
98 | 99 |
99 callback_.Run(id, bounds); | 100 delegate_->OnDisplayAdded(this, id, bounds); |
100 } | 101 } |
101 | 102 |
102 DCHECK(displays_ == all_displays) << "Removing displays is not supported."; | 103 DCHECK(displays_ == all_displays) << "Removing displays is not supported."; |
103 } | 104 } |
104 | 105 |
105 void PlatformScreenImplOzone::OnDisplayModeChangeFailed( | 106 void PlatformScreenImplOzone::OnDisplayModeChangeFailed( |
106 const ui::DisplayConfigurator::DisplayStateList& displays, | 107 const ui::DisplayConfigurator::DisplayStateList& displays, |
107 ui::MultipleDisplayState failed_new_state) { | 108 ui::MultipleDisplayState failed_new_state) { |
108 LOG(ERROR) << "OnDisplayModeChangeFailed from DisplayConfigurator"; | 109 LOG(ERROR) << "OnDisplayModeChangeFailed from DisplayConfigurator"; |
109 } | 110 } |
110 | 111 |
111 } // namespace display | 112 } // namespace display |
OLD | NEW |