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

Side by Side Diff: services/service_manager/connect_params.h

Issue 2610173003: Add RegisterService, split out of Connect(). (Closed)
Patch Set: . Created 3 years, 11 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
OLDNEW
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
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "services/service_manager/public/cpp/identity.h" 13 #include "services/service_manager/public/cpp/identity.h"
14 #include "services/service_manager/public/interfaces/connector.mojom.h" 14 #include "services/service_manager/public/interfaces/connector.mojom.h"
15 #include "services/service_manager/public/interfaces/interface_provider.mojom.h" 15 #include "services/service_manager/public/interfaces/interface_provider.mojom.h"
16 #include "services/service_manager/public/interfaces/service.mojom.h"
16 17
17 namespace service_manager { 18 namespace service_manager {
18 19
19 // This class represents a request for the application manager to connect to an 20 // This class represents a request for the application manager to connect to an
20 // application. 21 // application.
21 class ConnectParams { 22 class ConnectParams {
22 public: 23 public:
23 ConnectParams(); 24 ConnectParams();
24 ~ConnectParams(); 25 ~ConnectParams();
25 26
26 void set_source(const Identity& source) { source_ = source; } 27 void set_source(const Identity& source) { source_ = source; }
27 const Identity& source() const { return source_; } 28 const Identity& source() const { return source_; }
28 void set_target(const Identity& target) { target_ = target; } 29 void set_target(const Identity& target) { target_ = target; }
29 const Identity& target() const { return target_; } 30 const Identity& target() const { return target_; }
30 31
31 void set_remote_interfaces(mojom::InterfaceProviderRequest value) { 32 void set_remote_interfaces(mojom::InterfaceProviderRequest value) {
32 remote_interfaces_ = std::move(value); 33 remote_interfaces_ = std::move(value);
33 } 34 }
34 mojom::InterfaceProviderRequest TakeRemoteInterfaces() { 35 mojom::InterfaceProviderRequest TakeRemoteInterfaces() {
35 return std::move(remote_interfaces_); 36 return std::move(remote_interfaces_);
36 } 37 }
37 38
38 void set_client_process_connection( 39 void set_client_process_info(
39 mojom::ClientProcessConnectionPtr client_process_connection) { 40 mojom::ServicePtr service,
40 client_process_connection_ = std::move(client_process_connection); 41 mojom::PIDReceiverRequest pid_receiver_request) {
42 service_ = std::move(service);
43 pid_receiver_request_ = std::move(pid_receiver_request);
41 } 44 }
42 mojom::ClientProcessConnectionPtr TakeClientProcessConnection() { 45 bool HasClientProcessInfo() const {
43 return std::move(client_process_connection_); 46 return service_.is_bound() && pid_receiver_request_.is_pending();
47 }
48 mojom::ServicePtr TakeService() {
49 return std::move(service_);
50 }
51 mojom::PIDReceiverRequest TakePIDReceiverRequest() {
52 return std::move(pid_receiver_request_);
44 } 53 }
45 54
46 void set_connect_callback(const mojom::Connector::ConnectCallback& value) { 55 void set_connect_callback(const mojom::Connector::ConnectCallback& value) {
47 connect_callback_ = value; 56 connect_callback_ = value;
48 } 57 }
49 const mojom::Connector::ConnectCallback& connect_callback() const { 58 const mojom::Connector::ConnectCallback& connect_callback() const {
50 return connect_callback_; 59 return connect_callback_;
51 } 60 }
52 61
53 private: 62 private:
54 // 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
55 // no source (e.g., for the first application or in tests). 64 // no source (e.g., for the first application or in tests).
56 Identity source_; 65 Identity source_;
57 // The identity of the application being connected to. 66 // The identity of the application being connected to.
58 Identity target_; 67 Identity target_;
59 68
60 mojom::InterfaceProviderRequest remote_interfaces_; 69 mojom::InterfaceProviderRequest remote_interfaces_;
61 mojom::ClientProcessConnectionPtr client_process_connection_; 70 mojom::ServicePtr service_;
71 mojom::PIDReceiverRequest pid_receiver_request_;
62 mojom::Connector::ConnectCallback connect_callback_; 72 mojom::Connector::ConnectCallback connect_callback_;
63 73
64 DISALLOW_COPY_AND_ASSIGN(ConnectParams); 74 DISALLOW_COPY_AND_ASSIGN(ConnectParams);
65 }; 75 };
66 76
67 } // namespace service_manager 77 } // namespace service_manager
68 78
69 #endif // SERVICES_SERVICE_MANAGER_CONNECT_PARAMS_H_ 79 #endif // SERVICES_SERVICE_MANAGER_CONNECT_PARAMS_H_
OLDNEW
« no previous file with comments | « content/common/service_manager/child_connection.cc ('k') | services/service_manager/public/cpp/connector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698