OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef SERVICES_SERVICE_MANAGER_CONNECT_PARAMS_H_ | 5 #ifndef SERVICES_SERVICE_MANAGER_CONNECT_PARAMS_H_ |
6 #define SERVICES_SERVICE_MANAGER_CONNECT_PARAMS_H_ | 6 #define SERVICES_SERVICE_MANAGER_CONNECT_PARAMS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 bool HasClientProcessInfo() const { | 45 bool HasClientProcessInfo() const { |
46 return service_.is_bound() && pid_receiver_request_.is_pending(); | 46 return service_.is_bound() && pid_receiver_request_.is_pending(); |
47 } | 47 } |
48 mojom::ServicePtr TakeService() { | 48 mojom::ServicePtr TakeService() { |
49 return std::move(service_); | 49 return std::move(service_); |
50 } | 50 } |
51 mojom::PIDReceiverRequest TakePIDReceiverRequest() { | 51 mojom::PIDReceiverRequest TakePIDReceiverRequest() { |
52 return std::move(pid_receiver_request_); | 52 return std::move(pid_receiver_request_); |
53 } | 53 } |
54 | 54 |
55 void set_interface_request_info( | |
56 const std::string& interface_name, | |
57 mojo::ScopedMessagePipeHandle interface_pipe) { | |
58 interface_name_ = interface_name; | |
59 interface_pipe_ = std::move(interface_pipe); | |
60 } | |
61 const std::string& interface_name() const { | |
62 return interface_name_; | |
63 } | |
64 bool HasInterfaceRequestInfo() const { | |
65 return !interface_name_.empty() && interface_pipe_.is_valid(); | |
66 } | |
67 mojo::ScopedMessagePipeHandle TakeInterfaceRequestPipe() { | |
68 return std::move(interface_pipe_); | |
69 } | |
70 | |
71 void set_connect_callback(const mojom::Connector::ConnectCallback& value) { | 55 void set_connect_callback(const mojom::Connector::ConnectCallback& value) { |
72 connect_callback_ = value; | 56 connect_callback_ = value; |
73 } | 57 } |
74 const mojom::Connector::ConnectCallback& connect_callback() const { | 58 const mojom::Connector::ConnectCallback& connect_callback() const { |
75 return connect_callback_; | 59 return connect_callback_; |
76 } | 60 } |
77 | 61 |
78 void set_bind_interface_callback( | |
79 const mojom::Connector::BindInterfaceCallback& callback) { | |
80 bind_interface_callback_ = callback; | |
81 } | |
82 const mojom::Connector::BindInterfaceCallback& | |
83 bind_interface_callback() const { | |
84 return bind_interface_callback_; | |
85 } | |
86 | |
87 private: | 62 private: |
88 // It may be null (i.e., is_null() returns true) which indicates that there is | 63 // It may be null (i.e., is_null() returns true) which indicates that there is |
89 // no source (e.g., for the first application or in tests). | 64 // no source (e.g., for the first application or in tests). |
90 Identity source_; | 65 Identity source_; |
91 // The identity of the application being connected to. | 66 // The identity of the application being connected to. |
92 Identity target_; | 67 Identity target_; |
93 | 68 |
94 mojom::InterfaceProviderRequest remote_interfaces_; | 69 mojom::InterfaceProviderRequest remote_interfaces_; |
95 mojom::ServicePtr service_; | 70 mojom::ServicePtr service_; |
96 mojom::PIDReceiverRequest pid_receiver_request_; | 71 mojom::PIDReceiverRequest pid_receiver_request_; |
97 std::string interface_name_; | |
98 mojo::ScopedMessagePipeHandle interface_pipe_; | |
99 mojom::Connector::ConnectCallback connect_callback_; | 72 mojom::Connector::ConnectCallback connect_callback_; |
100 mojom::Connector::BindInterfaceCallback bind_interface_callback_; | |
101 | 73 |
102 DISALLOW_COPY_AND_ASSIGN(ConnectParams); | 74 DISALLOW_COPY_AND_ASSIGN(ConnectParams); |
103 }; | 75 }; |
104 | 76 |
105 } // namespace service_manager | 77 } // namespace service_manager |
106 | 78 |
107 #endif // SERVICES_SERVICE_MANAGER_CONNECT_PARAMS_H_ | 79 #endif // SERVICES_SERVICE_MANAGER_CONNECT_PARAMS_H_ |
OLD | NEW |