| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_host.h" | 5 #include "remoting/host/server_log_entry_host.h" |
| 6 | 6 |
| 7 #include "base/strings/stringize_macros.h" | 7 #include "base/strings/stringize_macros.h" |
| 8 #include "remoting/host/host_details.h" | 8 #include "remoting/host/host_details.h" |
| 9 #include "remoting/signaling/server_log_entry.h" | 9 #include "remoting/signaling/server_log_entry.h" |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 const char kKeyHostVersion[] = "host-version"; | 26 const char kKeyHostVersion[] = "host-version"; |
| 27 | 27 |
| 28 const char kKeyConnectionType[] = "connection-type"; | 28 const char kKeyConnectionType[] = "connection-type"; |
| 29 | 29 |
| 30 const char* GetValueSessionState(bool connected) { | 30 const char* GetValueSessionState(bool connected) { |
| 31 return connected ? kValueSessionStateConnected : kValueSessionStateClosed; | 31 return connected ? kValueSessionStateConnected : kValueSessionStateClosed; |
| 32 } | 32 } |
| 33 | 33 |
| 34 } // namespace | 34 } // namespace |
| 35 | 35 |
| 36 scoped_ptr<ServerLogEntry> MakeLogEntryForSessionStateChange( | 36 std::unique_ptr<ServerLogEntry> MakeLogEntryForSessionStateChange( |
| 37 bool connected) { | 37 bool connected) { |
| 38 scoped_ptr<ServerLogEntry> entry(new ServerLogEntry()); | 38 std::unique_ptr<ServerLogEntry> entry(new ServerLogEntry()); |
| 39 entry->AddRoleField(kValueRoleHost); | 39 entry->AddRoleField(kValueRoleHost); |
| 40 entry->AddEventNameField(kValueEventNameSessionState); | 40 entry->AddEventNameField(kValueEventNameSessionState); |
| 41 entry->Set(kKeySessionState, GetValueSessionState(connected)); | 41 entry->Set(kKeySessionState, GetValueSessionState(connected)); |
| 42 return entry; | 42 return entry; |
| 43 } | 43 } |
| 44 | 44 |
| 45 scoped_ptr<ServerLogEntry> MakeLogEntryForHeartbeat() { | 45 std::unique_ptr<ServerLogEntry> MakeLogEntryForHeartbeat() { |
| 46 scoped_ptr<ServerLogEntry> entry(new ServerLogEntry()); | 46 std::unique_ptr<ServerLogEntry> entry(new ServerLogEntry()); |
| 47 entry->AddRoleField(kValueRoleHost); | 47 entry->AddRoleField(kValueRoleHost); |
| 48 entry->AddEventNameField(kValueEventNameHeartbeat); | 48 entry->AddEventNameField(kValueEventNameHeartbeat); |
| 49 return entry; | 49 return entry; |
| 50 } | 50 } |
| 51 | 51 |
| 52 void AddHostFieldsToLogEntry(ServerLogEntry* entry) { | 52 void AddHostFieldsToLogEntry(ServerLogEntry* entry) { |
| 53 // TODO os name, os version, and version will be in the main message body, | 53 // TODO os name, os version, and version will be in the main message body, |
| 54 // remove these fields at a later date to remove redundancy. | 54 // remove these fields at a later date to remove redundancy. |
| 55 entry->Set(kKeyOsName, GetHostOperatingSystemName()); | 55 entry->Set(kKeyOsName, GetHostOperatingSystemName()); |
| 56 entry->Set(kKeyOsVersion, GetHostOperatingSystemVersion()); | 56 entry->Set(kKeyOsVersion, GetHostOperatingSystemVersion()); |
| 57 entry->Set(kKeyHostVersion, STRINGIZE(VERSION)); | 57 entry->Set(kKeyHostVersion, STRINGIZE(VERSION)); |
| 58 entry->AddCpuField(); | 58 entry->AddCpuField(); |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 void AddConnectionTypeToLogEntry(ServerLogEntry* entry, | 61 void AddConnectionTypeToLogEntry(ServerLogEntry* entry, |
| 62 protocol::TransportRoute::RouteType type) { | 62 protocol::TransportRoute::RouteType type) { |
| 63 entry->Set(kKeyConnectionType, protocol::TransportRoute::GetTypeString(type)); | 63 entry->Set(kKeyConnectionType, protocol::TransportRoute::GetTypeString(type)); |
| 64 } | 64 } |
| 65 | 65 |
| 66 } // namespace remoting | 66 } // namespace remoting |
| OLD | NEW |