Add a Notification Settings Button to all web notifications behind the web platform...
[chromium-blink-merge.git] / remoting / signaling / server_log_entry.h
blobf1b0ece54f28f47598e1f18df1efef9467e725ea
1 // Copyright 2014 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_SIGNALING_SERVER_LOG_ENTRY_H_
6 #define REMOTING_SIGNALING_SERVER_LOG_ENTRY_H_
8 #include <map>
9 #include <string>
11 #include "base/memory/scoped_ptr.h"
13 namespace buzz {
14 class XmlElement;
15 } // namespace buzz
17 namespace remoting {
19 // Utility class for building log entries to send to the remoting bot. This is
20 // a wrapper around a key/value map and is copyable so it can be used in STL
21 // containers.
22 class ServerLogEntry {
23 public:
24 // The mode of a connection.
25 enum Mode {
26 IT2ME,
27 ME2ME
30 ServerLogEntry();
31 ~ServerLogEntry();
33 // Sets an arbitrary key/value entry.
34 void Set(const std::string& key, const std::string& value);
36 // Adds a field describing the CPU type of the platform.
37 void AddCpuField();
39 // Adds a field describing the mode of a connection to this log entry.
40 void AddModeField(Mode mode);
42 // Adds a field describing the role (client/host).
43 void AddRoleField(const char* role);
45 // Adds a field describing the type of log entry.
46 void AddEventNameField(const char* name);
48 // Constructs a log stanza. The caller should add one or more log entry
49 // stanzas as children of this stanza, before sending the log stanza to
50 // the remoting bot.
51 static scoped_ptr<buzz::XmlElement> MakeStanza();
53 // Converts this object to an XML stanza.
54 scoped_ptr<buzz::XmlElement> ToStanza() const;
56 private:
57 typedef std::map<std::string, std::string> ValuesMap;
59 ValuesMap values_map_;
62 } // namespace remoting
64 #endif // REMOTING_SIGNALING_SERVER_LOG_ENTRY_H_