buffet: Add command_def filtering by command visibility
When updating cloud or local client with the device's CDD make sure
to send only the command definitions that are available to particular
client (local vs cloud).
Also made it possible to subscribe to command definition change notifications
for more than one listener (using base::CallbackList) so that both the local
and cloud adapters can notify the respective clients about command visibility
changes (the actual API to change the command visibility is coming in a
follow-up CL).
BUG=brillo:797
TEST=`FEATURES=test emerge-link buffet`
Change-Id: I6bec36633ababcb534012abad2c37a3502d8faf4
Reviewed-on: https://chromium-review.googlesource.com/266209
Reviewed-by: Vitaly Buka <vitalybuka@chromium.org>
Trybot-Ready: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Vitaly Buka <vitalybuka@chromium.org>
diff --git a/buffet/manager.h b/buffet/manager.h
index 177d3d1..a00ba20 100644
--- a/buffet/manager.h
+++ b/buffet/manager.h
@@ -18,6 +18,7 @@
#include <chromeos/dbus/exported_property_set.h>
#include <chromeos/errors/error.h>
+#include "buffet/commands/command_manager.h"
#include "buffet/device_registration_info.h"
#include "buffet/org.chromium.Buffet.Manager.h"
@@ -29,7 +30,6 @@
namespace buffet {
-class CommandManager;
class StateChangeQueue;
class StateManager;
class BuffetConfig;
@@ -84,6 +84,10 @@
std::shared_ptr<StateManager> state_manager_;
std::unique_ptr<DeviceRegistrationInfo> device_info_;
+ // Token given by Command Manager to track the registered Command Definition
+ // change callback.
+ CommandManager::CallbackToken command_changed_callback_token_;
+
DISALLOW_COPY_AND_ASSIGN(Manager);
};