| 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/ws/window_server_test_impl.h" | 5 #include "services/ui/ws/window_server_test_impl.h" |
| 6 | 6 |
| 7 #include "services/ui/public/interfaces/window_tree.mojom.h" | 7 #include "services/ui/public/interfaces/window_tree.mojom.h" |
| 8 #include "services/ui/ws/server_window.h" | 8 #include "services/ui/ws/server_window.h" |
| 9 #include "services/ui/ws/server_window_surface_manager.h" | 9 #include "services/ui/ws/server_window_surface_manager.h" |
| 10 #include "services/ui/ws/window_server.h" | 10 #include "services/ui/ws/window_server.h" |
| 11 #include "services/ui/ws/window_tree.h" | 11 #include "services/ui/ws/window_tree.h" |
| 12 | 12 |
| 13 namespace ui { | 13 namespace ui { |
| 14 namespace ws { | 14 namespace ws { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 bool WindowHasValidFrame(const ServerWindow* window) { | 18 bool WindowHasValidFrame(const ServerWindow* window) { |
| 19 const ServerWindowSurfaceManager* manager = window->surface_manager(); | 19 const ServerWindowSurfaceManager* manager = window->surface_manager(); |
| 20 return manager && | 20 return manager && |
| 21 !manager->GetDefaultSurface()->last_submitted_frame_size().IsEmpty(); | 21 !manager->GetDefaultSurface()->last_submitted_frame_size().IsEmpty(); |
| 22 } | 22 } |
| 23 | 23 |
| 24 } // namespace | 24 } // namespace |
| 25 | 25 |
| 26 WindowServerTestImpl::WindowServerTestImpl( | 26 WindowServerTestImpl::WindowServerTestImpl(WindowServer* window_server) |
| 27 WindowServer* window_server, | 27 : window_server_(window_server) {} |
| 28 mojo::InterfaceRequest<WindowServerTest> request) | |
| 29 : window_server_(window_server), binding_(this, std::move(request)) {} | |
| 30 | 28 |
| 31 WindowServerTestImpl::~WindowServerTestImpl() {} | 29 WindowServerTestImpl::~WindowServerTestImpl() {} |
| 32 | 30 |
| 33 void WindowServerTestImpl::OnWindowPaint( | 31 void WindowServerTestImpl::OnWindowPaint( |
| 34 const std::string& name, | 32 const std::string& name, |
| 35 const EnsureClientHasDrawnWindowCallback& cb, | 33 const EnsureClientHasDrawnWindowCallback& cb, |
| 36 ServerWindow* window) { | 34 ServerWindow* window) { |
| 37 WindowTree* tree = window_server_->GetTreeWithClientName(name); | 35 WindowTree* tree = window_server_->GetTreeWithClientName(name); |
| 38 if (!tree) | 36 if (!tree) |
| 39 return; | 37 return; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 57 } | 55 } |
| 58 } | 56 } |
| 59 | 57 |
| 60 window_server_->SetPaintCallback( | 58 window_server_->SetPaintCallback( |
| 61 base::Bind(&WindowServerTestImpl::OnWindowPaint, base::Unretained(this), | 59 base::Bind(&WindowServerTestImpl::OnWindowPaint, base::Unretained(this), |
| 62 name, std::move(callback))); | 60 name, std::move(callback))); |
| 63 } | 61 } |
| 64 | 62 |
| 65 } // namespace ws | 63 } // namespace ws |
| 66 } // namespace ui | 64 } // namespace ui |
| OLD | NEW |