Chromium Code Reviews| Index: services/ui/ws/display.cc |
| diff --git a/services/ui/ws/display.cc b/services/ui/ws/display.cc |
| index 42807955e82786a5f8674f19d483439130bd9d34..a7574023736322cc4615a71f0f7c667c4f0a7313 100644 |
| --- a/services/ui/ws/display.cc |
| +++ b/services/ui/ws/display.cc |
| @@ -285,6 +285,19 @@ void Display::CreateWindowManagerDisplayRootFromFactory( |
| std::move(display_root_ptr)); |
| } |
| +void Display::CreateRootWindow(const gfx::Size& size) { |
| + DCHECK(!root_); |
| + |
| + root_.reset(window_server_->CreateServerWindow( |
| + display_manager()->GetAndAdvanceNextRootId(), |
| + ServerWindow::Properties())); |
| + root_->SetBounds(gfx::Rect(size)); |
| + root_->SetVisible(true); |
| + focus_controller_.reset(new FocusController(this, root_.get())); |
| + focus_controller_->AddObserver(this); |
| + InitWindowManagerDisplayRootsIfNecessary(); |
| +} |
| + |
| ServerWindow* Display::GetRootWindow() { |
| return root_.get(); |
| } |
| @@ -311,23 +324,15 @@ void Display::OnNativeCaptureLost() { |
| void Display::OnViewportMetricsChanged(const ViewportMetrics& old_metrics, |
| const ViewportMetrics& new_metrics) { |
| + if (!root_) |
| + return; |
| + |
| gfx::Rect new_bounds(new_metrics.bounds.size()); |
| - if (!root_) { |
| - root_.reset(window_server_->CreateServerWindow( |
| - display_manager()->GetAndAdvanceNextRootId(), |
| - ServerWindow::Properties())); |
| - root_->SetBounds(new_bounds); |
| - root_->SetVisible(true); |
| - focus_controller_.reset(new FocusController(this, root_.get())); |
| - focus_controller_->AddObserver(this); |
| - InitWindowManagerDisplayRootsIfNecessary(); |
| - } else { |
| - root_->SetBounds(new_bounds); |
| - for (auto& pair : window_manager_display_root_map_) |
| - pair.second->root()->SetBounds(new_bounds); |
| - } |
| - if (init_called_) |
| - display_manager()->OnDisplayUpdate(this); |
| + root_->SetBounds(new_bounds); |
| + for (auto& pair : window_manager_display_root_map_) |
| + pair.second->root()->SetBounds(new_bounds); |
| + |
| + display_manager()->OnDisplayUpdate(this); |
|
sky
2016/09/22 21:42:06
Why is it safe to not check init_called?
kylechar
2016/09/23 13:22:32
OnDisplayUpdate() was getting called during initia
|
| } |
| void Display::OnCompositorFrameDrawn() { |