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