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/client/server_log_entry_client.h" | 5 #include "remoting/client/server_log_entry_client.h" |
6 | 6 |
7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
8 #include "base/strings/stringize_macros.h" | 8 #include "base/strings/stringize_macros.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/sys_info.h" | 10 #include "base/sys_info.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 case ConnectionToHost::AUTHENTICATED: | 49 case ConnectionToHost::AUTHENTICATED: |
50 return "authenticated"; | 50 return "authenticated"; |
51 case ConnectionToHost::CONNECTED: | 51 case ConnectionToHost::CONNECTED: |
52 return kValueSessionStateConnected; | 52 return kValueSessionStateConnected; |
53 case ConnectionToHost::FAILED: | 53 case ConnectionToHost::FAILED: |
54 return "connection-failed"; | 54 return "connection-failed"; |
55 case ConnectionToHost::CLOSED: | 55 case ConnectionToHost::CLOSED: |
56 return kValueSessionStateClosed; | 56 return kValueSessionStateClosed; |
57 default: | 57 default: |
58 NOTREACHED(); | 58 NOTREACHED(); |
59 return NULL; | 59 return nullptr; |
60 } | 60 } |
61 } | 61 } |
62 | 62 |
63 const char* GetValueError(ErrorCode error) { | 63 const char* GetValueError(ErrorCode error) { |
64 switch (error) { | 64 switch (error) { |
65 // Where possible, these are the same strings that the webapp sends for the | 65 // Where possible, these are the same strings that the webapp sends for the |
66 // corresponding error - see remoting/webapp/server_log_entry.js. | 66 // corresponding error - see remoting/webapp/server_log_entry.js. |
67 case protocol::OK: | 67 case protocol::OK: |
68 return "none"; | 68 return "none"; |
69 case protocol::PEER_IS_OFFLINE: | 69 case protocol::PEER_IS_OFFLINE: |
70 return "host-is-offline"; | 70 return "host-is-offline"; |
71 case protocol::SESSION_REJECTED: | 71 case protocol::SESSION_REJECTED: |
72 return "session-rejected"; | 72 return "session-rejected"; |
73 case protocol::INCOMPATIBLE_PROTOCOL: | 73 case protocol::INCOMPATIBLE_PROTOCOL: |
74 return "incompatible-protocol"; | 74 return "incompatible-protocol"; |
75 case protocol::AUTHENTICATION_FAILED: | 75 case protocol::AUTHENTICATION_FAILED: |
76 return "authentication-failed"; | 76 return "authentication-failed"; |
77 case protocol::CHANNEL_CONNECTION_ERROR: | 77 case protocol::CHANNEL_CONNECTION_ERROR: |
78 return "channel-connection-error"; | 78 return "channel-connection-error"; |
79 case protocol::SIGNALING_ERROR: | 79 case protocol::SIGNALING_ERROR: |
80 return "signaling-error"; | 80 return "signaling-error"; |
81 case protocol::SIGNALING_TIMEOUT: | 81 case protocol::SIGNALING_TIMEOUT: |
82 return "signaling-timeout"; | 82 return "signaling-timeout"; |
83 case protocol::HOST_OVERLOAD: | 83 case protocol::HOST_OVERLOAD: |
84 return "host-overload"; | 84 return "host-overload"; |
85 case protocol::UNKNOWN_ERROR: | 85 case protocol::UNKNOWN_ERROR: |
86 return "unknown-error"; | 86 return "unknown-error"; |
87 default: | 87 default: |
88 NOTREACHED(); | 88 NOTREACHED(); |
89 return NULL; | 89 return nullptr; |
90 } | 90 } |
91 } | 91 } |
92 | 92 |
93 } // namespace | 93 } // namespace |
94 | 94 |
95 scoped_ptr<ServerLogEntry> MakeLogEntryForSessionStateChange( | 95 scoped_ptr<ServerLogEntry> MakeLogEntryForSessionStateChange( |
96 ConnectionToHost::State state, | 96 ConnectionToHost::State state, |
97 ErrorCode error) { | 97 ErrorCode error) { |
98 scoped_ptr<ServerLogEntry> entry(new ServerLogEntry()); | 98 scoped_ptr<ServerLogEntry> entry(new ServerLogEntry()); |
99 entry->AddRoleField(kValueRoleClient); | 99 entry->AddRoleField(kValueRoleClient); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 void AddSessionIdToLogEntry(ServerLogEntry* entry, const std::string& id) { | 157 void AddSessionIdToLogEntry(ServerLogEntry* entry, const std::string& id) { |
158 entry->Set(kKeySessionId, id); | 158 entry->Set(kKeySessionId, id); |
159 } | 159 } |
160 | 160 |
161 void AddSessionDurationToLogEntry(ServerLogEntry* entry, | 161 void AddSessionDurationToLogEntry(ServerLogEntry* entry, |
162 base::TimeDelta duration) { | 162 base::TimeDelta duration) { |
163 entry->Set(kKeySessionDuration, base::Int64ToString(duration.InSeconds())); | 163 entry->Set(kKeySessionDuration, base::Int64ToString(duration.InSeconds())); |
164 } | 164 } |
165 | 165 |
166 } // namespace remoting | 166 } // namespace remoting |
OLD | NEW |