Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(369)

Side by Side Diff: components/mus/ws/window_server_test_impl.cc

Issue 2119963002: Move mus to //services/ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/mus/ws/window_server_test_impl.h ('k') | components/mus/ws/window_tree.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "components/mus/ws/window_server_test_impl.h"
6
7 #include "components/mus/public/interfaces/window_tree.mojom.h"
8 #include "components/mus/ws/server_window.h"
9 #include "components/mus/ws/server_window_surface_manager.h"
10 #include "components/mus/ws/window_server.h"
11 #include "components/mus/ws/window_tree.h"
12
13 namespace mus {
14 namespace ws {
15
16 namespace {
17
18 bool WindowHasValidFrame(const ServerWindow* window) {
19 const ServerWindowSurfaceManager* manager = window->surface_manager();
20 return manager &&
21 !manager->GetDefaultSurface()->last_submitted_frame_size().IsEmpty();
22 }
23
24 } // namespace
25
26 WindowServerTestImpl::WindowServerTestImpl(
27 WindowServer* window_server,
28 mojo::InterfaceRequest<WindowServerTest> request)
29 : window_server_(window_server), binding_(this, std::move(request)) {}
30
31 WindowServerTestImpl::~WindowServerTestImpl() {}
32
33 void WindowServerTestImpl::OnWindowPaint(
34 const std::string& name,
35 const EnsureClientHasDrawnWindowCallback& cb,
36 ServerWindow* window) {
37 WindowTree* tree = window_server_->GetTreeWithClientName(name);
38 if (!tree)
39 return;
40 if (tree->HasRoot(window) && WindowHasValidFrame(window)) {
41 cb.Run(true);
42 window_server_->SetPaintCallback(base::Callback<void(ServerWindow*)>());
43 }
44 }
45
46 void WindowServerTestImpl::EnsureClientHasDrawnWindow(
47 const mojo::String& client_name,
48 const EnsureClientHasDrawnWindowCallback& callback) {
49 std::string name = client_name.To<std::string>();
50 WindowTree* tree = window_server_->GetTreeWithClientName(name);
51 if (tree) {
52 for (const ServerWindow* window : tree->roots()) {
53 if (WindowHasValidFrame(window)) {
54 callback.Run(true);
55 return;
56 }
57 }
58 }
59
60 window_server_->SetPaintCallback(
61 base::Bind(&WindowServerTestImpl::OnWindowPaint, base::Unretained(this),
62 name, std::move(callback)));
63 }
64
65 } // namespace ws
66 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/ws/window_server_test_impl.h ('k') | components/mus/ws/window_tree.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698