OLD | NEW |
| (Empty) |
1 // Copyright 2015 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 #ifndef MOJO_SHELL_CONNECT_PARAMS_H_ | |
6 #define MOJO_SHELL_CONNECT_PARAMS_H_ | |
7 | |
8 #include <string> | |
9 #include <utility> | |
10 | |
11 #include "base/callback.h" | |
12 #include "base/macros.h" | |
13 #include "mojo/public/cpp/bindings/interface_request.h" | |
14 #include "mojo/shell/public/cpp/identity.h" | |
15 #include "mojo/shell/public/interfaces/connector.mojom.h" | |
16 #include "mojo/shell/public/interfaces/interface_provider.mojom.h" | |
17 | |
18 namespace mojo { | |
19 namespace shell { | |
20 | |
21 // This class represents a request for the application manager to connect to an | |
22 // application. | |
23 class ConnectParams { | |
24 public: | |
25 ConnectParams(); | |
26 ~ConnectParams(); | |
27 | |
28 void set_source(const Identity& source) { source_ = source; } | |
29 const Identity& source() const { return source_; } | |
30 void set_target(const Identity& target) { target_ = target; } | |
31 const Identity& target() const { return target_; } | |
32 | |
33 void set_remote_interfaces(shell::mojom::InterfaceProviderRequest value) { | |
34 remote_interfaces_ = std::move(value); | |
35 } | |
36 shell::mojom::InterfaceProviderRequest TakeRemoteInterfaces() { | |
37 return std::move(remote_interfaces_); | |
38 } | |
39 | |
40 void set_local_interfaces(shell::mojom::InterfaceProviderPtr value) { | |
41 local_interfaces_ = std::move(value); | |
42 } | |
43 shell::mojom::InterfaceProviderPtr TakeLocalInterfaces() { | |
44 return std::move(local_interfaces_); | |
45 } | |
46 | |
47 void set_client_process_connection( | |
48 shell::mojom::ClientProcessConnectionPtr client_process_connection) { | |
49 client_process_connection_ = std::move(client_process_connection); | |
50 } | |
51 shell::mojom::ClientProcessConnectionPtr TakeClientProcessConnection() { | |
52 return std::move(client_process_connection_); | |
53 } | |
54 | |
55 void set_connect_callback( | |
56 const shell::mojom::Connector::ConnectCallback& value) { | |
57 connect_callback_ = value; | |
58 } | |
59 const shell::mojom::Connector::ConnectCallback& connect_callback() const { | |
60 return connect_callback_; | |
61 } | |
62 | |
63 private: | |
64 // It may be null (i.e., is_null() returns true) which indicates that there is | |
65 // no source (e.g., for the first application or in tests). | |
66 Identity source_; | |
67 // The identity of the application being connected to. | |
68 Identity target_; | |
69 | |
70 shell::mojom::InterfaceProviderRequest remote_interfaces_; | |
71 shell::mojom::InterfaceProviderPtr local_interfaces_; | |
72 shell::mojom::ClientProcessConnectionPtr client_process_connection_; | |
73 shell::mojom::Connector::ConnectCallback connect_callback_; | |
74 | |
75 DISALLOW_COPY_AND_ASSIGN(ConnectParams); | |
76 }; | |
77 | |
78 } // namespace shell | |
79 } // namespace mojo | |
80 | |
81 #endif // MOJO_SHELL_CONNECT_PARAMS_H_ | |
OLD | NEW |