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

Unified Diff: remoting/signaling/gcd_notification_subscriber.h

Issue 1123153002: Added class to subscribe to GCD notifications over XMPP. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@host-xmpp-connect2a
Patch Set: revised unit test Created 5 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 side-by-side diff with in-line comments
Download patch
Index: remoting/signaling/gcd_notification_subscriber.h
diff --git a/remoting/signaling/gcd_notification_subscriber.h b/remoting/signaling/gcd_notification_subscriber.h
new file mode 100644
index 0000000000000000000000000000000000000000..f84a402d0a344d7ba6b5f97a3364bc222acc1c06
--- /dev/null
+++ b/remoting/signaling/gcd_notification_subscriber.h
@@ -0,0 +1,44 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef REMOTING_HOST_GCD_NOTIFICATION_SUBSCRIBER_H_
+#define REMOTING_HOST_GCD_NOTIFICATION_SUBSCRIBER_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
+#include "remoting/signaling/signal_strategy.h"
+
+namespace remoting {
+
+class IqSender;
+class IqRequest;
+
+// An object that subscribes to notifications from GCD using an XMPP
+// channel. No actual notifications are used, but the subscription is
+// necessary in order for GCD to consider a device online.
+class GcdNotificationSubscriber : public SignalStrategy::Listener {
+ public:
+ GcdNotificationSubscriber(SignalStrategy* signal_strategy);
+ ~GcdNotificationSubscriber() override;
+
+ private:
+ // SignalStrategy::Listener interface.
+ void OnSignalStrategyStateChange(SignalStrategy::State state) override;
+ bool OnSignalStrategyIncomingStanza(const buzz::XmlElement* stanza) override;
+
+ void OnSubscriptionResult(IqRequest* request,
+ const buzz::XmlElement* response);
+
+ SignalStrategy* signal_strategy_;
+ scoped_ptr<IqSender> iq_sender_;
+ scoped_ptr<IqRequest> iq_request_;
+
+ DISALLOW_COPY_AND_ASSIGN(GcdNotificationSubscriber);
+};
+
+} // namespace remoting
+
+#endif // REMOTING_HOST_GCD_NOTIFICATION_SUBSCRIBER_H_

Powered by Google App Engine
This is Rietveld 408576698