// Copyright 2024 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // GENERATED FROM THE API DEFINITION IN // chrome/common/extensions/api/context_menus.json // by tools/json_schema_compiler. // DO NOT EDIT. #ifndef CHROME_COMMON_EXTENSIONS_API_CONTEXT_MENUS_H__ #define CHROME_COMMON_EXTENSIONS_API_CONTEXT_MENUS_H__ #include <stdint.h> #include <map> #include <memory> #include <optional> #include <string> #include <vector> #include "base/values.h" #include <string_view> #include "chrome/common/extensions/api/tabs.h" namespace extensions { namespace api { namespace context_menus { // // Properties // // The maximum number of top level extension items that can be added to an // extension action context menu. Any items beyond this limit will be ignored. extern const int ACTION_MENU_TOP_LEVEL_LIMIT; // // Types // // The different contexts a menu can appear in. Specifying 'all' is equivalent // to the combination of all other contexts except for 'launcher'. The // 'launcher' context is only supported by apps and is used to add menu items to // the context menu that appears when clicking the app icon in the // launcher/taskbar/dock/etc. Different platforms might put limitations on what // is actually supported in a launcher context menu. enum class ContextType { … }; const char* ToString(ContextType as_enum); ContextType ParseContextType(std::string_view as_string); std::u16string GetContextTypeParseError(std::string_view as_string); // The type of menu item. enum class ItemType { … }; const char* ToString(ItemType as_enum); ItemType ParseItemType(std::string_view as_string); std::u16string GetItemTypeParseError(std::string_view as_string); // Information sent when a context menu item is clicked. struct OnClickData { … }; // Properties of the new context menu item. struct CreateProperties { … }; // // Functions // namespace Create { struct Params { … }; namespace Results { base::Value::List Create(); } // namespace Results } // namespace Create namespace Update { struct Params { … }; namespace Results { base::Value::List Create(); } // namespace Results } // namespace Update namespace Remove { struct Params { … }; namespace Results { base::Value::List Create(); } // namespace Results } // namespace Remove namespace RemoveAll { namespace Results { base::Value::List Create(); } // namespace Results } // namespace RemoveAll // // Events // namespace OnClicked { extern const char kEventName[]; // "contextMenus.onClicked" // Information about the item clicked and the context where the click happened. // The details of the tab where the click took place. If the click did not take // place in a tab, this parameter will be missing. base::Value::List Create(const OnClickData& info, const extensions::api::tabs::Tab& tab); } // namespace OnClicked } // namespace context_menus } // namespace api } // namespace extensions #endif // CHROME_COMMON_EXTENSIONS_API_CONTEXT_MENUS_H__