privetd: Implement /privet/v3/commandDefs
Buffet exposes D-Bus property CommandDefs.
Privetd reads commands from buffet using D-Bus in CloudDelegate.
Buffet will update property if definitions changed. Still there is no Buffet
codepath which changes commad definitions after loading.
BUG=brillo:426
TEST=unittest
Change-Id: I18dac0f87325257fa31c0fe3e0c883a9ed40e4c7
Reviewed-on: https://chromium-review.googlesource.com/261611
Reviewed-by: Vitaly Buka <vitalybuka@chromium.org>
Commit-Queue: Vitaly Buka <vitalybuka@chromium.org>
Tested-by: Vitaly Buka <vitalybuka@chromium.org>
diff --git a/buffet/commands/command_manager.cc b/buffet/commands/command_manager.cc
index 78e0dee..afdd518 100644
--- a/buffet/commands/command_manager.cc
+++ b/buffet/commands/command_manager.cc
@@ -47,7 +47,11 @@
bool CommandManager::LoadCommands(const base::DictionaryValue& json,
const std::string& category,
chromeos::ErrorPtr* error) {
- return dictionary_.LoadCommands(json, category, &base_dictionary_, error);
+ bool result =
+ dictionary_.LoadCommands(json, category, &base_dictionary_, error);
+ if (!on_command_defs_changed_.is_null())
+ on_command_defs_changed_.Run();
+ return result;
}
bool CommandManager::LoadCommands(const base::FilePath& json_file_path,