summaryrefslogtreecommitdiffstats
path: root/jingle
diff options
context:
space:
mode:
authorrsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-26 02:39:42 +0000
committerrsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-26 02:39:42 +0000
commit14032692934ec919e52c419529f98c3a48e9cc3f (patch)
tree20426025ef88aa1c6d761775c62726b04a0d802c /jingle
parentb6e0e7e77c233573f8f87481d824ab18f62b76c6 (diff)
downloadchromium_src-14032692934ec919e52c419529f98c3a48e9cc3f.zip
chromium_src-14032692934ec919e52c419529f98c3a48e9cc3f.tar.gz
chromium_src-14032692934ec919e52c419529f98c3a48e9cc3f.tar.bz2
Revert 119171 - Maybe introduced a static initializer - or may be 119173
- replace custom <iq>-stanza protocol with push notifications (using PushNotifications* classes) in CacheInvalidationPacketHandler, and update unit test accordingly - extend notifier::Notification and PushNotificationsSendUpdateTask to allow specification of recipients (and recipient-specific data) Review URL: http://codereview.chromium.org/9190029 TBR=ghc@google.com Review URL: https://chromiumcodereview.appspot.com/9234053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119175 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'jingle')
-rw-r--r--jingle/notifier/base/fake_base_task.cc30
-rw-r--r--jingle/notifier/listener/notification_defines.cc5
-rw-r--r--jingle/notifier/listener/notification_defines.h17
-rw-r--r--jingle/notifier/listener/push_notifications_send_update_task.cc22
4 files changed, 6 insertions, 68 deletions
diff --git a/jingle/notifier/base/fake_base_task.cc b/jingle/notifier/base/fake_base_task.cc
index 5dda1d0..9dceec0 100644
--- a/jingle/notifier/base/fake_base_task.cc
+++ b/jingle/notifier/base/fake_base_task.cc
@@ -1,11 +1,9 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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.
-#include "base/compiler_specific.h"
#include "jingle/notifier/base/fake_base_task.h"
#include "jingle/notifier/base/weak_xmpp_client.h"
-#include "talk/xmpp/jid.h"
#include "talk/xmpp/asyncsocket.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -28,32 +26,10 @@ class MockAsyncSocket : public buzz::AsyncSocket {
MOCK_METHOD1(StartTls, bool(const std::string&));
};
-} // namespace notifier
-
-// Extends WeakXmppClient to make jid() return a full jid, as required by
-// PushNotificationsSubscribeTask.
-class FakeWeakXmppClient : public notifier::WeakXmppClient {
- public:
- explicit FakeWeakXmppClient(talk_base::TaskParent* parent)
- : notifier::WeakXmppClient(parent),
- jid_("test@example.com/testresource") {}
-
- virtual ~FakeWeakXmppClient() {}
-
- virtual const buzz::Jid& jid() const OVERRIDE {
- return jid_;
- }
-
- private:
- buzz::Jid jid_;
-};
-
-namespace notifier {
-
FakeBaseTask::FakeBaseTask() {
// Owned by |task_pump_|.
- FakeWeakXmppClient* weak_xmpp_client =
- new FakeWeakXmppClient(&task_pump_);
+ notifier::WeakXmppClient* weak_xmpp_client =
+ new notifier::WeakXmppClient(&task_pump_);
weak_xmpp_client->Start();
buzz::XmppClientSettings settings;
diff --git a/jingle/notifier/listener/notification_defines.cc b/jingle/notifier/listener/notification_defines.cc
index 6d2041e..61b099a 100644
--- a/jingle/notifier/listener/notification_defines.cc
+++ b/jingle/notifier/listener/notification_defines.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -6,9 +6,6 @@
namespace notifier {
-Notification::Notification() {}
-Notification::~Notification() {}
-
std::string Notification::ToString() const {
return "{ channel: \"" + channel + "\", data: \"" + data + "\" }";
}
diff --git a/jingle/notifier/listener/notification_defines.h b/jingle/notifier/listener/notification_defines.h
index f85288f..b17407f 100644
--- a/jingle/notifier/listener/notification_defines.h
+++ b/jingle/notifier/listener/notification_defines.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -21,24 +21,9 @@ struct Subscription {
typedef std::vector<Subscription> SubscriptionList;
-// A structure representing a <recipient/> block within a push message.
-struct Recipient {
- // The bare jid of the recipient.
- std::string to;
- // User-specific data for the recipient.
- std::string user_specific_data;
-};
-
-typedef std::vector<Recipient> RecipientList;
-
struct Notification {
- Notification();
- ~Notification();
-
// The channel the notification is coming in on.
std::string channel;
- // Recipients for this notification (may be empty).
- RecipientList recipients;
// The notification data payload.
std::string data;
diff --git a/jingle/notifier/listener/push_notifications_send_update_task.cc b/jingle/notifier/listener/push_notifications_send_update_task.cc
index d669a37..6412319 100644
--- a/jingle/notifier/listener/push_notifications_send_update_task.cc
+++ b/jingle/notifier/listener/push_notifications_send_update_task.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -44,12 +44,10 @@ buzz::XmlElement* PushNotificationsSendUpdateTask::MakeUpdateMessage(
const buzz::QName kQnPush(kPushNotificationsNamespace, "push");
const buzz::QName kQnChannel(buzz::STR_EMPTY, "channel");
const buzz::QName kQnData(kPushNotificationsNamespace, "data");
- const buzz::QName kQnRecipient(kPushNotificationsNamespace, "recipient");
// Create our update stanza. The message is constructed as:
// <message from='{full jid}' to='{bare jid}' type='headline'>
// <push xmlns='google:push' channel='{channel}'>
- // [<recipient to='{bare jid}'>{base-64 encoded data}</data>]*
// <data>{base-64 encoded data}</data>
// </push>
// </message>
@@ -62,24 +60,6 @@ buzz::XmlElement* PushNotificationsSendUpdateTask::MakeUpdateMessage(
push->AddAttr(kQnChannel, notification.channel);
message->AddElement(push);
- const RecipientList& recipients = notification.recipients;
- for (size_t i = 0; i < recipients.size(); ++i) {
- const Recipient& recipient = recipients[i];
- buzz::XmlElement* recipient_element =
- new buzz::XmlElement(kQnRecipient, true);
- push->AddElement(recipient_element);
- recipient_element->AddAttr(buzz::QN_TO, recipient.to);
- if (!recipient.user_specific_data.empty()) {
- std::string base64_data;
- if (!base::Base64Encode(recipient.user_specific_data, &base64_data)) {
- LOG(WARNING) << "Could not encode data "
- << recipient.user_specific_data;
- } else {
- recipient_element->SetBodyText(base64_data);
- }
- }
- }
-
buzz::XmlElement* data = new buzz::XmlElement(kQnData, true);
std::string base64_data;
if (!base::Base64Encode(notification.data, &base64_data)) {