mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add initial support for API versioning (see #3836)
- Generated files are now created when running cef_create_projects or the new version_manager.py tool. These files are still created in the cef/ source tree (same location as before) but Git ignores them due to the generated .gitignore file. - API hashes are committed to Git as a new cef_api_versions.json file. This file is used for both code generation and CEF version calculation (replacing the previous usage of cef_api_hash.h for this purpose). It will be updated by the CEF admin before merging breaking API changes upstream. - As an added benefit to the above, contributor PRs will no longer contain generated code that is susceptible to frequent merge conflicts. - From a code generation perspective, the main difference is that we now use versioned structs (e.g. cef_browser_0_t instead of cef_browser_t) on the libcef (dll/framework) side. Most of the make_*.py tool changes are related to supporting this. - From the client perspective, you can now define CEF_API_VERSION in the project configuration (or get CEF_EXPERIMENTAL by default). This define will change the API exposed in CEF’s include/ and include/capi header files. All client-side targets including libcef_dll_wrapper will need be recompiled when changing this define. - Examples of the new API-related define usage are provided in cef_api_version_test.h, api_version_test_impl.cc and api_version_unittest.cc. To test: - Run `ceftests --gtest_filter=ApiVersionTest.*` - Add `cef_api_version=13300` to GN_DEFINES. Re-run configure, build and ceftests steps. - Repeat with 13301, 13302, 13303 (all supported test versions).
This commit is contained in:
@ -13,8 +13,8 @@
|
||||
|
||||
#include "include/base/cef_callback.h"
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_command_ids.h"
|
||||
#include "include/cef_frame.h"
|
||||
#include "include/cef_id_mappers.h"
|
||||
#include "include/cef_parser.h"
|
||||
#include "include/cef_shared_process_message_builder.h"
|
||||
#include "include/cef_ssl_status.h"
|
||||
@ -318,6 +318,32 @@ bool IsAllowedToolbarButton(cef_chrome_toolbar_button_type_t button_type) {
|
||||
}
|
||||
|
||||
bool IsAllowedAppMenuCommandId(int command_id) {
|
||||
// Version-safe static declarations of IDC variables using names from
|
||||
// cef_command_ids.h.
|
||||
CEF_DECLARE_COMMAND_ID(IDC_NEW_WINDOW);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_NEW_INCOGNITO_WINDOW);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_ZOOM_MENU);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_ZOOM_PLUS);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_ZOOM_NORMAL);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_ZOOM_MINUS);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_FULLSCREEN);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_PRINT);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_FIND);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_FIND_NEXT);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_FIND_PREVIOUS);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_MORE_TOOLS_MENU);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_CLEAR_BROWSING_DATA);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_MANAGE_EXTENSIONS);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_PERFORMANCE);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_TASK_MANAGER);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_DEV_TOOLS);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_EDIT_MENU);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_CUT);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_COPY);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_PASTE);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_OPTIONS);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_EXIT);
|
||||
|
||||
// Only the commands in this array will be allowed.
|
||||
static const int kAllowedCommandIds[] = {
|
||||
IDC_NEW_WINDOW,
|
||||
@ -361,6 +387,28 @@ bool IsAllowedAppMenuCommandId(int command_id) {
|
||||
}
|
||||
|
||||
bool IsAllowedContextMenuCommandId(int command_id) {
|
||||
// Version-safe static declarations of IDC variables using names from
|
||||
// cef_command_ids.h.
|
||||
CEF_DECLARE_COMMAND_ID(IDC_CONTENT_CONTEXT_CUSTOM_FIRST);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_CONTENT_CONTEXT_CUSTOM_LAST);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_EXTENSIONS_CONTEXT_CUSTOM_LAST);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_BACK);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_FORWARD);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_RELOAD);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_RELOAD_BYPASSING_CACHE);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_RELOAD_CLEARING_CACHE);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_STOP);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_PRINT);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_CONTENT_CONTEXT_CUT);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_CONTENT_CONTEXT_COPY);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_CONTENT_CONTEXT_PASTE);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_CONTENT_CONTEXT_DELETE);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_CONTENT_CONTEXT_SELECTALL);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_CONTENT_CONTEXT_UNDO);
|
||||
CEF_DECLARE_COMMAND_ID(IDC_CONTENT_CONTEXT_REDO);
|
||||
|
||||
// Allow commands added by web content.
|
||||
if (command_id >= IDC_CONTENT_CONTEXT_CUSTOM_FIRST &&
|
||||
command_id <= IDC_CONTENT_CONTEXT_CUSTOM_LAST) {
|
||||
|
Reference in New Issue
Block a user