-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Define what to do for application menus #21
Comments
1. DESIGN DOCUMENT: DYNAMICALLY ADDING CUSTOM COMMANDS TO THE APPLICATION MENU IN CHROMIUM1.1. SUMMARYThis document describes how to dynamically add custom commands to the application menu in Chromium. It covers the files and classes that we would need to modify, the placement of menus and commands, and how we would allow adding new entries to the menu at runtime. 1.2. FILES AND CLASSES TO MODIFYThe main files and classes we need to modify are:
The reason you need to modify In Chromium, Therefore, if you want to change what happens when a menu item is selected, you need to modify On the other hand, if you only want to change the items that appear in the menu, but not what happens when they are selected, then you would only need to modify 1.3. DYNAMICALLY ADDING NEW ENTRIES TO THE MENUTo dynamically add new entries to the application menu, we need to modify the void AppMenuModel::Build() {
// ... existing code to build the menu ...
// Add custom entries to the menu.
for (const auto& command : custom_commands_) {
AddItem(command.id, l10n_util::GetStringUTF16(command.string_id));
}
// ... more code to build the rest of the menu ...
} In this example, 1.3.1. WHAT IS THE STRUCTURE OF
|
Decide whether to delegate to the application or provide an API
Tip
Create design document: It would be beneficial for you to create a design document before starting to write code, specifying what and where we would make changes. This includes the classes to be modified, the placement of menus/commands and their execution, as well as how we would allow adding new things there.
The contextual menu modified by @agustinschilling is similar; it has identifiers for static commands, but it also has configurable dynamic command identifiers. I recall that the documentation says something like there is a range of identifiers that the user can use, and below that range are the standard Chrome ones. The identifiers shown here
are the ones we should use.
The text was updated successfully, but these errors were encountered: