summaryrefslogtreecommitdiffstats
path: root/remoting/host/ipc_host_event_logger.h
blob: ccb98325f0b70e5a1cb3122afac175c24cf383c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef REMOTING_HOST_IPC_HOST_EVENT_LOGGER_H_
#define REMOTING_HOST_IPC_HOST_EVENT_LOGGER_H_

#include <string>

#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/threading/non_thread_safe.h"
#include "remoting/host/host_event_logger.h"
#include "remoting/host/host_status_observer.h"

namespace IPC {
class Sender;
}  // namespace IPC

namespace remoting {

class HostStatusMonitor;

class IpcHostEventLogger
    : public base::NonThreadSafe,
      public HostEventLogger,
      public HostStatusObserver {
 public:
  // Initializes the logger. |daemon_channel| must outlive this object.
  IpcHostEventLogger(base::WeakPtr<HostStatusMonitor> monitor,
                     IPC::Sender* daemon_channel);
  ~IpcHostEventLogger() override;

  // HostStatusObserver interface.
  void OnAccessDenied(const std::string& jid) override;
  void OnClientAuthenticated(const std::string& jid) override;
  void OnClientConnected(const std::string& jid) override;
  void OnClientDisconnected(const std::string& jid) override;
  void OnClientRouteChange(const std::string& jid,
                           const std::string& channel_name,
                           const protocol::TransportRoute& route) override;
  void OnStart(const std::string& xmpp_login) override;
  void OnShutdown() override;

 private:
  // Used to report host status events to the daemon.
  IPC::Sender* daemon_channel_;

  base::WeakPtr<HostStatusMonitor> monitor_;

  DISALLOW_COPY_AND_ASSIGN(IpcHostEventLogger);
};

}

#endif  // REMOTING_HOST_IPC_HOST_EVENT_LOGGER_H_