1 // Copyright 2019 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef COMPONENTS_DBUS_MENU_MENU_PROPERTY_LIST_H_
6 #define COMPONENTS_DBUS_MENU_MENU_PROPERTY_LIST_H_
7 
8 #include <map>
9 #include <string>
10 #include <vector>
11 
12 #include "components/dbus/properties/types.h"
13 
14 using MenuPropertyList = std::vector<std::string>;
15 using MenuItemProperties = std::map<std::string, DbusVariant>;
16 using MenuPropertyChanges = std::map<int32_t, MenuPropertyList>;
17 
18 namespace ui {
19 class MenuModel;
20 }
21 
22 // Computes properties for the menu item with index |i| in |menu|.
23 COMPONENT_EXPORT(DBUS)
24 MenuItemProperties ComputeMenuPropertiesForMenuItem(ui::MenuModel* menu, int i);
25 
26 // Given inputs |old_properties| and |new_properties|, computes outputs
27 // |item_updated_props| and |item_removed_props| suitable for use in
28 // com.canonical.dbusmenu.ItemsPropertiesUpdated.
29 COMPONENT_EXPORT(DBUS)
30 void ComputeMenuPropertyChanges(const MenuItemProperties& old_properties,
31                                 const MenuItemProperties& new_properties,
32                                 MenuPropertyList* item_updated_props,
33                                 MenuPropertyList* item_removed_props);
34 
35 #endif  // COMPONENTS_DBUS_MENU_MENU_PROPERTY_LIST_H_
36