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

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

Issue 282063005: Pull out common code from client and host versions of ServerLogEntry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move ServerLogEntry to jingle_glue Created 6 years, 7 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 | « remoting/host/heartbeat_sender.cc ('k') | remoting/host/it2me/it2me_host.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/host_status_sender.h" 5 #include "remoting/host/host_status_sender.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/stringize_macros.h" 8 #include "base/strings/stringize_macros.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "remoting/base/constants.h" 10 #include "remoting/base/constants.h"
11 #include "remoting/base/logging.h" 11 #include "remoting/base/logging.h"
12 #include "remoting/host/server_log_entry.h" 12 #include "remoting/host/server_log_entry_host.h"
13 #include "remoting/jingle_glue/iq_sender.h" 13 #include "remoting/jingle_glue/iq_sender.h"
14 #include "remoting/jingle_glue/server_log_entry.h"
14 #include "remoting/jingle_glue/signal_strategy.h" 15 #include "remoting/jingle_glue/signal_strategy.h"
15 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" 16 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h"
16 #include "third_party/libjingle/source/talk/xmpp/constants.h" 17 #include "third_party/libjingle/source/talk/xmpp/constants.h"
17 18
18 using buzz::QName; 19 using buzz::QName;
19 using buzz::XmlElement; 20 using buzz::XmlElement;
20 21
21 namespace remoting { 22 namespace remoting {
22 23
23 namespace { 24 namespace {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 117
117 // Append host version. 118 // Append host version.
118 scoped_ptr<XmlElement> version_tag(new XmlElement( 119 scoped_ptr<XmlElement> version_tag(new XmlElement(
119 QName(kChromotingXmlNamespace, kHostVersionTag))); 120 QName(kChromotingXmlNamespace, kHostVersionTag)));
120 version_tag->AddText(STRINGIZE(VERSION)); 121 version_tag->AddText(STRINGIZE(VERSION));
121 host_status->AddElement(version_tag.release()); 122 host_status->AddElement(version_tag.release());
122 123
123 // Append log message (which isn't signed). 124 // Append log message (which isn't signed).
124 scoped_ptr<XmlElement> log(ServerLogEntry::MakeStanza()); 125 scoped_ptr<XmlElement> log(ServerLogEntry::MakeStanza());
125 scoped_ptr<ServerLogEntry> log_entry( 126 scoped_ptr<ServerLogEntry> log_entry(
126 ServerLogEntry::MakeForHostStatus(status, exit_code)); 127 MakeLogEntryForHostStatus(status, exit_code));
127 log_entry->AddHostFields(); 128 AddHostFieldsToLogEntry(log_entry.get());
128 log->AddElement(log_entry->ToStanza().release()); 129 log->AddElement(log_entry->ToStanza().release());
129 host_status->AddElement(log.release()); 130 host_status->AddElement(log.release());
130 return host_status.Pass(); 131 return host_status.Pass();
131 } 132 }
132 133
133 scoped_ptr<XmlElement> HostStatusSender::CreateSignature( 134 scoped_ptr<XmlElement> HostStatusSender::CreateSignature(
134 HostStatus status, HostExitCodes exit_code) { 135 HostStatus status, HostExitCodes exit_code) {
135 scoped_ptr<XmlElement> signature_tag(new XmlElement( 136 scoped_ptr<XmlElement> signature_tag(new XmlElement(
136 QName(kChromotingXmlNamespace, kSignatureTag))); 137 QName(kChromotingXmlNamespace, kSignatureTag)));
137 138
(...skipping 15 matching lines...) Expand all
153 if (status == OFFLINE) 154 if (status == OFFLINE)
154 message += std::string(" ") + ExitCodeToString(exit_code); 155 message += std::string(" ") + ExitCodeToString(exit_code);
155 156
156 std::string signature(key_pair_->SignMessage(message)); 157 std::string signature(key_pair_->SignMessage(message));
157 signature_tag->AddText(signature); 158 signature_tag->AddText(signature);
158 159
159 return signature_tag.Pass(); 160 return signature_tag.Pass();
160 } 161 }
161 162
162 } // namespace remoting 163 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/heartbeat_sender.cc ('k') | remoting/host/it2me/it2me_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698