buffet: Hook up XMPP to deliver push notifications to buffet
Now using XMPP not only for the device presence but for delivering
push notifications, specifically COMMAND_CREATED notification and
extracting the command instance from the notification message.
Add the commands received over XMPP to the command execution queue.
The remaining tasks for XMPP (making polling optional, provide
notification channel configuration options for buffet, update the
channel changes on GCD server, etc) are coming in follow-up CLs.
BUG=brillo:458
TEST=`FEATURES=test emerge-link buffet`
Tested this on the device.
Change-Id: I6ba42e3687563133734aaf36d3802d6f4888f348
Reviewed-on: https://chromium-review.googlesource.com/272782
Trybot-Ready: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Vitaly Buka <vitalybuka@chromium.org>
Commit-Queue: Vitaly Buka <vitalybuka@chromium.org>
diff --git a/buffet/notification/notification_delegate.h b/buffet/notification/notification_delegate.h
index 06b30d4..b2d7184 100644
--- a/buffet/notification/notification_delegate.h
+++ b/buffet/notification/notification_delegate.h
@@ -5,8 +5,11 @@
#ifndef BUFFET_NOTIFICATION_NOTIFICATION_DELEGATE_H_
#define BUFFET_NOTIFICATION_NOTIFICATION_DELEGATE_H_
+#include <memory>
#include <string>
+#include <base/values.h>
+
namespace buffet {
class NotificationDelegate {
@@ -14,6 +17,8 @@
virtual void OnConnected(const std::string& channel_name) = 0;
virtual void OnDisconnected() = 0;
virtual void OnPermanentFailure() = 0;
+ // Called when a new command is sent via the notification channel.
+ virtual void OnCommandCreated(const base::DictionaryValue& command) = 0;
protected:
virtual ~NotificationDelegate() = default;