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

Side by Side Diff: remoting/host/server_log_entry.cc

Issue 18075003: Host offline status reporting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing CR feedback Created 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/host/server_log_entry.h" 5 #include "remoting/host/server_log_entry.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/stringize_macros.h" 8 #include "base/strings/stringize_macros.h"
9 #include "base/sys_info.h" 9 #include "base/sys_info.h"
10 #include "remoting/base/constants.h" 10 #include "remoting/base/constants.h"
11 #include "remoting/protocol/session.h" 11 #include "remoting/protocol/session.h"
12 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" 12 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h"
13 13
14 using base::SysInfo; 14 using base::SysInfo;
15 using buzz::QName; 15 using buzz::QName;
16 using buzz::XmlElement; 16 using buzz::XmlElement;
17 using remoting::protocol::Session; 17 using remoting::protocol::Session;
18 18
19 namespace remoting { 19 namespace remoting {
20 20
21 namespace { 21 namespace {
22 const char kLogCommand[] = "log"; 22 const char kLogCommand[] = "log";
23 23
24 const char kLogEntry[] = "entry"; 24 const char kLogEntry[] = "entry";
25 25
26 const char kKeyEventName[] = "event-name"; 26 const char kKeyEventName[] = "event-name";
27 const char kValueEventNameSessionState[] = "session-state"; 27 const char kValueEventNameSessionState[] = "session-state";
28 const char kValueEventNameHeartbeat[] = "heartbeat"; 28 const char kValueEventNameHeartbeat[] = "heartbeat";
29 const char kValueEventNameHostStatus[] = "host-status";
29 30
30 const char kKeyRole[] = "role"; 31 const char kKeyRole[] = "role";
31 const char kValueRoleHost[] = "host"; 32 const char kValueRoleHost[] = "host";
32 33
33 const char kKeyMode[] = "mode"; 34 const char kKeyMode[] = "mode";
34 const char kValueModeIt2Me[] = "it2me"; 35 const char kValueModeIt2Me[] = "it2me";
35 const char kValueModeMe2Me[] = "me2me"; 36 const char kValueModeMe2Me[] = "me2me";
36 37
37 const char kKeySessionState[] = "session-state"; 38 const char kKeySessionState[] = "session-state";
38 const char kValueSessionStateConnected[] = "connected"; 39 const char kValueSessionStateConnected[] = "connected";
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } 78 }
78 79
79 // static 80 // static
80 scoped_ptr<ServerLogEntry> ServerLogEntry::MakeForHeartbeat() { 81 scoped_ptr<ServerLogEntry> ServerLogEntry::MakeForHeartbeat() {
81 scoped_ptr<ServerLogEntry> entry(new ServerLogEntry()); 82 scoped_ptr<ServerLogEntry> entry(new ServerLogEntry());
82 entry->Set(kKeyRole, kValueRoleHost); 83 entry->Set(kKeyRole, kValueRoleHost);
83 entry->Set(kKeyEventName, kValueEventNameHeartbeat); 84 entry->Set(kKeyEventName, kValueEventNameHeartbeat);
84 return entry.Pass(); 85 return entry.Pass();
85 } 86 }
86 87
88 // static
89 scoped_ptr<ServerLogEntry> ServerLogEntry::MakeForHostStatus() {
90 scoped_ptr<ServerLogEntry> entry(new ServerLogEntry());
91 entry->Set(kKeyRole, kValueRoleHost);
92 entry->Set(kKeyEventName, kValueEventNameHostStatus);
93 return entry.Pass();
94 }
95
87 void ServerLogEntry::AddHostFields() { 96 void ServerLogEntry::AddHostFields() {
88 #if defined(OS_WIN) 97 #if defined(OS_WIN)
89 Set(kKeyOsName, kValueOsNameWindows); 98 Set(kKeyOsName, kValueOsNameWindows);
90 #elif defined(OS_MACOSX) 99 #elif defined(OS_MACOSX)
91 Set(kKeyOsName, kValueOsNameMac); 100 Set(kKeyOsName, kValueOsNameMac);
92 #elif defined(OS_CHROMEOS) 101 #elif defined(OS_CHROMEOS)
93 Set(kKeyOsName, kValueOsNameChromeOS); 102 Set(kKeyOsName, kValueOsNameChromeOS);
94 #elif defined(OS_LINUX) 103 #elif defined(OS_LINUX)
95 Set(kKeyOsName, kValueOsNameLinux); 104 Set(kKeyOsName, kValueOsNameLinux);
96 #endif 105 #endif
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // static 157 // static
149 const char* ServerLogEntry::GetValueSessionState(bool connected) { 158 const char* ServerLogEntry::GetValueSessionState(bool connected) {
150 return connected ? kValueSessionStateConnected : kValueSessionStateClosed; 159 return connected ? kValueSessionStateConnected : kValueSessionStateClosed;
151 } 160 }
152 161
153 void ServerLogEntry::Set(const std::string& key, const std::string& value) { 162 void ServerLogEntry::Set(const std::string& key, const std::string& value) {
154 values_map_[key] = value; 163 values_map_[key] = value;
155 } 164 }
156 165
157 } // namespace remoting 166 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698