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

Side by Side Diff: remoting/host/log_to_server.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/log_to_server.h ('k') | remoting/host/server_log_entry.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 (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/log_to_server.h" 5 #include "remoting/host/log_to_server.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop_proxy.h" 8 #include "base/message_loop/message_loop_proxy.h"
9 #include "remoting/base/constants.h" 9 #include "remoting/base/constants.h"
10 #include "remoting/host/host_status_monitor.h" 10 #include "remoting/host/host_status_monitor.h"
11 #include "remoting/host/server_log_entry.h" 11 #include "remoting/host/server_log_entry_host.h"
12 #include "remoting/jingle_glue/iq_sender.h" 12 #include "remoting/jingle_glue/iq_sender.h"
13 #include "remoting/jingle_glue/server_log_entry.h"
13 #include "remoting/jingle_glue/signal_strategy.h" 14 #include "remoting/jingle_glue/signal_strategy.h"
14 #include "remoting/protocol/transport.h" 15 #include "remoting/protocol/transport.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
(...skipping 13 matching lines...) Expand all
36 signal_strategy_->RemoveListener(this); 37 signal_strategy_->RemoveListener(this);
37 if (monitor_.get()) 38 if (monitor_.get())
38 monitor_->RemoveStatusObserver(this); 39 monitor_->RemoveStatusObserver(this);
39 } 40 }
40 41
41 void LogToServer::LogSessionStateChange(const std::string& jid, 42 void LogToServer::LogSessionStateChange(const std::string& jid,
42 bool connected) { 43 bool connected) {
43 DCHECK(CalledOnValidThread()); 44 DCHECK(CalledOnValidThread());
44 45
45 scoped_ptr<ServerLogEntry> entry( 46 scoped_ptr<ServerLogEntry> entry(
46 ServerLogEntry::MakeForSessionStateChange(connected)); 47 MakeLogEntryForSessionStateChange(connected));
47 entry->AddHostFields(); 48 AddHostFieldsToLogEntry(entry.get());
48 entry->AddModeField(mode_); 49 entry->AddModeField(mode_);
49 50
50 if (connected) { 51 if (connected) {
51 DCHECK(connection_route_type_.count(jid) == 1); 52 DCHECK(connection_route_type_.count(jid) == 1);
52 entry->AddConnectionTypeField(connection_route_type_[jid]); 53 AddConnectionTypeToLogEntry(entry.get(), connection_route_type_[jid]);
53 } 54 }
54 Log(*entry.get()); 55 Log(*entry.get());
55 } 56 }
56 57
57 void LogToServer::OnSignalStrategyStateChange(SignalStrategy::State state) { 58 void LogToServer::OnSignalStrategyStateChange(SignalStrategy::State state) {
58 DCHECK(CalledOnValidThread()); 59 DCHECK(CalledOnValidThread());
59 60
60 if (state == SignalStrategy::CONNECTED) { 61 if (state == SignalStrategy::CONNECTED) {
61 iq_sender_.reset(new IqSender(signal_strategy_)); 62 iq_sender_.reset(new IqSender(signal_strategy_));
62 SendPendingEntries(); 63 SendPendingEntries();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 } 113 }
113 // Send the stanza to the server. 114 // Send the stanza to the server.
114 scoped_ptr<IqRequest> req = iq_sender_->SendIq( 115 scoped_ptr<IqRequest> req = iq_sender_->SendIq(
115 buzz::STR_SET, directory_bot_jid_, stanza.Pass(), 116 buzz::STR_SET, directory_bot_jid_, stanza.Pass(),
116 IqSender::ReplyCallback()); 117 IqSender::ReplyCallback());
117 // We ignore any response, so let the IqRequest be destroyed. 118 // We ignore any response, so let the IqRequest be destroyed.
118 return; 119 return;
119 } 120 }
120 121
121 } // namespace remoting 122 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/log_to_server.h ('k') | remoting/host/server_log_entry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698