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

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

Issue 9005034: Refactor SignalStrategy so that it can be reused for multiple connections. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 8 years, 11 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.h ('k') | remoting/host/heartbeat_sender_unittest.cc » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/heartbeat_sender.h" 5 #include "remoting/host/heartbeat_sender.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop_proxy.h" 9 #include "base/message_loop_proxy.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 if (!key_pair_.Load(config_)) { 59 if (!key_pair_.Load(config_)) {
60 return false; 60 return false;
61 } 61 }
62 62
63 state_ = INITIALIZED; 63 state_ = INITIALIZED;
64 64
65 return true; 65 return true;
66 } 66 }
67 67
68 void HeartbeatSender::OnSignallingConnected(SignalStrategy* signal_strategy, 68 void HeartbeatSender::OnSignallingConnected(SignalStrategy* signal_strategy) {
69 const std::string& full_jid) {
70 DCHECK(message_loop_->BelongsToCurrentThread()); 69 DCHECK(message_loop_->BelongsToCurrentThread());
71 DCHECK(state_ == INITIALIZED || state_ == STOPPED); 70 DCHECK(state_ == INITIALIZED || state_ == STOPPED);
72 state_ = STARTED; 71 state_ = STARTED;
73 72
74 full_jid_ = full_jid; 73 full_jid_ = signal_strategy->GetLocalJid();
75 74
76 iq_sender_.reset(new IqSender(signal_strategy)); 75 iq_sender_.reset(new IqSender(signal_strategy));
77 76
78 DoSendStanza(); 77 DoSendStanza();
79 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(interval_ms_), this, 78 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(interval_ms_), this,
80 &HeartbeatSender::DoSendStanza); 79 &HeartbeatSender::DoSendStanza);
81 } 80 }
82 81
83 void HeartbeatSender::OnSignallingDisconnected() { 82 void HeartbeatSender::OnSignallingDisconnected() {
84 DCHECK(message_loop_->BelongsToCurrentThread()); 83 DCHECK(message_loop_->BelongsToCurrentThread());
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 QName(kChromotingXmlNamespace, kSignatureTimeAttr), time_str); 168 QName(kChromotingXmlNamespace, kSignatureTimeAttr), time_str);
170 169
171 std::string message = full_jid_ + ' ' + time_str; 170 std::string message = full_jid_ + ' ' + time_str;
172 std::string signature(key_pair_.GetSignature(message)); 171 std::string signature(key_pair_.GetSignature(message));
173 signature_tag->AddText(signature); 172 signature_tag->AddText(signature);
174 173
175 return signature_tag; 174 return signature_tag;
176 } 175 }
177 176
178 } // namespace remoting 177 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/heartbeat_sender.h ('k') | remoting/host/heartbeat_sender_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698