action_message_handler.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Copyright 2018 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 REMOTING_HOST_ACTION_MESSAGE_HANDLER_H_
  5. #define REMOTING_HOST_ACTION_MESSAGE_HANDLER_H_
  6. #include <memory>
  7. #include <string>
  8. #include <vector>
  9. #include "base/containers/flat_set.h"
  10. #include "remoting/proto/action.pb.h"
  11. #include "remoting/protocol/named_message_pipe_handler.h"
  12. namespace remoting {
  13. class ActionExecutor;
  14. constexpr char kActionDataChannelPrefix[] = "actions";
  15. class ActionMessageHandler : public protocol::NamedMessagePipeHandler {
  16. public:
  17. ActionMessageHandler(
  18. const std::string& name,
  19. const std::vector<protocol::ActionRequest::Action>& actions,
  20. std::unique_ptr<protocol::MessagePipe> pipe,
  21. std::unique_ptr<ActionExecutor> action_executor);
  22. ActionMessageHandler(const ActionMessageHandler&) = delete;
  23. ActionMessageHandler& operator=(const ActionMessageHandler&) = delete;
  24. ~ActionMessageHandler() override;
  25. // protocol::NamedMessagePipeHandler implementation.
  26. void OnIncomingMessage(std::unique_ptr<CompoundBuffer> message) override;
  27. private:
  28. std::unique_ptr<ActionExecutor> action_executor_;
  29. // Populated via the negotiated capabilities between host and client.
  30. base::flat_set<protocol::ActionRequest::Action> supported_actions_;
  31. };
  32. } // namespace remoting
  33. #endif // REMOTING_HOST_ACTION_MESSAGE_HANDLER_H_