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/strings/stringize_macros.h" | 8 #include "base/strings/stringize_macros.h" |
9 #include "base/sys_info.h" | 9 #include "base/sys_info.h" |
10 #include "remoting/base/constants.h" | 10 #include "remoting/base/constants.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 const char kValueModeMe2Me[] = "me2me"; | 36 const char kValueModeMe2Me[] = "me2me"; |
37 | 37 |
38 const char kKeySessionState[] = "session-state"; | 38 const char kKeySessionState[] = "session-state"; |
39 const char kValueSessionStateConnected[] = "connected"; | 39 const char kValueSessionStateConnected[] = "connected"; |
40 const char kValueSessionStateClosed[] = "closed"; | 40 const char kValueSessionStateClosed[] = "closed"; |
41 | 41 |
42 const char kStatusName[] = "status"; | 42 const char kStatusName[] = "status"; |
43 const char kExitCodeName[] = "exit-code"; | 43 const char kExitCodeName[] = "exit-code"; |
44 | 44 |
45 const char kKeyOsName[] = "os-name"; | 45 const char kKeyOsName[] = "os-name"; |
46 const char kValueOsNameWindows[] = "Windows"; | |
47 const char kValueOsNameLinux[] = "Linux"; | |
48 const char kValueOsNameMac[] = "Mac"; | |
49 const char kValueOsNameChromeOS[] = "ChromeOS"; | |
50 | 46 |
51 const char kKeyOsVersion[] = "os-version"; | 47 const char kKeyOsVersion[] = "os-version"; |
52 | 48 |
53 const char kKeyHostVersion[] = "host-version"; | 49 const char kKeyHostVersion[] = "host-version"; |
54 | 50 |
55 const char kKeyCpu[] = "cpu"; | 51 const char kKeyCpu[] = "cpu"; |
56 | 52 |
57 const char kKeyConnectionType[] = "connection-type"; | 53 const char kKeyConnectionType[] = "connection-type"; |
58 | 54 |
59 } // namespace | 55 } // namespace |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 entry->Set(kKeyRole, kValueRoleHost); | 91 entry->Set(kKeyRole, kValueRoleHost); |
96 entry->Set(kKeyEventName, kValueEventNameHostStatus); | 92 entry->Set(kKeyEventName, kValueEventNameHostStatus); |
97 entry->Set(kStatusName, HostStatusSender::HostStatusToString(host_status)); | 93 entry->Set(kStatusName, HostStatusSender::HostStatusToString(host_status)); |
98 if (host_status == HostStatusSender::OFFLINE) | 94 if (host_status == HostStatusSender::OFFLINE) |
99 entry->Set(kExitCodeName, ExitCodeToString(exit_code)); | 95 entry->Set(kExitCodeName, ExitCodeToString(exit_code)); |
100 return entry.Pass(); | 96 return entry.Pass(); |
101 } | 97 } |
102 | 98 |
103 void ServerLogEntry::AddHostFields() { | 99 void ServerLogEntry::AddHostFields() { |
104 #if defined(OS_WIN) | 100 #if defined(OS_WIN) |
105 Set(kKeyOsName, kValueOsNameWindows); | 101 Set(kKeyOsName, "Windows"); |
106 #elif defined(OS_MACOSX) | 102 #elif defined(OS_MACOSX) |
107 Set(kKeyOsName, kValueOsNameMac); | 103 Set(kKeyOsName, "Mac"); |
108 #elif defined(OS_CHROMEOS) | 104 #elif defined(OS_CHROMEOS) |
109 Set(kKeyOsName, kValueOsNameChromeOS); | 105 Set(kKeyOsName, "ChromeOS"); |
110 #elif defined(OS_LINUX) | 106 #elif defined(OS_LINUX) |
111 Set(kKeyOsName, kValueOsNameLinux); | 107 Set(kKeyOsName, "Linux"); |
112 #endif | 108 #endif |
113 | 109 |
114 // SysInfo::OperatingSystemVersionNumbers is only defined for the following | 110 // SysInfo::OperatingSystemVersionNumbers is only defined for the following |
115 // OSes: see base/sys_info_unittest.cc. | 111 // OSes: see base/sys_info_unittest.cc. |
116 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS) | 112 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS) |
117 std::stringstream os_version; | 113 std::stringstream os_version; |
118 int32 os_major_version = 0; | 114 int32 os_major_version = 0; |
119 int32 os_minor_version = 0; | 115 int32 os_minor_version = 0; |
120 int32 os_bugfix_version = 0; | 116 int32 os_bugfix_version = 0; |
121 SysInfo::OperatingSystemVersionNumbers(&os_major_version, &os_minor_version, | 117 SysInfo::OperatingSystemVersionNumbers(&os_major_version, &os_minor_version, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 // static | 160 // static |
165 const char* ServerLogEntry::GetValueSessionState(bool connected) { | 161 const char* ServerLogEntry::GetValueSessionState(bool connected) { |
166 return connected ? kValueSessionStateConnected : kValueSessionStateClosed; | 162 return connected ? kValueSessionStateConnected : kValueSessionStateClosed; |
167 } | 163 } |
168 | 164 |
169 void ServerLogEntry::Set(const std::string& key, const std::string& value) { | 165 void ServerLogEntry::Set(const std::string& key, const std::string& value) { |
170 values_map_[key] = value; | 166 values_map_[key] = value; |
171 } | 167 } |
172 | 168 |
173 } // namespace remoting | 169 } // namespace remoting |
OLD | NEW |