#include "components/dbus/menu/menu.h"
#include <limits>
#include <memory>
#include <set>
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/i18n/rtl.h"
#include "base/memory/ref_counted_memory.h"
#include "base/memory/scoped_refptr.h"
#include "base/strings/utf_string_conversions.h"
#include "components/dbus/properties/dbus_properties.h"
#include "components/dbus/properties/success_barrier_callback.h"
#include "ui/base/accelerators/accelerator.h"
#include "ui/base/models/menu_model.h"
#include "ui/base/models/simple_menu_model.h"
namespace {
const char kInterfaceDbusMenu[] = …;
const char kMethodAboutToShow[] = …;
const char kMethodAboutToShowGroup[] = …;
const char kMethodEvent[] = …;
const char kMethodEventGroup[] = …;
const char kMethodGetGroupProperties[] = …;
const char kMethodGetLayout[] = …;
const char kMethodGetProperty[] = …;
const char kPropertyIconThemePath[] = …;
const char kPropertyMenuStatus[] = …;
const char kPropertyTextDirection[] = …;
const char kPropertyVersion[] = …;
const char kPropertyValueStatusNormal[] = …;
uint32_t kPropertyValueVersion = …;
const char kSignalItemsPropertiesUpdated[] = …;
const char kSignalLayoutUpdated[] = …;
DbusVariant CreateDefaultPropertyValue(const std::string& property_name) { … }
DbusString DbusTextDirection() { … }
void WriteRemovedProperties(dbus::MessageWriter* writer,
const MenuPropertyChanges& removed_props) { … }
}
DbusMenu::MenuItem::MenuItem(int32_t id,
std::map<std::string, DbusVariant>&& properties,
std::vector<int32_t>&& children,
ui::MenuModel* menu,
ui::MenuModel* containing_menu,
size_t containing_menu_index)
: … { … }
DbusMenu::MenuItem::~MenuItem() = default;
DbusMenu::ScopedMethodResponse::ScopedMethodResponse(
dbus::MethodCall* method_call,
dbus::ExportedObject::ResponseSender response_sender)
: … { … }
DbusMenu::ScopedMethodResponse::~ScopedMethodResponse() { … }
dbus::MessageWriter& DbusMenu::ScopedMethodResponse::Writer() { … }
void DbusMenu::ScopedMethodResponse::EnsureResponse() { … }
DbusMenu::DbusMenu(dbus::ExportedObject* exported_object,
InitializedCallback callback)
: … { … }
DbusMenu::~DbusMenu() = default;
void DbusMenu::SetModel(ui::MenuModel* model, bool send_signal) { … }
void DbusMenu::MenuLayoutUpdated(ui::MenuModel* model) { … }
void DbusMenu::MenuItemsPropertiesUpdated(
const std::vector<MenuItemReference>& menu_items) { … }
dbus::ExportedObject::MethodCallCallback DbusMenu::WrapMethodCallback(
base::RepeatingCallback<void(ScopedMethodResponse*)> callback) { … }
void DbusMenu::OnExported(const std::string& interface_name,
const std::string& method_name,
bool success) { … }
void DbusMenu::OnAboutToShow(ScopedMethodResponse* response) { … }
void DbusMenu::OnAboutToShowGroup(ScopedMethodResponse* response) { … }
void DbusMenu::OnEvent(ScopedMethodResponse* response) { … }
void DbusMenu::OnEventGroup(ScopedMethodResponse* response) { … }
void DbusMenu::OnGetGroupProperties(ScopedMethodResponse* response) { … }
void DbusMenu::OnGetLayout(ScopedMethodResponse* response) { … }
void DbusMenu::OnGetProperty(ScopedMethodResponse* response) { … }
bool DbusMenu::AboutToShowImpl(int32_t id) { … }
bool DbusMenu::EventImpl(dbus::MessageReader* reader, int32_t* id_error) { … }
std::vector<int32_t> DbusMenu::ConvertMenu(ui::MenuModel* menu) { … }
int32_t DbusMenu::NextItemId() { … }
void DbusMenu::WriteMenuItem(const MenuItem* item,
dbus::MessageWriter* writer,
int32_t depth,
const MenuPropertyList& property_filter) const { … }
void DbusMenu::WriteUpdatedProperties(
dbus::MessageWriter* writer,
const MenuPropertyChanges& updated_props) const { … }
DbusMenu::MenuItem* DbusMenu::FindMenuItemForModel(const ui::MenuModel* model,
MenuItem* item) const { … }
void DbusMenu::DeleteItem(MenuItem* item) { … }
void DbusMenu::DeleteItemChildren(MenuItem* item) { … }
void DbusMenu::SendLayoutChangedSignal(int32_t id) { … }