buffet: Add the ability to change command visibility
Now it is possible to change the visibility of command and make it
visible to cloud only, local only, both or none.
BUG=brillo:797
TEST=`FEATURES=test emerge-link buffet`
Change-Id: I81d526b3d43adf5d6cd03a4e31a31e1494ff5c1b
Reviewed-on: https://chromium-review.googlesource.com/266396
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/commands/command_manager.h b/buffet/commands/command_manager.h
index 3e23cbf..072d055 100644
--- a/buffet/commands/command_manager.h
+++ b/buffet/commands/command_manager.h
@@ -7,6 +7,7 @@
#include <memory>
#include <string>
+#include <vector>
#include <base/callback.h>
#include <base/callback_list.h>
@@ -49,7 +50,8 @@
explicit CommandManager(CommandDispachInterface* dispatch_interface);
// Sets callback which is called when command definitions is changed.
- CallbackToken AddOnCommandDefChanged(const base::Closure& callback) {
+ CallbackToken AddOnCommandDefChanged(
+ const base::Closure& callback) WARN_UNUSED_RESULT {
return CallbackToken{on_command_changed_.Add(callback).release()};
}
@@ -102,6 +104,11 @@
// for a long period of time.
CommandInstance* FindCommand(const std::string& id) const;
+ // Changes the visibility of commands.
+ bool SetCommandVisibility(const std::vector<std::string>& command_names,
+ CommandDefinition::Visibility visibility,
+ chromeos::ErrorPtr* error);
+
private:
CommandDictionary base_dictionary_; // Base/std command definitions/schemas.
CommandDictionary dictionary_; // Command definitions/schemas.