| Index: remoting/signaling/push_notification_subscriber.h
|
| diff --git a/remoting/signaling/push_notification_subscriber.h b/remoting/signaling/push_notification_subscriber.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..19b8c09a0c1203e038b84e1d58d3bb7a6e998c5e
|
| --- /dev/null
|
| +++ b/remoting/signaling/push_notification_subscriber.h
|
| @@ -0,0 +1,58 @@
|
| +// 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 <vector>
|
| +
|
| +#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 push notifications using an XMPP
|
| +// channel. The notifications themselves are ignored, but creating a
|
| +// subscription is necessary, e.g., for GCD to see a device as online.
|
| +class PushNotificationSubscriber : public SignalStrategy::Listener {
|
| + public:
|
| + struct Subscription {
|
| + Subscription();
|
| + ~Subscription();
|
| +
|
| + std::string channel;
|
| + std::string from;
|
| + };
|
| +
|
| + typedef std::vector<Subscription> SubscriptionList;
|
| +
|
| + PushNotificationSubscriber(SignalStrategy* signal_strategy,
|
| + const SubscriptionList& subscriptions);
|
| + ~PushNotificationSubscriber() override;
|
| +
|
| + private:
|
| + // SignalStrategy::Listener interface.
|
| + void OnSignalStrategyStateChange(SignalStrategy::State state) override;
|
| + bool OnSignalStrategyIncomingStanza(const buzz::XmlElement* stanza) override;
|
| +
|
| + void Subscribe(const Subscription& subscription);
|
| + void OnSubscriptionResult(IqRequest* request,
|
| + const buzz::XmlElement* response);
|
| +
|
| + SignalStrategy* signal_strategy_;
|
| + SubscriptionList subscriptions_;
|
| + scoped_ptr<IqSender> iq_sender_;
|
| + scoped_ptr<IqRequest> iq_request_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(PushNotificationSubscriber);
|
| +};
|
| +
|
| +} // namespace remoting
|
| +
|
| +#endif // REMOTING_HOST_GCD_NOTIFICATION_SUBSCRIBER_H_
|
|
|