Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: remoting/client/client_status_logger.h

Issue 320403002: Pull out common code from client and host versions of LogToServer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add unittests for LogToServer Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | remoting/client/client_status_logger.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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/threading/non_thread_safe.h"
9 #include "base/time/time.h"
10 #include "remoting/jingle_glue/log_to_server.h"
11 #include "remoting/protocol/connection_to_host.h"
12 #include "remoting/protocol/errors.h"
13
14 namespace remoting {
15
16 class ChromotingStats;
17
18 // ClientStatusLogger sends client log entries to a server.
19 // The contents of the log entries are described in server_log_entry_client.cc.
20 // They do not contain any personally identifiable information.
21 class ClientStatusLogger : public base::NonThreadSafe {
22 public:
23 ClientStatusLogger(ServerLogEntry::Mode mode,
24 SignalStrategy* signal_strategy,
25 const std::string& directory_bot_jid);
26 ~ClientStatusLogger();
27
28 void LogSessionStateChange(protocol::ConnectionToHost::State state,
29 protocol::ErrorCode error);
30 void LogStatistics(remoting::ChromotingStats* statistics);
31
32 // Allows test code to fake SignalStrategy state change events.
33 void SetSignalingStateForTest(SignalStrategy::State state);
34
35 private:
36 LogToServer log_to_server_;
37
38 // Generates a new random session ID.
39 void GenerateSessionId();
40
41 // Expire the session ID if the maximum duration has been exceeded.
42 void MaybeExpireSessionId();
43
44 // A randomly generated session ID to be attached to log messages. This
45 // is regenerated at the start of a new session.
46 std::string session_id_;
47
48 // Start time of the session.
49 base::TimeTicks session_start_time_;
50
51 // Time when the session ID was generated.
52 base::TimeTicks session_id_generation_time_;
53
54 DISALLOW_COPY_AND_ASSIGN(ClientStatusLogger);
55 };
56
57 } // namespace remoting
58
59 #endif // REMOTING_CLIENT_CLIENT_STATUS_LOGGER_H_
OLDNEW
« no previous file with comments | « no previous file | remoting/client/client_status_logger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698