OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "remoting/host/server_log_entry.h" | 5 #include "remoting/host/server_log_entry.h" |
6 | 6 |
7 #include "base/sys_info.h" | 7 #include "base/sys_info.h" |
8 #include "remoting/base/constants.h" | 8 #include "remoting/base/constants.h" |
9 #include "remoting/protocol/session.h" | 9 #include "remoting/protocol/session.h" |
10 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" | 10 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 ServerLogEntry::~ServerLogEntry() { | 56 ServerLogEntry::~ServerLogEntry() { |
57 } | 57 } |
58 | 58 |
59 // static | 59 // static |
60 scoped_ptr<buzz::XmlElement> ServerLogEntry::MakeStanza() { | 60 scoped_ptr<buzz::XmlElement> ServerLogEntry::MakeStanza() { |
61 return scoped_ptr<buzz::XmlElement>( | 61 return scoped_ptr<buzz::XmlElement>( |
62 new XmlElement(QName(kChromotingXmlNamespace, kLogCommand))); | 62 new XmlElement(QName(kChromotingXmlNamespace, kLogCommand))); |
63 } | 63 } |
64 | 64 |
65 // static | 65 // static |
66 ServerLogEntry* ServerLogEntry::MakeSessionStateChange(bool connected) { | 66 scoped_ptr<ServerLogEntry> ServerLogEntry::MakeForSessionStateChange( |
67 ServerLogEntry* entry = new ServerLogEntry(); | 67 bool connected) { |
| 68 scoped_ptr<ServerLogEntry> entry(new ServerLogEntry()); |
68 entry->Set(kKeyRole, kValueRoleHost); | 69 entry->Set(kKeyRole, kValueRoleHost); |
69 entry->Set(kKeyEventName, kValueEventNameSessionState); | 70 entry->Set(kKeyEventName, kValueEventNameSessionState); |
70 entry->Set(kKeySessionState, GetValueSessionState(connected)); | 71 entry->Set(kKeySessionState, GetValueSessionState(connected)); |
71 return entry; | 72 return entry.Pass(); |
72 } | 73 } |
73 | 74 |
74 // static | 75 // static |
75 ServerLogEntry* ServerLogEntry::MakeForHeartbeat() { | 76 scoped_ptr<ServerLogEntry> ServerLogEntry::MakeForHeartbeat() { |
76 ServerLogEntry* entry = new ServerLogEntry(); | 77 scoped_ptr<ServerLogEntry> entry(new ServerLogEntry()); |
77 entry->Set(kKeyRole, kValueRoleHost); | 78 entry->Set(kKeyRole, kValueRoleHost); |
78 entry->Set(kKeyEventName, kValueEventNameHeartbeat); | 79 entry->Set(kKeyEventName, kValueEventNameHeartbeat); |
79 return entry; | 80 return entry.Pass(); |
80 } | 81 } |
81 | 82 |
82 void ServerLogEntry::AddHostFields() { | 83 void ServerLogEntry::AddHostFields() { |
83 #if defined(OS_WIN) | 84 #if defined(OS_WIN) |
84 Set(kKeyOsName, kValueOsNameWindows); | 85 Set(kKeyOsName, kValueOsNameWindows); |
85 #elif defined(OS_MACOSX) | 86 #elif defined(OS_MACOSX) |
86 Set(kKeyOsName, kValueOsNameMac); | 87 Set(kKeyOsName, kValueOsNameMac); |
87 #elif defined(OS_CHROMEOS) | 88 #elif defined(OS_CHROMEOS) |
88 Set(kKeyOsName, kValueOsNameChromeOS); | 89 Set(kKeyOsName, kValueOsNameChromeOS); |
89 #elif defined(OS_LINUX) | 90 #elif defined(OS_LINUX) |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 // static | 143 // static |
143 const char* ServerLogEntry::GetValueSessionState(bool connected) { | 144 const char* ServerLogEntry::GetValueSessionState(bool connected) { |
144 return connected ? kValueSessionStateConnected : kValueSessionStateClosed; | 145 return connected ? kValueSessionStateConnected : kValueSessionStateClosed; |
145 } | 146 } |
146 | 147 |
147 void ServerLogEntry::Set(const std::string& key, const std::string& value) { | 148 void ServerLogEntry::Set(const std::string& key, const std::string& value) { |
148 values_map_[key] = value; | 149 values_map_[key] = value; |
149 } | 150 } |
150 | 151 |
151 } // namespace remoting | 152 } // namespace remoting |
OLD | NEW |