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

Unified Diff: remoting/host/heartbeat_sender.cc

Issue 734053003: Reporting of policy errors via host-offline-reason: part 2b (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@hor-nohoststatussender
Patch Set: Switched to base::Unretained in mock_callback.h Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: remoting/host/heartbeat_sender.cc
diff --git a/remoting/host/heartbeat_sender.cc b/remoting/host/heartbeat_sender.cc
index 194e26048c21fbfd05f86ebd7d678dfefb6e0d95..0a73f7a57d98700879268dfa7f1aeecd81c42610 100644
--- a/remoting/host/heartbeat_sender.cc
+++ b/remoting/host/heartbeat_sender.cc
@@ -50,12 +50,14 @@ const int kMaxResendOnHostNotFoundCount = 12; // 2 minutes (12 x 10 seconds).
} // namespace
HeartbeatSender::HeartbeatSender(
- Listener* listener,
+ const base::Closure& on_heartbeat_successful_callback,
+ const base::Closure& on_unknown_host_id_error,
const std::string& host_id,
SignalStrategy* signal_strategy,
scoped_refptr<RsaKeyPair> key_pair,
const std::string& directory_bot_jid)
- : listener_(listener),
+ : on_heartbeat_successful_callback_(on_heartbeat_successful_callback),
+ on_unknown_host_id_error_(on_unknown_host_id_error),
host_id_(host_id),
signal_strategy_(signal_strategy),
key_pair_(key_pair),
@@ -167,7 +169,7 @@ void HeartbeatSender::ProcessResponse(
&HeartbeatSender::ResendStanza);
return;
}
- listener_->OnUnknownHostIdError();
+ on_unknown_host_id_error_.Run();
return;
}
}
@@ -222,7 +224,7 @@ void HeartbeatSender::ProcessResponse(
// Notify listener of the first successful heartbeat.
if (!heartbeat_succeeded_) {
- listener_->OnHeartbeatSuccessful();
+ on_heartbeat_successful_callback_.Run();
}
heartbeat_succeeded_ = true;

Powered by Google App Engine
This is Rietveld 408576698