ipc_host_event_logger.cc 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // Copyright (c) 2013 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. #include "remoting/host/ipc_host_event_logger.h"
  5. #include "base/check_op.h"
  6. #include "ipc/ipc_sender.h"
  7. #include "net/base/ip_endpoint.h"
  8. #include "remoting/host/host_status_monitor.h"
  9. #include "remoting/protocol/transport.h"
  10. namespace remoting {
  11. IpcHostEventLogger::IpcHostEventLogger(
  12. scoped_refptr<HostStatusMonitor> monitor,
  13. mojo::AssociatedRemote<mojom::HostStatusObserver> remote)
  14. : host_status_observer_(std::move(remote)), monitor_(monitor) {
  15. monitor_->AddStatusObserver(this);
  16. }
  17. IpcHostEventLogger::~IpcHostEventLogger() {
  18. DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  19. monitor_->RemoveStatusObserver(this);
  20. }
  21. void IpcHostEventLogger::OnClientAccessDenied(const std::string& signaling_id) {
  22. DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  23. host_status_observer_->OnClientAccessDenied(signaling_id);
  24. }
  25. void IpcHostEventLogger::OnClientAuthenticated(
  26. const std::string& signaling_id) {
  27. DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  28. host_status_observer_->OnClientAuthenticated(signaling_id);
  29. }
  30. void IpcHostEventLogger::OnClientConnected(const std::string& signaling_id) {
  31. DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  32. host_status_observer_->OnClientConnected(signaling_id);
  33. }
  34. void IpcHostEventLogger::OnClientDisconnected(const std::string& signaling_id) {
  35. DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  36. host_status_observer_->OnClientDisconnected(signaling_id);
  37. }
  38. void IpcHostEventLogger::OnClientRouteChange(
  39. const std::string& signaling_id,
  40. const std::string& channel_name,
  41. const protocol::TransportRoute& route) {
  42. DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  43. host_status_observer_->OnClientRouteChange(signaling_id, channel_name, route);
  44. }
  45. void IpcHostEventLogger::OnHostShutdown() {
  46. DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  47. host_status_observer_->OnHostShutdown();
  48. }
  49. void IpcHostEventLogger::OnHostStarted(const std::string& owner_email) {
  50. DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  51. host_status_observer_->OnHostStarted(owner_email);
  52. }
  53. } // namespace remoting