| 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 #ifndef REMOTING_SIGNALING_CHROMOTING_EVENT_H_ | 5 #ifndef REMOTING_BASE_CHROMOTING_EVENT_H_ |
| 6 #define REMOTING_SIGNALING_CHROMOTING_EVENT_H_ | 6 #define REMOTING_BASE_CHROMOTING_EVENT_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 | 12 |
| 13 namespace remoting { | 13 namespace remoting { |
| 14 | 14 |
| 15 // This is the representation of the log entry being sent to the telemetry | 15 // This is the representation of the log entry being sent to the telemetry |
| 16 // server. The content should be synced with chromoting_event.js and | 16 // server. The content should be synced with chromoting_event.js and |
| (...skipping 14 matching lines...) Expand all Loading... |
| 31 HOST_OVERLOAD = 11, | 31 HOST_OVERLOAD = 11, |
| 32 P2P_FAILURE = 12, | 32 P2P_FAILURE = 12, |
| 33 UNEXPECTED = 13, | 33 UNEXPECTED = 13, |
| 34 CLIENT_SUSPENDED = 14, | 34 CLIENT_SUSPENDED = 14, |
| 35 NACL_DISABLED = 15, | 35 NACL_DISABLED = 15, |
| 36 MAX_SESSION_LENGTH = 16, | 36 MAX_SESSION_LENGTH = 16, |
| 37 HOST_CONFIGURATION_ERROR = 17, | 37 HOST_CONFIGURATION_ERROR = 17, |
| 38 NACL_PLUGIN_CRASHED = 18 | 38 NACL_PLUGIN_CRASHED = 18 |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 enum class Mode { IT2ME = 1, ME2ME = 2, LGAPP = 3 }; | 41 enum class Mode { IT2ME = 1, ME2ME = 2 }; |
| 42 | 42 |
| 43 // macro defines from command line have polluted OS names like | 43 // macro defines from command line have polluted OS names like |
| 44 // "LINUX", "ANDROID", etc. | 44 // "LINUX", "ANDROID", etc. |
| 45 enum class Os { | 45 enum class Os { |
| 46 CHROMOTING_LINUX = 1, | 46 CHROMOTING_LINUX = 1, |
| 47 CHROMOTING_CHROMEOS = 2, | 47 CHROMOTING_CHROMEOS = 2, |
| 48 CHROMOTING_MAC = 3, | 48 CHROMOTING_MAC = 3, |
| 49 CHROMOTING_WINDOWS = 4, | 49 CHROMOTING_WINDOWS = 4, |
| 50 OTHER = 5, | 50 OTHER = 5, |
| 51 CHROMOTING_ANDROID = 6, | 51 CHROMOTING_ANDROID = 6, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 ~ChromotingEvent(); | 116 ~ChromotingEvent(); |
| 117 | 117 |
| 118 ChromotingEvent& operator=(const ChromotingEvent& other); | 118 ChromotingEvent& operator=(const ChromotingEvent& other); |
| 119 ChromotingEvent& operator=(ChromotingEvent&& other); | 119 ChromotingEvent& operator=(ChromotingEvent&& other); |
| 120 | 120 |
| 121 // Sets an arbitrary key/value entry. | 121 // Sets an arbitrary key/value entry. |
| 122 void SetString(const std::string& key, const std::string& value); | 122 void SetString(const std::string& key, const std::string& value); |
| 123 void SetInteger(const std::string& key, int value); | 123 void SetInteger(const std::string& key, int value); |
| 124 void SetBoolean(const std::string& key, bool value); | 124 void SetBoolean(const std::string& key, bool value); |
| 125 void SetDouble(const std::string& key, double value); | 125 void SetDouble(const std::string& key, double value); |
| 126 template <typename E> | 126 template <typename EnumType> |
| 127 void SetEnum(const std::string& key, E e) { | 127 void SetEnum(const std::string& key, EnumType value) { |
| 128 SetInteger(key, static_cast<int>(e)); | 128 SetInteger(key, static_cast<int>(value)); |
| 129 } | 129 } |
| 130 | 130 |
| 131 // Adds fields of CPU type, OS type and OS version. | 131 // Adds fields of CPU type, OS type and OS version. |
| 132 void AddSystemInfo(); | 132 void AddSystemInfo(); |
| 133 | 133 |
| 134 void IncrementTryCount(); | 134 void IncrementSendAttempts(); |
| 135 int try_count() const { return try_count_; } | 135 int send_attempts() const { return send_attempts_; } |
| 136 | 136 |
| 137 // Returns a copy of the internal dictionary value. | 137 // Returns a copy of the internal dictionary value. |
| 138 std::unique_ptr<base::DictionaryValue> CopyDictionaryValue() const; | 138 std::unique_ptr<base::DictionaryValue> CopyDictionaryValue() const; |
| 139 | 139 |
| 140 // Returns true if the SessionState concludes the end of session. | 140 // Returns true if the SessionState concludes the end of session. |
| 141 static bool IsEndOfSession(SessionState state); | 141 static bool IsEndOfSession(SessionState state); |
| 142 | 142 |
| 143 private: | 143 private: |
| 144 std::unique_ptr<base::DictionaryValue> values_map_; | 144 std::unique_ptr<base::DictionaryValue> values_map_; |
| 145 | 145 |
| 146 int try_count_ = 0; | 146 int send_attempts_ = 0; |
| 147 }; | 147 }; |
| 148 | 148 |
| 149 } // namespace remoting | 149 } // namespace remoting |
| 150 | 150 |
| 151 #endif // REMOTING_SIGNALING_CHROMOTING_EVENT_H_ | 151 #endif // REMOTING_BASE_CHROMOTING_EVENT_H_ |
| OLD | NEW |