1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef REMOTING_HOST_GCD_NOTIFICATION_SUBSCRIBER_H_
6 #define REMOTING_HOST_GCD_NOTIFICATION_SUBSCRIBER_H_
11 #include "base/basictypes.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "remoting/signaling/signal_strategy.h"
20 // An object that subscribes to push notifications using an XMPP
21 // channel. The notifications themselves are ignored, but creating a
22 // subscription is necessary, e.g., for GCD to see a device as online.
23 class PushNotificationSubscriber
: public SignalStrategy::Listener
{
33 typedef std::vector
<Subscription
> SubscriptionList
;
35 PushNotificationSubscriber(SignalStrategy
* signal_strategy
,
36 const SubscriptionList
& subscriptions
);
37 ~PushNotificationSubscriber() override
;
40 // SignalStrategy::Listener interface.
41 void OnSignalStrategyStateChange(SignalStrategy::State state
) override
;
42 bool OnSignalStrategyIncomingStanza(const buzz::XmlElement
* stanza
) override
;
44 void Subscribe(const Subscription
& subscription
);
45 void OnSubscriptionResult(IqRequest
* request
,
46 const buzz::XmlElement
* response
);
48 SignalStrategy
* signal_strategy_
;
49 SubscriptionList subscriptions_
;
50 scoped_ptr
<IqSender
> iq_sender_
;
51 scoped_ptr
<IqRequest
> iq_request_
;
53 DISALLOW_COPY_AND_ASSIGN(PushNotificationSubscriber
);
56 } // namespace remoting
58 #endif // REMOTING_HOST_GCD_NOTIFICATION_SUBSCRIBER_H_