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

Unified Diff: remoting/host/heartbeat_sender.h

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: Rebasing... 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
« no previous file with comments | « no previous file | remoting/host/heartbeat_sender.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/heartbeat_sender.h
diff --git a/remoting/host/heartbeat_sender.h b/remoting/host/heartbeat_sender.h
index 37090a9d096a9b8e5e20b5dd9c992dc5303b9bbd..73080be9a6d3683cf1cb3c2869214f3477206fe9 100644
--- a/remoting/host/heartbeat_sender.h
+++ b/remoting/host/heartbeat_sender.h
@@ -7,6 +7,7 @@
#include <string>
+#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/gtest_prod_util.h"
#include "base/memory/ref_counted.h"
@@ -87,21 +88,11 @@ class IqSender;
// </iq>
class HeartbeatSender : public SignalStrategy::Listener {
public:
- class Listener {
- public:
- virtual ~Listener() { }
-
- // Invoked after the first successful heartbeat.
- virtual void OnHeartbeatSuccessful() = 0;
-
- // Invoked when the host ID is permanently not recognized by the server.
- virtual void OnUnknownHostIdError() = 0;
- };
-
// |signal_strategy| and |delegate| must outlive this
// object. Heartbeats will start when the supplied SignalStrategy
// enters the CONNECTED state.
- HeartbeatSender(Listener* listener,
+ HeartbeatSender(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,
@@ -145,7 +136,8 @@ class HeartbeatSender : public SignalStrategy::Listener {
scoped_ptr<buzz::XmlElement> CreateHeartbeatMessage();
scoped_ptr<buzz::XmlElement> CreateSignature();
- Listener* listener_;
+ base::Closure on_heartbeat_successful_callback_;
+ base::Closure on_unknown_host_id_error_;
std::string host_id_;
SignalStrategy* signal_strategy_;
scoped_refptr<RsaKeyPair> key_pair_;
@@ -162,14 +154,6 @@ class HeartbeatSender : public SignalStrategy::Listener {
int failed_startup_heartbeat_count_;
std::string host_offline_reason_;
base::Closure host_offline_reason_ack_callback_;
- // TODO(lukasza): Consistent usage of listener-vs-callback. This is
- // inconsistent today, because 1) host-offline-reason changes really
- // needed to use callbacks (for ability to wrap them in
- // CancellableCallback and for ability to hold a ref-count to
- // MinimumHeartbeatSupporter throughout the lifetime of a callback)
- // and 2) refactoring for consistently using callbacks everywhere
- // spans multiple files and would obscure the core changes for
- // host-offline-reason code.
base::ThreadChecker thread_checker_;
« no previous file with comments | « no previous file | remoting/host/heartbeat_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698