connection_params.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // Copyright 2017 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. #ifndef MOJO_CORE_CONNECTION_PARAMS_H_
  5. #define MOJO_CORE_CONNECTION_PARAMS_H_
  6. #include "build/build_config.h"
  7. #include "mojo/core/system_impl_export.h"
  8. #include "mojo/public/cpp/platform/platform_channel_endpoint.h"
  9. #include "mojo/public/cpp/platform/platform_channel_server_endpoint.h"
  10. namespace mojo {
  11. namespace core {
  12. // A set of parameters used when establishing a connection to another process.
  13. class MOJO_SYSTEM_IMPL_EXPORT ConnectionParams {
  14. public:
  15. ConnectionParams();
  16. explicit ConnectionParams(PlatformChannelEndpoint endpoint);
  17. explicit ConnectionParams(PlatformChannelServerEndpoint server_endpoint);
  18. ConnectionParams(ConnectionParams&&);
  19. ConnectionParams(const ConnectionParams&) = delete;
  20. ConnectionParams& operator=(const ConnectionParams&) = delete;
  21. ~ConnectionParams();
  22. ConnectionParams& operator=(ConnectionParams&&);
  23. const PlatformChannelEndpoint& endpoint() const { return endpoint_; }
  24. const PlatformChannelServerEndpoint& server_endpoint() const {
  25. return server_endpoint_;
  26. }
  27. PlatformChannelEndpoint TakeEndpoint() { return std::move(endpoint_); }
  28. PlatformChannelServerEndpoint TakeServerEndpoint() {
  29. return std::move(server_endpoint_);
  30. }
  31. void set_is_async(bool is_async) { is_async_ = is_async; }
  32. bool is_async() const { return is_async_; }
  33. void set_is_untrusted_process(bool is_untrusted_process) {
  34. is_untrusted_process_ = is_untrusted_process;
  35. }
  36. bool is_untrusted_process() const { return is_untrusted_process_; }
  37. void set_leak_endpoint(bool leak_endpoint) { leak_endpoint_ = leak_endpoint; }
  38. bool leak_endpoint() const { return leak_endpoint_; }
  39. private:
  40. bool is_async_ = false;
  41. bool is_untrusted_process_ = false;
  42. bool leak_endpoint_ = false;
  43. PlatformChannelEndpoint endpoint_;
  44. PlatformChannelServerEndpoint server_endpoint_;
  45. };
  46. } // namespace core
  47. } // namespace mojo
  48. #endif // MOJO_CORE_CONNECTION_PARAMS_H_