| 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/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/stringize_macros.h" |
| 8 #include "base/sys_info.h" | 9 #include "base/sys_info.h" |
| 9 #include "remoting/base/constants.h" | 10 #include "remoting/base/constants.h" |
| 10 #include "remoting/protocol/session.h" | 11 #include "remoting/protocol/session.h" |
| 11 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" | 12 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" |
| 12 | 13 |
| 13 using base::SysInfo; | 14 using base::SysInfo; |
| 14 using buzz::QName; | 15 using buzz::QName; |
| 15 using buzz::XmlElement; | 16 using buzz::XmlElement; |
| 16 using remoting::protocol::Session; | 17 using remoting::protocol::Session; |
| 17 | 18 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 38 const char kValueSessionStateClosed[] = "closed"; | 39 const char kValueSessionStateClosed[] = "closed"; |
| 39 | 40 |
| 40 const char kKeyOsName[] = "os-name"; | 41 const char kKeyOsName[] = "os-name"; |
| 41 const char kValueOsNameWindows[] = "Windows"; | 42 const char kValueOsNameWindows[] = "Windows"; |
| 42 const char kValueOsNameLinux[] = "Linux"; | 43 const char kValueOsNameLinux[] = "Linux"; |
| 43 const char kValueOsNameMac[] = "Mac"; | 44 const char kValueOsNameMac[] = "Mac"; |
| 44 const char kValueOsNameChromeOS[] = "ChromeOS"; | 45 const char kValueOsNameChromeOS[] = "ChromeOS"; |
| 45 | 46 |
| 46 const char kKeyOsVersion[] = "os-version"; | 47 const char kKeyOsVersion[] = "os-version"; |
| 47 | 48 |
| 49 const char kKeyHostVersion[] = "host-version"; |
| 50 |
| 48 const char kKeyCpu[] = "cpu"; | 51 const char kKeyCpu[] = "cpu"; |
| 49 | 52 |
| 50 const char kKeyConnectionType[] = "connection-type"; | 53 const char kKeyConnectionType[] = "connection-type"; |
| 51 | 54 |
| 52 } // namespace | 55 } // namespace |
| 53 | 56 |
| 54 ServerLogEntry::ServerLogEntry() { | 57 ServerLogEntry::ServerLogEntry() { |
| 55 } | 58 } |
| 56 | 59 |
| 57 ServerLogEntry::~ServerLogEntry() { | 60 ServerLogEntry::~ServerLogEntry() { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 int32 os_major_version = 0; | 102 int32 os_major_version = 0; |
| 100 int32 os_minor_version = 0; | 103 int32 os_minor_version = 0; |
| 101 int32 os_bugfix_version = 0; | 104 int32 os_bugfix_version = 0; |
| 102 SysInfo::OperatingSystemVersionNumbers(&os_major_version, &os_minor_version, | 105 SysInfo::OperatingSystemVersionNumbers(&os_major_version, &os_minor_version, |
| 103 &os_bugfix_version); | 106 &os_bugfix_version); |
| 104 os_version << os_major_version << "." << os_minor_version << "." | 107 os_version << os_major_version << "." << os_minor_version << "." |
| 105 << os_bugfix_version; | 108 << os_bugfix_version; |
| 106 Set(kKeyOsVersion, os_version.str()); | 109 Set(kKeyOsVersion, os_version.str()); |
| 107 #endif | 110 #endif |
| 108 | 111 |
| 112 Set(kKeyHostVersion, STRINGIZE(VERSION)); |
| 109 Set(kKeyCpu, SysInfo::CPUArchitecture()); | 113 Set(kKeyCpu, SysInfo::CPUArchitecture()); |
| 110 }; | 114 }; |
| 111 | 115 |
| 112 void ServerLogEntry::AddModeField(ServerLogEntry::Mode mode) { | 116 void ServerLogEntry::AddModeField(ServerLogEntry::Mode mode) { |
| 113 Set(kKeyMode, GetValueMode(mode)); | 117 Set(kKeyMode, GetValueMode(mode)); |
| 114 } | 118 } |
| 115 | 119 |
| 116 void ServerLogEntry::AddConnectionTypeField( | 120 void ServerLogEntry::AddConnectionTypeField( |
| 117 protocol::TransportRoute::RouteType type) { | 121 protocol::TransportRoute::RouteType type) { |
| 118 Set(kKeyConnectionType, protocol::TransportRoute::GetTypeString(type)); | 122 Set(kKeyConnectionType, protocol::TransportRoute::GetTypeString(type)); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 144 // static | 148 // static |
| 145 const char* ServerLogEntry::GetValueSessionState(bool connected) { | 149 const char* ServerLogEntry::GetValueSessionState(bool connected) { |
| 146 return connected ? kValueSessionStateConnected : kValueSessionStateClosed; | 150 return connected ? kValueSessionStateConnected : kValueSessionStateClosed; |
| 147 } | 151 } |
| 148 | 152 |
| 149 void ServerLogEntry::Set(const std::string& key, const std::string& value) { | 153 void ServerLogEntry::Set(const std::string& key, const std::string& value) { |
| 150 values_map_[key] = value; | 154 values_map_[key] = value; |
| 151 } | 155 } |
| 152 | 156 |
| 153 } // namespace remoting | 157 } // namespace remoting |
| OLD | NEW |