OLD | NEW |
| (Empty) |
1 // Copyright 2014 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_tree_binding.h" | |
6 | |
7 #include "base/bind.h" | |
8 #include "components/mus/ws/window_server.h" | |
9 #include "components/mus/ws/window_tree.h" | |
10 | |
11 namespace mus { | |
12 namespace ws { | |
13 | |
14 WindowTreeBinding::WindowTreeBinding(mojom::WindowTreeClient* client) | |
15 : client_(client) {} | |
16 | |
17 WindowTreeBinding::~WindowTreeBinding() {} | |
18 | |
19 DefaultWindowTreeBinding::DefaultWindowTreeBinding( | |
20 WindowTree* tree, | |
21 WindowServer* window_server, | |
22 mojom::WindowTreeRequest service_request, | |
23 mojom::WindowTreeClientPtr client) | |
24 : WindowTreeBinding(client.get()), | |
25 binding_(tree, std::move(service_request)), | |
26 client_(std::move(client)) { | |
27 // Both |window_server| and |tree| outlive us. | |
28 binding_.set_connection_error_handler( | |
29 base::Bind(&WindowServer::DestroyTree, base::Unretained(window_server), | |
30 base::Unretained(tree))); | |
31 } | |
32 | |
33 DefaultWindowTreeBinding::DefaultWindowTreeBinding( | |
34 WindowTree* tree, | |
35 mojom::WindowTreeClientPtr client) | |
36 : WindowTreeBinding(client.get()), | |
37 binding_(tree), | |
38 client_(std::move(client)) {} | |
39 | |
40 DefaultWindowTreeBinding::~DefaultWindowTreeBinding() {} | |
41 | |
42 void DefaultWindowTreeBinding::SetIncomingMethodCallProcessingPaused( | |
43 bool paused) { | |
44 if (paused) | |
45 binding_.PauseIncomingMethodCallProcessing(); | |
46 else | |
47 binding_.ResumeIncomingMethodCallProcessing(); | |
48 } | |
49 | |
50 mojom::WindowTreePtr DefaultWindowTreeBinding::CreateInterfacePtrAndBind() { | |
51 DCHECK(!binding_.is_bound()); | |
52 return binding_.CreateInterfacePtrAndBind(); | |
53 } | |
54 | |
55 mojom::WindowManager* DefaultWindowTreeBinding::GetWindowManager() { | |
56 client_->GetWindowManager( | |
57 GetProxy(&window_manager_internal_, client_.associated_group())); | |
58 return window_manager_internal_.get(); | |
59 } | |
60 | |
61 } // namespace ws | |
62 } // namespace mus | |
OLD | NEW |