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

Side by Side Diff: remoting/signaling/push_notification_subscriber.cc

Issue 1864213002: Convert //remoting to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac IWYU Created 4 years, 8 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/signaling/push_notification_subscriber.h" 5 #include "remoting/signaling/push_notification_subscriber.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/ptr_util.h"
9 #include "remoting/base/logging.h" 10 #include "remoting/base/logging.h"
10 #include "remoting/signaling/iq_sender.h" 11 #include "remoting/signaling/iq_sender.h"
11 #include "remoting/signaling/jid_util.h" 12 #include "remoting/signaling/jid_util.h"
12 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" 13 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h"
13 14
14 namespace remoting { 15 namespace remoting {
15 16
16 namespace { 17 namespace {
17 18
18 const char kGooglePushNamespace[] = "google:push"; 19 const char kGooglePushNamespace[] = "google:push";
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 buzz::XmlElement* item_element = 66 buzz::XmlElement* item_element =
66 new buzz::XmlElement(buzz::QName(kGooglePushNamespace, "item")); 67 new buzz::XmlElement(buzz::QName(kGooglePushNamespace, "item"));
67 subscribe_element->AddElement(item_element); 68 subscribe_element->AddElement(item_element);
68 item_element->SetAttr(buzz::QName(std::string(), "channel"), 69 item_element->SetAttr(buzz::QName(std::string(), "channel"),
69 subscription.channel); 70 subscription.channel);
70 item_element->SetAttr(buzz::QName(std::string(), "from"), subscription.from); 71 item_element->SetAttr(buzz::QName(std::string(), "from"), subscription.from);
71 72
72 // Send the request. 73 // Send the request.
73 iq_sender_.reset(new IqSender(signal_strategy_)); 74 iq_sender_.reset(new IqSender(signal_strategy_));
74 iq_request_ = iq_sender_->SendIq( 75 iq_request_ = iq_sender_->SendIq(
75 "set", bare_jid, make_scoped_ptr(subscribe_element), 76 "set", bare_jid, base::WrapUnique(subscribe_element),
76 base::Bind(&PushNotificationSubscriber::OnSubscriptionResult, 77 base::Bind(&PushNotificationSubscriber::OnSubscriptionResult,
77 base::Unretained(this))); 78 base::Unretained(this)));
78 } 79 }
79 80
80 void PushNotificationSubscriber::OnSubscriptionResult( 81 void PushNotificationSubscriber::OnSubscriptionResult(
81 IqRequest* request, 82 IqRequest* request,
82 const buzz::XmlElement* response) { 83 const buzz::XmlElement* response) {
83 std::string response_type = 84 std::string response_type =
84 response->Attr(buzz::QName(std::string(), "type")); 85 response->Attr(buzz::QName(std::string(), "type"));
85 if (response_type != "result") { 86 if (response_type != "result") {
86 LOG(ERROR) << "Invalid response type for subscription: " << response_type; 87 LOG(ERROR) << "Invalid response type for subscription: " << response_type;
87 } 88 }
88 89
89 // The IqSender and IqRequest are no longer needed after receiving a 90 // The IqSender and IqRequest are no longer needed after receiving a
90 // reply to the subscription request. 91 // reply to the subscription request.
91 iq_request_.reset(); 92 iq_request_.reset();
92 iq_sender_.reset(); 93 iq_sender_.reset();
93 } 94 }
94 95
95 } // namespace remoting 96 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/signaling/push_notification_subscriber.h ('k') | remoting/signaling/server_log_entry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698