| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef REMOTING_CLIENT_CLIENT_STATUS_LOGGER_H_ | |
| 6 #define REMOTING_CLIENT_CLIENT_STATUS_LOGGER_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/threading/non_thread_safe.h" | |
| 10 #include "base/time/time.h" | |
| 11 #include "remoting/protocol/connection_to_host.h" | |
| 12 #include "remoting/protocol/errors.h" | |
| 13 #include "remoting/signaling/log_to_server.h" | |
| 14 | |
| 15 namespace remoting { | |
| 16 | |
| 17 namespace protocol { | |
| 18 class PerformanceTracker; | |
| 19 } // namespace protocol | |
| 20 | |
| 21 // ClientStatusLogger sends client log entries to a server. | |
| 22 // The contents of the log entries are described in server_log_entry_client.cc. | |
| 23 // They do not contain any personally identifiable information. | |
| 24 class ClientStatusLogger : public base::NonThreadSafe { | |
| 25 public: | |
| 26 ClientStatusLogger(ServerLogEntry::Mode mode, | |
| 27 SignalStrategy* signal_strategy, | |
| 28 const std::string& directory_bot_jid); | |
| 29 ~ClientStatusLogger(); | |
| 30 | |
| 31 void LogSessionStateChange(protocol::ConnectionToHost::State state, | |
| 32 protocol::ErrorCode error); | |
| 33 void LogStatistics(protocol::PerformanceTracker* perf_tracker); | |
| 34 | |
| 35 // Allows test code to fake SignalStrategy state change events. | |
| 36 void SetSignalingStateForTest(SignalStrategy::State state); | |
| 37 | |
| 38 private: | |
| 39 LogToServer log_to_server_; | |
| 40 | |
| 41 // Generates a new random session ID. | |
| 42 void GenerateSessionId(); | |
| 43 | |
| 44 // Expire the session ID if the maximum duration has been exceeded. | |
| 45 void MaybeExpireSessionId(); | |
| 46 | |
| 47 // A randomly generated session ID to be attached to log messages. This | |
| 48 // is regenerated at the start of a new session. | |
| 49 std::string session_id_; | |
| 50 | |
| 51 // Start time of the session. | |
| 52 base::TimeTicks session_start_time_; | |
| 53 | |
| 54 // Time when the session ID was generated. | |
| 55 base::TimeTicks session_id_generation_time_; | |
| 56 | |
| 57 DISALLOW_COPY_AND_ASSIGN(ClientStatusLogger); | |
| 58 }; | |
| 59 | |
| 60 } // namespace remoting | |
| 61 | |
| 62 #endif // REMOTING_CLIENT_CLIENT_STATUS_LOGGER_H_ | |
| OLD | NEW |