Remove some NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED
[chromium-blink-merge.git] / remoting / host / server_log_entry.h
blobccaa8501bc04b524aa17171925265992a6278122
1 // Copyright (c) 2012 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.
5 #ifndef REMOTING_HOST_SERVER_LOG_ENTRY_H_
6 #define REMOTING_HOST_SERVER_LOG_ENTRY_H_
8 #include <map>
9 #include <string>
11 #include "base/memory/scoped_ptr.h"
12 #include "remoting/host/host_exit_codes.h"
13 #include "remoting/host/host_status_sender.h"
14 #include "remoting/protocol/transport.h"
16 namespace buzz {
17 class XmlElement;
18 } // namespace buzz
20 namespace remoting {
22 class ServerLogEntry {
23 public:
24 // The mode of a connection.
25 enum Mode {
26 IT2ME,
27 ME2ME
30 // Constructs a log stanza. The caller should add one or more log entry
31 // stanzas as children of this stanza, before sending the log stanza to
32 // the remoting bot.
33 static scoped_ptr<buzz::XmlElement> MakeStanza();
35 // Constructs a log entry for a session state change.
36 // Currently this is either connection or disconnection.
37 static scoped_ptr<ServerLogEntry> MakeForSessionStateChange(bool connection);
39 // Constructs a log entry for a heartbeat.
40 static scoped_ptr<ServerLogEntry> MakeForHeartbeat();
42 // Constructs a log entry for a host status message.
43 static scoped_ptr<ServerLogEntry> MakeForHostStatus(
44 HostStatusSender::HostStatus host_status, HostExitCodes exit_code);
46 ~ServerLogEntry();
48 // Adds fields describing the host to this log entry.
49 void AddHostFields();
51 // Adds a field describing the mode of a connection to this log entry.
52 void AddModeField(Mode mode);
54 // Adds a field describing connection type (direct/stun/relay).
55 void AddConnectionTypeField(protocol::TransportRoute::RouteType type);
57 // Converts this object to an XML stanza.
58 scoped_ptr<buzz::XmlElement> ToStanza() const;
60 private:
61 typedef std::map<std::string, std::string> ValuesMap;
63 ServerLogEntry();
64 void Set(const std::string& key, const std::string& value);
66 static const char* GetValueSessionState(bool connected);
67 static const char* GetValueMode(Mode mode);
69 ValuesMap values_map_;
72 } // namespace remoting
74 #endif