Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/base/chromoting_event.h" | 5 #include "remoting/base/chromoting_event.h" |
| 6 | 6 |
| 7 #include "base/strings/string_util.h" | |
| 7 #include "base/strings/stringize_macros.h" | 8 #include "base/strings/stringize_macros.h" |
| 8 #include "base/sys_info.h" | 9 #include "base/sys_info.h" |
| 9 | 10 |
| 10 namespace remoting { | 11 namespace remoting { |
| 11 | 12 |
| 12 const char ChromotingEvent::kCaptureLatencyKey[] = "capture_latency"; | 13 const char ChromotingEvent::kCaptureLatencyKey[] = "capture_latency"; |
| 13 const char ChromotingEvent::kConnectionErrorKey[] = "connection_error"; | 14 const char ChromotingEvent::kConnectionErrorKey[] = "connection_error"; |
| 14 const char ChromotingEvent::kCpuKey[] = "cpu"; | 15 const char ChromotingEvent::kCpuKey[] = "cpu"; |
| 15 const char ChromotingEvent::kDecodeLatencyKey[] = "decode_latency"; | 16 const char ChromotingEvent::kDecodeLatencyKey[] = "decode_latency"; |
| 16 const char ChromotingEvent::kEncodeLatencyKey[] = "encode_latency"; | 17 const char ChromotingEvent::kEncodeLatencyKey[] = "encode_latency"; |
| 18 const char ChromotingEvent::kHostOsKey[] = "host_os"; | |
| 19 const char ChromotingEvent::kHostOsVersionKey[] = "host_os_version"; | |
| 20 const char ChromotingEvent::kHostVersionKey[] = "host_version"; | |
| 17 const char ChromotingEvent::kMaxCaptureLatencyKey[] = "max_capture_latency"; | 21 const char ChromotingEvent::kMaxCaptureLatencyKey[] = "max_capture_latency"; |
| 18 const char ChromotingEvent::kMaxDecodeLatencyKey[] = "max_decode_latency"; | 22 const char ChromotingEvent::kMaxDecodeLatencyKey[] = "max_decode_latency"; |
| 19 const char ChromotingEvent::kMaxEncodeLatencyKey[] = "max_encode_latency"; | 23 const char ChromotingEvent::kMaxEncodeLatencyKey[] = "max_encode_latency"; |
| 20 const char ChromotingEvent::kMaxRenderLatencyKey[] = "max_render_latency"; | 24 const char ChromotingEvent::kMaxRenderLatencyKey[] = "max_render_latency"; |
| 21 const char ChromotingEvent::kMaxRoundtripLatencyKey[] = "max_roundtrip_latency"; | 25 const char ChromotingEvent::kMaxRoundtripLatencyKey[] = "max_roundtrip_latency"; |
| 22 const char ChromotingEvent::kModeKey[] = "mode"; | 26 const char ChromotingEvent::kModeKey[] = "mode"; |
| 23 const char ChromotingEvent::kOsKey[] = "os"; | 27 const char ChromotingEvent::kOsKey[] = "os"; |
| 24 const char ChromotingEvent::kOsVersionKey[] = "os_version"; | 28 const char ChromotingEvent::kOsVersionKey[] = "os_version"; |
| 25 const char ChromotingEvent::kRenderLatencyKey[] = "render_latency"; | 29 const char ChromotingEvent::kRenderLatencyKey[] = "render_latency"; |
| 26 const char ChromotingEvent::kRoleKey[] = "role"; | 30 const char ChromotingEvent::kRoleKey[] = "role"; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 113 } | 117 } |
| 114 | 118 |
| 115 // static | 119 // static |
| 116 bool ChromotingEvent::IsEndOfSession(SessionState state) { | 120 bool ChromotingEvent::IsEndOfSession(SessionState state) { |
| 117 return state == SessionState::CLOSED || | 121 return state == SessionState::CLOSED || |
| 118 state == SessionState::CONNECTION_DROPPED || | 122 state == SessionState::CONNECTION_DROPPED || |
| 119 state == SessionState::CONNECTION_FAILED || | 123 state == SessionState::CONNECTION_FAILED || |
| 120 state == SessionState::CONNECTION_CANCELED; | 124 state == SessionState::CONNECTION_CANCELED; |
| 121 } | 125 } |
| 122 | 126 |
| 127 // static | |
| 128 ChromotingEvent::Os ChromotingEvent::toOs(const std::string& os) { | |
| 129 std::string lowerOs = base::ToLowerASCII(os); | |
|
Sergey Ulanov
2017/01/13 00:23:17
lower_os
Yuwei
2017/01/13 01:51:12
Done.
| |
| 130 if (lowerOs == "linux") { | |
| 131 return Os::CHROMOTING_LINUX; | |
| 132 } else if (lowerOs == "chromeos") { | |
| 133 return Os::CHROMOTING_CHROMEOS; | |
| 134 } else if (lowerOs == "mac") { | |
| 135 return Os::CHROMOTING_MAC; | |
| 136 } else if (lowerOs == "windows") { | |
| 137 return Os::CHROMOTING_WINDOWS; | |
| 138 } else if (lowerOs == "android") { | |
| 139 return Os::CHROMOTING_ANDROID; | |
| 140 } else if (lowerOs == "ios") { | |
| 141 return Os::CHROMOTING_IOS; | |
| 142 } | |
| 143 return Os::OTHER; | |
| 144 } | |
| 145 | |
| 123 } // namespace remoting | 146 } // namespace remoting |
| OLD | NEW |