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

Side by Side Diff: remoting/signaling/push_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: sync to head 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 unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #ifndef REMOTING_HOST_GCD_NOTIFICATION_SUBSCRIBER_H_
6 #define REMOTING_HOST_GCD_NOTIFICATION_SUBSCRIBER_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/basictypes.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "remoting/signaling/signal_strategy.h"
14
15 namespace remoting {
16
17 class IqSender;
18 class IqRequest;
19
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 {
24 public:
25 struct Subscription {
26 Subscription();
27 ~Subscription();
28
29 std::string channel;
30 std::string from;
31 };
32
33 typedef std::vector<Subscription> SubscriptionList;
34
35 PushNotificationSubscriber(SignalStrategy* signal_strategy,
36 const SubscriptionList& subscriptions);
37 ~PushNotificationSubscriber() override;
38
39 private:
40 // SignalStrategy::Listener interface.
41 void OnSignalStrategyStateChange(SignalStrategy::State state) override;
42 bool OnSignalStrategyIncomingStanza(const buzz::XmlElement* stanza) override;
43
44 void Subscribe(const Subscription& subscription);
45 void OnSubscriptionResult(IqRequest* request,
46 const buzz::XmlElement* response);
47
48 SignalStrategy* signal_strategy_;
49 SubscriptionList subscriptions_;
50 scoped_ptr<IqSender> iq_sender_;
51 scoped_ptr<IqRequest> iq_request_;
52
53 DISALLOW_COPY_AND_ASSIGN(PushNotificationSubscriber);
54 };
55
56 } // namespace remoting
57
58 #endif // REMOTING_HOST_GCD_NOTIFICATION_SUBSCRIBER_H_
OLDNEW
« no previous file with comments | « remoting/signaling/jid_util_unittest.cc ('k') | remoting/signaling/push_notification_subscriber.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698