Compare commits

..

567 Commits
4896 ... 6723

Author SHA1 Message Date
Marshall Greenblatt
5c0b03a4ba Pin depot_tools version for out-of-support branch 2024-11-19 13:37:48 -05:00
Marshall Greenblatt
5a7e5ed359 Update to Chromium version 130.0.6723.117 2024-11-06 14:20:43 +00:00
Marshall Greenblatt
34b05bb541 win: Reland screen_1443650 changes (fixes #3489)
Use ScaleToRoundedRect instead of ScaleToEnclosedRect.
2024-11-05 12:42:02 -05:00
Marshall Greenblatt
de32089516 cefclient: Add RootWindowManager tracking of other browsers (see #3790)
The message loop should not quit until all browsers have closed,
including browsers that are not directly associated with a RootWindow.
2024-11-04 17:16:27 -05:00
Marshall Greenblatt
16488e5564 Free CefMenuRunnerViews on BrowserView destruction (see #3790)
CefMenuRunnerViews holds a raw_ptr<CefBrowserViewImpl> that must be
cleared during CefBrowserViewImpl destruction.
2024-11-04 17:16:18 -05:00
Marshall Greenblatt
7bb6b2569c mac: Fix accelerators in overlay BrowserView (see #3188)
CefWindowImpl::CanHandleAccelerators was returning false for
accelerators triggered in the overlay BrowserView due to
IsWindowKey (called from NativeWidgetMac::IsActive) returning
false. View::CanHandleAccelerators, on the other hand, only
checks IsActive for Aura (non-MacOS) windows. We therefore
delegate to the View implementation for consistent handling.
2024-11-04 17:16:10 -05:00
Marshall Greenblatt
7a98b3fece Execute HandleExternalProtocolHelper on the UI thread (fixes #3821) 2024-11-04 12:01:19 -05:00
Marshall Greenblatt
3470f6ade4 Update to Chromium version 130.0.6723.92 2024-10-31 15:33:29 +00:00
Marshall Greenblatt
fc4256797d win: Revert screen_1443650 changes (fixes #3744)
This change broke tooltip display at 125% scale factor on Windows 10
with high-dpi display.

Reopening the original issue #3489.
2024-10-23 14:33:13 -04:00
Marshall Greenblatt
3dedcced94 Update to Chromium version 130.0.6723.70 2024-10-23 12:50:40 +00:00
Marshall Greenblatt
59f3b143ef mac: cefclient: Fix window.close() with --hide-window-on-close (fixes #3660) 2024-10-22 16:19:53 -04:00
Marshall Greenblatt
6514b929c4 Fix raw_ptr leak of main frame RFH during WebContents close (see #3660) 2024-10-22 16:19:45 -04:00
Mike Bragg
a747221b01 Implement PrintCrossProcessSubframe for AlloyBrowserHostImpl (fixes #3768) 2024-10-22 16:06:43 -04:00
Marshall Greenblatt
351ea86650 win: Add SHA256 impl for Sid::FromNamedCapability (fixes #3791)
The cef_sandbox build can't use the default BoringSSL implementation
so we add an alternative implementation using the Crypto API.
2024-10-22 13:12:13 -04:00
Marshall Greenblatt
06c1602d18 Update to Chromium version 130.0.6723.59 2024-10-21 15:25:21 +00:00
Marshall Greenblatt
48f3ef63e2 linux: Fix callbacks to CefPrintHandler (fixes #3729)
Out-of-process printing must also be disabled by passing
`--disable-features=EnableOopPrintDrivers`.
2024-10-18 15:04:17 -04:00
Marshall Greenblatt
7268dc8cd3 cefclient: views: Add ability to pop out the overlay Browser (see #3790)
When running with the overlay Browser enabled (`--show-overlay-browser`),
pressing Alt+O will move the overlay Browser to a new top-level Window.
Pressing Alt+O again or closing the new Window via the close button will
return the Browser to the overlay. Closing the Browser via `window.close()`
(in the new Window or overlay) will dismiss the overlay completely as
required to maintain consistent internal state. Detection of this state is
supported by the new CefBrowserHost::IsReadyToBeClosed method.

Draggable regions in the main Browser are updated to account for the
presence or absence of the overlay Browser. Support for draggable regions
in the overlay Browser in not implemented in cefclient.

Behavior with multiple overlays, `window.close()` and draggable regions
can be tested by adding `--hide-frame --hide-controls`.
2024-10-18 15:04:08 -04:00
Marshall Greenblatt
45861b1b08 chrome: Support unload handlers with TryCloseBrowser
TryCloseBrowser should potentially trigger JavaScript unload handlers
and return false. Add CefBrowserHost::IsReadyToBeClosed for detecting
mandatory close state. Enable, for Chrome style browsers, LifeSpanTest
that don't require DoClose(). Update related documentation.
2024-10-18 15:03:59 -04:00
Marshall Greenblatt
efe558cd28 views: Fix dangling raw_ptr on CefToolbarViewView destruction 2024-10-18 15:03:49 -04:00
Marshall Greenblatt
f1e634393f views: cefclient: Fix crash when ID_MENU_BUTTON doesn't exist 2024-10-18 15:03:40 -04:00
Marshall Greenblatt
0187046a2e views: Trigger CefBrowser destruction on CefBrowserView release (see #3790)
Avoid a circular ownership dependency between CefBrowserViewImpl and
CefBrowserPlatformDelegate[Chrome]Views (owned by CefBrowserHostBase).
Trigger CefBrowserHostBase destruction when the last CefBrowserViewImpl
reference is released.

This fixes a number of shutdown crashes related to overlay CefBrowsers
still existing at CefShutdown.
2024-10-18 15:03:29 -04:00
Marshall Greenblatt
6f4c2bf8df Fix DiscardableSharedMemoryManager destruction timing
Move DiscardableSharedMemoryManager destruction to the end of UI thread
shutdown, after Mojo messages have stopped arriving. See related comments
at https://chromium-review.googlesource.com/c/chromium/src/+/5925441
2024-10-18 15:03:19 -04:00
Marshall Greenblatt
de2da368c6 cefclient: views: Add overlay BrowserView demo (see #3790)
Adds new `--show-overlay-browser` command-line flag that creates an
overlay containing an Alloy-style BrowserView.  The main BrowserView
may be Chrome- (default) or Alloy-style (add `--use-alloy-style`).
This overlay will only be added to standalone (non-popup) windows.

Popups triggered via the overlay will receive standard Alloy-style
handling in cefclient (e.g. Views-hosted window). Add
`--use-default-popup` for default popup handling.
2024-10-18 15:03:08 -04:00
Marshall Greenblatt
4797681694 views: Fix style calculation for popup BrowserViews (fixes #3499)
Don't depend on a CefBrowserViewDelegate for popup BrowserView style.
Popup style must always match the opener style.
2024-10-18 15:02:57 -04:00
Nik Pavlov
ffbc53a9e6 views: Fix overlay bounds outside of window (fixes #3457) 2024-10-18 15:02:46 -04:00
Marshall Greenblatt
92f14410ae wrapper: Add missing algorithm include (fixes #3804) 2024-10-18 15:02:35 -04:00
Nik Pavlov
e68b0169a1 ceftests: Simplify ViewsWindowTest.WindowAccelerator test (see #3188)
Remove the CefWindowDelegate::OnKeyEvent check as that method
is not currently triggered with the Chrome runtime (see #3797).
2024-10-18 15:02:24 -04:00
Nik Pavlov
1fd6000c70 mac: views: Always initialize CommandDispatcher (see #3188)
ChromeCommandDispatcherDelegate forwards accelerator events to
the FocusManager through NativeWidgetMacNSWindowHost::
HandleAccelerator. Always initialize it so that accelerators also
work in a CefWindow without a BrowserView.
2024-10-18 15:02:14 -04:00
Marshall Greenblatt
5e348cb1fc cefclient: Fix toolbar visibility with --hide-controls (fixes #3745) 2024-10-18 15:02:01 -04:00
Marshall Greenblatt
02b371879b Update to Chromium version 130.0.6723.44 2024-10-11 16:27:48 +00:00
Marshall Greenblatt
3f4d8297f2 Update to Chromium version 130.0.6723.31 2024-10-09 16:36:31 +00:00
Marshall Greenblatt
057c1b1409 cmake: Fix set_property argument (fixes #3775) 2024-09-30 12:49:22 -04:00
Marshall Greenblatt
96ddcee086 Fix dangling ptr in RenderProcessHostTaskProvider (fixes #3758) 2024-09-30 12:19:33 -04:00
Marshall Greenblatt
625ea52a4b Update to Chromium version 130.0.6723.19 2024-09-27 15:50:51 -04:00
Marshall Greenblatt
cd052ec7c3 Update to Chromium version 130.0.6723.0 (#1356013) 2024-09-27 14:15:44 +00:00
Nik Pavlov
e44d33d5bf ceftests: mac: Wait for fullscreen window destruction (see #3188) 2024-09-26 17:52:28 +00:00
Jacobo Aragunde Pérez
6459917c0a Fix index out of bounds with dialog accept_types description (fixes #3779) 2024-09-16 09:08:22 +00:00
Nik Pavlov
b90f0048da Account for overlay host Widget in CefWidget::GetForWidget (fixes #3784) 2024-09-16 09:05:42 +00:00
Nik Pavlov
8c6f8dd404 Add missing <array> header to performance_test_tests.cc 2024-09-02 14:06:21 +00:00
Nik Pavlov
af1f40a2d3 Update to Chromium version 129.0.6668.0
- Mac: Minimum system version is now 11.0.
- Win: Windows SDK version is now 10.0.22621.2428.
2024-08-26 12:44:25 +00:00
Nik Pavlov
2cd405baac Fix handler insertion in CefMessageRouterBrowserSideImpl (fixes #3586) 2024-08-13 18:30:35 +00:00
Marshall Greenblatt
b98eac265a bazel: mac: Copy but don't link the CEF framework (see #3757)
Copy the CEF framework into the app bundle but do not link it. See
https://groups.google.com/g/cef-announce/c/Fith0A3kWtw/m/6ds_mJVMCQAJ
for background.

Use `**kwargs` to pass all other arguments to the actual
`macos_application` target declaration.
2024-08-09 13:18:06 -04:00
Marshall Greenblatt
701c9470f2 Route Download bubble file open to OnOpenURLFromTab (fixes #3750)
Some downloaded file types [1] default to opening in a Browser. Open
requests for these file types originating from the Download bubble UI
should route to the source Browser (call OnOpenURLFromTab). If
OnOpenURLFromTab is unhandled proceed with the default Chrome behavior
of opening the URL in a new default Browser.

[1] PDF, html, etc. For the complete list of file types see
ChromeDownloadManagerDelegate::IsOpenInBrowserPreferredForFile.
2024-08-09 12:07:00 -04:00
Marshall Greenblatt
889cfcf8d1 Fix path override ordering (fixes #3749)
The chrome::DIR_RESOURCES and ui::DIR_LOCALES overrides need to be
configured before calling ChromeMainDelegate::PreSandboxStartup.
2024-08-08 13:39:22 -04:00
Marshall Greenblatt
ebb3c962da Add WebUI allowlist for Alloy-style browsers (fixes #3763) 2024-08-07 14:12:31 -04:00
Marshall Greenblatt
64a2f681aa cefclient: mac: Fix "undefined symbol" link error (see #3499) 2024-08-07 11:34:05 -04:00
Marshall Greenblatt
52888f346f Use int instead of bool in cef_settings_t 2024-08-07 10:41:20 -04:00
Marshall Greenblatt
9e9ba2c543 bazel: Limit define scope to specific cc targets (see #3757)
- Add `declare_[cc|objc]_library` macros to configure common `copts`
  and `local_defines` (where supported) on `[cc|objc]_library`
  targets. This limits the scope of defines to the specific target
  without inheritance by dependent targets.
- `objc_library` does not currently support `local_defines` so we
  use `copts` instead of MacOS.
- Use `**kwargs` to pass all other arguments to the actual cc
  target declaration.
2024-08-06 14:43:45 -04:00
Marshall Greenblatt
166eec85e0 cefclient: Fix invalid cast to ClientHandlerStd (see #3499) 2024-08-05 18:48:30 -04:00
Marshall Greenblatt
f6f4ba8317 bazel: Support <angled> includes of CEF headers (see #3757)
Fixes "file not found with <angled> include" errors.
2024-08-05 17:24:44 -04:00
JC Yang
bed7f420aa Fix dangling ptr in ReadResponseCallbackWrapper (fixes #3760) 2024-08-05 12:36:28 -04:00
Sergey Markelov
be4085981c linux: Fix TLS error on dlopen of libcef.so (fixes #3616) 2024-08-05 12:36:28 -04:00
Loic Frasse-Mathon
785713c4cc posix: Added option to disable signal handlers
See https://github.com/chromiumembedded/java-cef/issues/477
2024-08-05 12:36:28 -04:00
Pedro de Carvalho Gomes
b61c106b6b linux: Add CefWindowDelegate::GetLinuxWindowProperties (fixes #3383) 2024-08-05 12:36:28 -04:00
Nik Pavlov
295ea1f715 Enable V8 sandbox by default (fixes #3332)
When the V8 sandbox is enabled, ArrayBuffer backing stores must be
allocated inside the sandbox address space. This change introduces a new
CefV8Value::CreateArrayBufferWithCopy method that copies the memory
contents into the sandbox address space.

Enabling the V8 sandbox can have a performance impact, especially when
passing large ArrayBuffers from C++ code to the JS side. We have therefore
retained the old CefV8Value::CreateArrayBuffer method that references
external memory. However, this method can only be used if the V8 sandbox is
disabled at CEF/Chromium build time.

To disable the V8 sandbox add `v8_enable_sandbox=false` to
`GN_DEFINES` when building CEF/Chromium.
2024-08-05 16:00:58 +00:00
Marshall Greenblatt
08ae3a44a6 bazel: Fix resource paths as external repo (see #3757)
- Headers that are included by .rc files need to be supplied to
  `declare_exe` via the `resources_deps` attribute (passed as the `deps
  attribute to `compile_rc`). The headers must be part of a cc_library
  target via either the `hdrs` or `srcs` attribute.
- File paths for CEF resources are prefixed with "external/<repo>"
  when CEF is loaded as an external repo. Update `copy_filegroups` to
  work with these paths.
2024-08-02 16:51:11 -04:00
Marshall Greenblatt
5ddeef736a bazel: Add repo for package-local target labels (see #3757)
Unqualified target labels don't resolve correctly when the
disribution is loaded as an external repo. Mapping, if necessary,
can be performed using the `repo_mapping` parameter to
http_archive() or local_repository().
2024-07-31 17:53:30 -04:00
Marshall Greenblatt
446b7d6535 Update to Chromium version 128.0.6613.0 (#1331488) 2024-07-30 11:10:09 -04:00
Marshall Greenblatt
a6c00b2ff6 bazel: Add initial config for binary distribution (see #3757)
Add support for building the CEF binary distribution using Bazel
and the default platform toolchain. Tested to work for Windows
x64, MacOS ARM64 and x64 (cross-compile from ARM64), and
Linux x64. Windows x86 (cross-compile from x64) is known to
be broken, see https://github.com/bazelbuild/bazel/issues/22164.

Includes minor changes to tests directory structure to meet
Bazel build requirements.
2024-07-28 18:19:47 +00:00
Marshall Greenblatt
69b884d39c Add CefTaskManager::GetTaskIdForBrowserId
Update https://tests/task_manager to show the current browser's
renderer task in bold.


Approved-by: Nik Pavlov
2024-07-19 15:19:06 +00:00
Marshall Greenblatt
3acdbac061 Use direct member for CefBrowserHostBase::contents_delegate_
There's no reason to use unique_ptr here as the lifespan of
|contents_delegate_| exactly matches CefBrowserHostBase.
2024-07-18 13:50:40 -04:00
Nik Pavlov
d470cf8204 Add CefTaskManager API
See https://tests/task_manager example in cefclient.
2024-07-18 11:34:41 -04:00
Marshall Greenblatt
cbbca050e0 cefclient: Allow download with --hide-controls (fixes #3742) 2024-07-17 15:06:23 -04:00
Marshall Greenblatt
69fbadd0bc Disable dangling ptr check for PendingRequest::request_ (fixes #3743)
The InterceptedRequestHandlerWrapper object may be deleted (likely via
~InterceptedRequest) while the task to call
InterceptedRequestHandlerWrapper:ContinueCreateURLLoaderNetworkObserver
is still pending. That binding holds a
WeakPtr<InterceptedRequestHandlerWrapper> (which is now nullptr)
resulting in the bound std::unique_ptr<PendingRequest> being deleted
while still holding a raw_ptr<network::ResourceRequest> to the
already-deleted object. This is always safe (raw_ptr will never be
dereferenced) because of the WeakPtr check.
2024-07-17 14:35:33 -04:00
Marshall Greenblatt
4023fea237 cefbuilds: Add tools distribution (see #3734) 2024-07-16 12:43:12 -04:00
Marshall Greenblatt
5607a4d347 distrib: Add new tools distribution for mksnapshot (see #3734) 2024-07-16 12:43:12 -04:00
Marshall Greenblatt
8f4a47479c mac: cefclient: Fix zombie NSWindow object on exit (fixes #3602)
- Don't create a TempWindow when using Views.
- Don't call `close` on an NSWindow that is never opened.
2024-07-15 16:44:38 -04:00
Marshall Greenblatt
02ea88f79f Call SetIsShutdown after CefInitialize (fixes #3738)
Delay shutdown checking until after CefInitialize has drained existing
task pools.
2024-07-15 16:44:38 -04:00
Marshall Greenblatt
ddb0ab8187 Fix DCHECK adding menu separator with hidden items (fixes #3577) 2024-07-15 12:20:43 -04:00
Marshall Greenblatt
ed4257c807 Fix duplicate open from DevTools when handling OnOpenURLFromTab (fixes #3735) 2024-07-11 14:33:55 -04:00
Marshall Greenblatt
b7a172fefc tools: Build using autoninja
Applies automatic `-j (#cores)` configuration
2024-07-11 10:17:21 -04:00
Marshall Greenblatt
68e1fcf3a4 tools: win: Remove dynamic_annotations.lib from cef_sandbox
This library was removed in https://crbug.com/40209570.
2024-07-10 12:35:47 -04:00
Marshall Greenblatt
1f35258023 Include debug symbols for all distributed binaries (fixes #2235) 2024-07-08 12:18:01 -04:00
Marshall Greenblatt
60ce575e53 Remove libcef/features/runtime.h (see #3685)
Use BUILDFLAG(ENABLE_CEF) exclusively in patch files.
2024-07-05 13:24:40 -04:00
Marshall Greenblatt
0d166c3c90 mac: Remove chrome_crash_reporter_client_stub.cc
Compile out the call to ChromeCrashReporterClient::Create() instead.
2024-07-05 12:28:47 -04:00
Marshall Greenblatt
9b284ec8f7 Remove custom chrome scheme handling (see #3685)
- Add CEF info to existing chrome://version WebUI.
- Move chrome://license handling to WebUI.
- Remove chrome://webui-hosts; use chrome://chrome-urls instead.
- Remove chrome://extension-support; navigate to docs directly instead.
2024-07-05 11:58:08 -04:00
Marshall Greenblatt
b080705ec8 Remove empty runtime_checks.h (see #3685) 2024-07-05 11:58:08 -04:00
Marshall Greenblatt
1cdf02815e Remove devtools window runner abstraction (see #3685)
Remove code abstractions that are no longer required after deletion of
the Alloy bootstrap. This is a functional no-op.
2024-07-05 11:58:08 -04:00
Marshall Greenblatt
cd3f617171 Rename browser_util to browser_event_util (seee #3685)
Use more specific file naming. This change is a functional no-op.
2024-07-03 12:16:26 -04:00
Marshall Greenblatt
bd57a40256 Rename browser_extensions_util to browser_guest_util (seee #3685)
After Alloy bootstrap deletion the remaining functions are no longer
related to extensions. This change is a functional no-op.
2024-07-03 12:16:26 -04:00
Marshall Greenblatt
c0a3c897cf Remove main runner abstractions (see #3685)
Remove code abstractions that are no longer required after deletion of
the Alloy bootstrap. This is a functional no-op.
2024-07-03 12:16:26 -04:00
Nik Pavlov
231701d98b Expose DumpWithoutCrashing (fixes #3588) 2024-07-02 18:08:16 +00:00
Marshall Greenblatt
a461a89728 Delete Alloy bootstrap (fixes #3685) 2024-07-01 12:32:14 -04:00
Nik Pavlov
b95b3e6fd5 tools: Fix "invalid escape sequence '\s'" warning 2024-07-01 15:12:35 +00:00
Marshall Greenblatt
c4a6797059 Allow dangling Listener in CefFileDialogManager (fixes #3720) 2024-06-25 14:03:58 -04:00
Marshall Greenblatt
ebb99fbd58 Fix dangling ResourceRequest* (fixes #3719)
Add raw_ptr<network::ResourceRequest> to RequestState instead of
passing ResourceRequest* as a bound parameter.
2024-06-21 16:54:02 -04:00
Marshall Greenblatt
1d7e83336f Allow dangling UnretainedWrapper for ResourceRequest* (fixes #3717)
Change UnretainedWrapper traits from MayNotDangle (default) to
MayDangleUntriaged as a short-term fix.
2024-06-21 12:57:13 -04:00
Yuta Sekiguchi
2a19d3dc57 Rewrite raw pointers reported by clang plugin (see #3239)
Found using a CEF build with clang_use_chrome_plugins=true
and treat_warnings_as_errors=false.

This change rewrites remaining raw pointers reported by
chromium-rawptr checker and fixes a build error reported
by StackAllocatedChecker.
2024-06-21 11:29:23 -04:00
Marshall Greenblatt
810c51026c Fix assertions with Save As dialog
Fixes some issues introduced by 8e79307a62 (see #3314) and
6354d8daf1 (see #3239).

To test:
- Run `cefclient --url=chrome://net-export`
- Click the "Start Logging to Disk" button
- Exit cefclient; get no debug assertions
2024-06-20 14:04:02 -04:00
Marshall Greenblatt
5afde67593 chrome: Fix CHECK when switching from kPrerendering to kActive
In this case |render_frame_| is not bound, |render_frame_host_| is
non-nullptr and |render_frame_host| equals |render_frame_host_| in
CefFrameHostImpl::MaybeReAttach when called from
CefBrowserInfo::FrameHostStateChanged.
2024-06-20 12:09:46 -04:00
Marshall Greenblatt
3b98dbda79 posix: Always resolve symlinks to absolute paths
This avoids issues with mismatched paths when mixing Chromium and
OS filesystem functions. See https://crbug.com/40229712.
2024-06-20 12:09:46 -04:00
Marshall Greenblatt
c44aa35bfc Update to Chromium version 127.0.6533.0 (#1313161) 2024-06-20 12:09:46 -04:00
Marshall Greenblatt
4ed13d8c47 views: Add missing patched files (see #3711) 2024-06-13 18:07:59 -04:00
Marshall Greenblatt
fe24ce3c71 chrome: Add cleanup when context menu isn't running (fixes #3711)
The menu may not be running in the following cases:

- If the menu is empty (e.g. cleared in OnBeforeContextMenu).
- If the menu is disabled (see e.g. RenderViewContextMenuViews::Show).
- When the run call blocks until the menu is dismissed (macOS behavior).

We explicitly clean up in these cases instead of waiting for OnMenuClosed
which will otherwise never be called for the first 2 cases.

Menu run status is exposed via new ContextMenuDelegate and
RenderViewContextMenuBase methods.
2024-06-13 13:38:41 -04:00
Marshall Greenblatt
cc40cbdd45 alloy: Move warning after logging init (fixes #3713) 2024-06-10 11:03:35 -04:00
Julian Waller
7c19cb90e1 cmake: Skip docs generation if the Doxyfile is missing
The Doxyfile is not included with minimal distributions.
2024-06-06 13:54:11 +00:00
Marshall Greenblatt
47798d3dbf Fix potential dangling PendingRequest::request_ (see #3239)
See https://magpcss.org/ceforum/viewtopic.php?f=6&t=19802 for error.
2024-06-04 14:11:59 -04:00
Yuta Sekiguchi
e4bb51f6f6 chrome: Add CefJSDialogHandler support (fixes #3702) 2024-06-04 12:19:14 -04:00
Marshall Greenblatt
fd7444c7a4 win: Enable WinSboxNoFakeGdiInit for Debug component builds (see #3708)
The WinSboxNoFakeGdiInit feature requires delayload of all DLLs that
might load user32.dll in the renderer process. It's enabled as a field
trial for all non-Official builds, but caused problems with Debug
component builds using VS 17.5.0 due to MSVCP140D.dll depending on
OLE32.DLL (which depends on user32.dll). The dependency on OLE32.DLL
is removed with VS 17.9.2 so the feature can now be enabled.

See https://crbug.com/326277735#comment39 for background.
2024-06-04 11:56:12 -04:00
Marshall Greenblatt
c56ae7213e cefclient: linux: Fix gcc -Werror=parentheses (see #3314) 2024-06-04 11:19:50 -04:00
Marshall Greenblatt
cb1830e16c win: Fix undefined symbol with cef_sandbox and VS 17.9.2 (see #3708)
This avoids a bug in clang + MSVC STL when using the default three-way
comparison operator with base::TimeDelta. The compiler does not throw
away the function call to the `std::_Literal_zero_is_expected` symbol,
which is deliberately undefined.

See also https://github.com/microsoft/STL/issues/4359#issuecomment-2042911928
2024-06-03 14:01:14 -04:00
Marshall Greenblatt
39cafe3e6c tests: Fix URLRequestTest failure with ReduceAcceptLanguage trial 2024-05-31 22:53:09 -04:00
Marshall Greenblatt
15c7e80e3c cefclient: win: Fix MSVC compile error 2024-05-31 13:28:33 -04:00
Marshall Greenblatt
8e79307a62 Pass mime type values as file dialog accept filters (see #3314)
File dialogs that specify mime type (e.g. "image/*") accept filters will pass
those values unchanged to the OnFileDialog |accept_filters| parameter. The
default dialog implementation will show those filters in addition to a combined
"Custom Files" filter. This is a change from preexisting Google Chrome
behavior where only the combined "Custom Files" filter is displayed, and
restores CEF behavior that existed prior to 2ea7459a89.

Document the fact that OnFileDialog may be called twice, once before MIME type
expansion and once afterwards.

Add new OnFileDialog |accept_extensions| and |accept_descriptions| parameters
for MIME type extensions and descriptions.

Details: This change adds a SelectFileDialog::FileTypeInfo::extension_mimetypes
member and improves the logic in FileSelectHelper::GetFileTypesFromAcceptType
and file_dialog_manager.cc SelectFileToFileChooserParams to support recall of
the source mime type when populating the FileChooserParams structure.

To test:
- Run `ceftests --gtest_filter=DialogTest.*`
- Run `cefclient --url=https://tests/dialogs`
2024-05-30 15:38:36 -04:00
Marshall Greenblatt
b0bceecba9 Add cef_sandbox dependency on make_config_header (see #3685) 2024-05-26 13:45:30 -04:00
Marshall Greenblatt
b6842f8b80 Remove unused cef_ptr_util.h 2024-05-26 13:45:30 -04:00
Marshall Greenblatt
5fe6382906 cefclient: win: Fix delayload of user32.dll
The WinSboxNoFakeGdiInit feature requires delayload of all DLLs that
might load user32.dll in the renderer process. It's enabled as a field
trial for all non-Official builds, but appears to only work with
non-component Release builds. See https://crbug.com/326277735
2024-05-26 13:45:30 -04:00
Marshall Greenblatt
bd1e188c77 tests: Fix SchemeHandlerTest failure with ReduceAcceptLanguage trial 2024-05-26 13:45:29 -04:00
Marshall Greenblatt
701fc03f00 Update to Chromium version 126.0.6478.0 (#1300313) 2024-05-26 13:45:29 -04:00
pkv
bc1b856b96 alloy: Fix audio capturer crash on exit (fixes #3689) 2024-05-21 17:58:13 +00:00
Marshall Greenblatt
c7b30ee80f cefclient: win: Fix crash on close with --use-native (see #3239)
OnBeforeClose notification is delivered via TabModel destruction in
TabStripModel::SendDetachWebContentsNotifications. We need to let
that call stack unwind before triggering TabStripModel destruction
via closure of the native host window.
2024-05-21 12:58:28 -04:00
Marshall Greenblatt
48137b9538 cefclient: Use default window for DevTools non-Views popup (see #3681)
Chrome runtime only supports creation of a Views-hosted DevTools
popup in ChromeBrowserDelegate::CreateDevToolsBrowser if the parent
is also Views-hosted.

To test:
- Run `cefclient --use-native`
- Right click, select "Show DevTools"
- Close both windows and the app should exit
2024-05-21 12:56:48 -04:00
Marshall Greenblatt
5a2cfb6907 osr: Support DevTools windows with Chrome runtime Alloy style (see #3681) 2024-05-21 12:56:48 -04:00
Marshall Greenblatt
6354d8daf1 Fix dangling raw_ptr errors and related issues (see #3239)
- Use raw_ptr in class container fields.
- Use defined lifespan for StreamReaderURLLoader.
- Fix lifespan assumptions for WebContents/RFH usage.
2024-05-21 12:56:47 -04:00
Marshall Greenblatt
aad216bf56 Revert "Revert unretained dangling ptr detector crash by default (fixes #3693)"
This reverts commit 8283317cb1.
2024-05-20 13:05:37 -04:00
Marshall Greenblatt
3f036edf2d Fix deadlock with enable_backup_ref_ptr_instance_tracer=true (see #3239) 2024-05-20 13:05:37 -04:00
Marshall Greenblatt
32fc106ab0 Enable BackupRefPtr for compatible non-Official builds (see #3239)
Compatible configurations include:
- Non-component builds.
- Debug builds on Mac/Linux.
- Release builds on Windows (b/c Debug builds require component builds).
- ASAN builds (which are also Release builds).

See related logic in //build_overrides/partition_alloc.gni
2024-05-20 13:05:37 -04:00
Marshall Greenblatt
0170f431a0 Apply raw_ptr rewrite to libcef (see #3239) 2024-05-11 12:47:10 -04:00
Marshall Greenblatt
2156c9fd5d Apply raw_ptr usage in patch files (see #3239) 2024-05-11 11:23:56 -04:00
Marshall Greenblatt
00118ddcdb cefsimple: Enable Chrome runtime by default (see #3685)
Run with `--disable-chrome-runtime` to use the Alloy runtime.
2024-05-09 12:53:43 -04:00
Marshall Greenblatt
e7626b2df6 cefclient: Enable Chrome runtime by default (see #3685)
Run with `--disable-chrome-runtime` to use the Alloy runtime.
2024-05-09 12:49:06 -04:00
Marshall Greenblatt
8283317cb1 Revert unretained dangling ptr detector crash by default (fixes #3693) 2024-05-06 16:50:44 -04:00
Marshall Greenblatt
271c6f6446 Fix credentials mode for fetch request redirect (fixes #3675)
Also verified that https://browseraudit.com/ gives the same results
both with and without `--disable-request-handling-for-testing`.
2024-05-06 15:10:12 -04:00
Marshall Greenblatt
311eaf827e alloy: Add missing geolocation pref registration (fixes #3694) 2024-05-06 11:58:55 -04:00
Marshall Greenblatt
002f4b5b4a tools: Don't write args.gn if unchanged (see #3681, see #3685)
Now that args.gn is an input to the make_config_header target we
don't want to invalidate the build unnecessarily by modifying the
file if the contents are unchanged.
2024-05-03 15:38:10 -04:00
Marshall Greenblatt
17a1fd62ec tests: Remove extension tests (see #3685)
The Alloy extension API is deprecated and these tests have not been
supported for some time.
2024-05-03 15:23:35 -04:00
Marshall Greenblatt
ca636bb96e chrome: Support CefResourceBundleHandler (see #3685) 2024-05-03 12:51:09 -04:00
Marshall Greenblatt
4e3668f93a chrome: Support CefSettings logging config (see #3685)
Also enables logging by default for Release builds (previously
required the `--enable-logging` flag). Logging can still be
disabled by passing the `--disable-logging` flag.
2024-05-02 19:43:39 -04:00
Marshall Greenblatt
6b13b1c627 cefclient: Don't call GetExtension when NOTIMPLEMENTED (see #3681) 2024-05-02 19:43:39 -04:00
Marshall Greenblatt
29381355ef chrome: Support CefSettings path config (see #3685) 2024-05-02 19:43:39 -04:00
Marshall Greenblatt
7328b9e40d views: Support themes for Alloy BrowserView in Chrome Window (see #3681)
To test:
- Run `cefclient --enable-chrome-runtime --use-alloy-style
                 --use-chrome-style-window [--background-color=green]`
- OS and Chrome theme changes behave as expected.
2024-05-02 11:21:49 -04:00
Marshall Greenblatt
b92749a58a Add DISABLE_ALLOY_BOOTSTRAP to cef_config.h (see #3681, see #3685)
Include cef_config.h from base/cef_build.h and fix detection of
args.gn changes so that defines are available everywhere by default.

Fix include configuration for chrome_elf_set and sandbox targets.
2024-05-01 14:34:32 -04:00
Marshall Greenblatt
49a34d9160 Apply new Chromium style for #include sorting
Add "cef/" prefix for CEF #includes in libcef/ directory.

Sort #includes by following
https://google.github.io/styleguide/cppguide.html#Names_and_Order_of_Includes
2024-05-01 14:34:32 -04:00
Marshall Greenblatt
b5d84c254d Add GN arg to disable Alloy bootstrap (see #3681, see #3685)
Set enable_alloy_bootstrap=false to build with Alloy bootstrap code
removed. Extension API is documented as deprecated in comments but
not compiled out with this arg.
2024-05-01 14:34:21 -04:00
reito
d666ec5770 win: osr: Fix GPU mutex logic (see #2575) 2024-04-29 14:58:26 +00:00
Marshall Greenblatt
fe5b0dd668 chrome: osr: Fix performance manager init (see #3681) 2024-04-27 15:36:59 -04:00
Marshall Greenblatt
c0e7854782 cefclient: osr: Fix compile errors with binary distribution (see #2575) 2024-04-27 15:36:58 -04:00
Marshall Greenblatt
be6642df3f chrome: Add CefDownloadHandler support (see #3681)
Behaves the same as Alloy runtime except that CanDownload is not
called for invalid protocol schemes.
2024-04-27 15:36:58 -04:00
Marshall Greenblatt
ed079792b6 chrome: Add extension support for Alloy style browsers (see #3681)
This change adds minimal tabs API support for Alloy style browsers.
Clicking links in PDF documents now navigate as expected.
2024-04-27 15:36:58 -04:00
Marshall Greenblatt
0783b4c57d win: Fix generated binaries crashing with exit code 3221225477
See https://issues.chromium.org/issues/336007395
2024-04-26 13:46:45 -04:00
Marshall Greenblatt
b537fc929b mac: Disable dangling pointer detector (see #3239)
This is enabled by default on Mac in M125 but we can't use it until
raw_ptr<> is supported by libcef. For background see
https://chromium.googlesource.com/chromium/src/+/main/docs/dangling_ptr.md
2024-04-26 10:31:40 -04:00
Marshall Greenblatt
708d90a6ff chrome: osr: Create CefWebContentsViewOSR for guest views (see #3681)
Match the logic in Alloy's CefMimeHandlerViewGuestDelegate.
2024-04-26 10:31:40 -04:00
Marshall Greenblatt
5065aba1b4 Remove explicit tracking of guest view frames
This is no longer required now that we have implicit exclusion
of certain frame types including guest view frames.

Rename GuestView to ExcludedView in the renderer process.
2024-04-26 10:31:40 -04:00
Marshall Greenblatt
65234a6830 Ignore load of excluded PDF renderer frames
Starting with M125 we get WebContentsObserver callbacks for speculative
PDF renderer frames. These callbacks should be ignored.
2024-04-26 10:31:40 -04:00
Marshall Greenblatt
b67cbc47e3 Update to Chromium version 125.0.6422.0 (#1287751) 2024-04-25 18:43:05 -04:00
Marshall Greenblatt
4fe529e2dc mac: Enable allocator shim to fix builds (see #3061)
This is a workaround for https://crbug.com/326898585
2024-04-25 18:43:04 -04:00
reito
260dd0ca24 osr: Implement shared texture support (fixes #1006, fixes #2575)
Adds support for the OnAcceleratedPaint callback. Verified to work
on macOS and Windows. Linux support is present but not implemented
for cefclient, so it is not verified to work.

To test:
Run `cefclient --off-screen-rendering-enabled --shared-texture-enabled`
2024-04-23 13:03:56 -04:00
Marshall Greenblatt
dca0435d2f chrome: Add support for Alloy style browsers and windows (see #3681)
Split the Alloy runtime into bootstrap and style components. Support
creation of Alloy style browsers and windows with the Chrome runtime.
Chrome runtime (`--enable-chrome-runtime`) + Alloy style
(`--use-alloy-style`) supports Views (`--use-views`), native parent
(`--use-native`) and windowless rendering
(`--off-screen-rendering-enabled`).

Print preview is supported in all cases except with windowless rendering
on all platforms and native parent on MacOS. It is disabled by default
with Alloy style for legacy compatibility. Where supported it can be
enabled or disabled globally using `--[enable|disable]-print-preview` or
configured on a per-RequestContext basis using the
`printing.print_preview_disabled` preference. It also behaves as
expected when triggered via the PDF viewer print button.

Chrome runtime + Alloy style behavior differs from Alloy runtime in the
following significant ways:

- Supports Chrome error pages by default.
- DevTools popups are Chrome style only (cannot be windowless).
- The Alloy extension API will not supported.

Chrome runtime + Alloy style passes all expected Alloy ceftests except
the following:

- `DisplayTest.AutoResize` (Alloy extension API not supported)
- `DownloadTest.*` (Download API not yet supported)
- `ExtensionTest.*` (Alloy extension API not supported)

This change also adds Chrome runtime support for
CefContextMenuHandler::RunContextMenu (see #3293).

This change also explicitly blocks (and doesn't retry) FrameAttached
requests from PDF viewer and print preview excluded frames (see #3664).

Known issues specific to Chrome runtime + Alloy style:
- DevTools popup with windowless rendering doesn't load successfully.
  Use windowed rendering or remote debugging as a workaround.
- Chrome style Window with Alloy style BrowserView (`--use-alloy-style
  --use-chrome-style-window`) does not show Chrome theme changes.

To test:
- Run `ceftests --enable-chrome-runtime --use-alloy-style
       [--use-chrome-style-window] [--use-views|--use-native]
       --gtest_filter=...`
- Run `cefclient --enable-chrome-runtime --use-alloy-style
       [--use-chrome-style-window]
       [--use-views|--use-native|--off-screen-rendering-enabled]`
- Run `cefsimple --enable-chrome-runtime --use-alloy-style [--use-views]`
2024-04-22 14:57:37 -04:00
Marshall Greenblatt
62c93f01f4 Avoid possible reentrancy of ThemeChanged (see #3671)
The call to SelectNativeTheme from ChromeBrowserFrame::Initialized was
causing Widget::ThemeChanged reentrancy via OnColorProviderCacheResetMissed
when running with `--enable-chrome-runtime --use-native`. Make all calls to
ThemeChanged async to avoid this and possible future issues.
2024-04-14 21:43:44 -04:00
Jacobo Aragunde Pérez
81a0648ee1 tools: Use raw strings for regexps in python scripts (fixes #3677)
Starting with Python 3.12, use of invalid escape sequences in strings
is reported as a SyntaxWarning and will become a SyntaxError at a
later point.

Regular expressions use the backslash character a lot, which result in
warnings of this kind. Python docs recommend to generally use raw
strings for this purpose.
2024-04-12 15:53:51 +00:00
Nik Pavlov
744a194a6e mac: views: Add customization point for acceptsFirstMouse (fixes #3680) 2024-04-12 15:49:31 +00:00
Nik Pavlov
96dc172980 Fix how CefV8ValueImpl differentiates INT and UINT types (fixes #3657) 2024-04-12 15:37:33 +00:00
Marshall Greenblatt
f1effba336 views: Fix destruction issues with CefOverlayViewHost 2024-04-11 15:51:42 -04:00
Marshall Greenblatt
d10cc16236 distrib: Add missing cef_color_id_macros.inc (see #3671) 2024-04-11 11:35:55 -04:00
Marshall Greenblatt
da1c3179a9 win: Fix MSVC compile error with cef_color_ids.h (see #3671)
Copy and modify ui/color/color_id_macros.inc to include an MSVC
workaround for `__VA_ARGS__` expansion.
2024-04-11 11:29:51 -04:00
Marshall Greenblatt
2e33954032 cefclient: Add missing draggable.html resource reference 2024-04-11 11:24:26 -04:00
Marshall Greenblatt
f60476b848 views: Add support for OS and Chrome themes (fixes #3610, fixes #3671)
Controls now respect OS and Chrome themes by default for both Alloy
and Chrome runtimes. Chrome themes (mode and colors) can be configured
using the new CefRequestContext::SetChromeColorScheme method. Individual
theme colors can be overridden using the new CefWindowDelegate::
OnThemeColorsChanged and CefWindow::SetThemeColor methods.

The `--force-light-mode` and `--force-dark-mode` command-line flags are
now respected on all platforms as an override for the OS theme.

The current Chrome theme, if any, will take precedence over the OS theme
when determining light/dark status. On Windows and MacOS the titlebar
color will also be updated to match the light/dark theme.

Testable as follows:
- Run: `cefclient --enable-chrome-runtime` OR
       `cefclient --use-views --persist-user-preferences --cache-path=...`
  - App launches with default OS light/dark theme colors.
  - Change OS dark/light theme under system settings. Notice that theme
    colors change as expected.
  - Right click, select items from the new Theme sub-menu. Notice that
    theme colors behave as expected.
  - Exit and relaunch the app. Notice that the last-used theme colors are
    applied on app restart.
- Add `--background-color=green` to above command-line.
  - Perform the same actions as above. Notice that all controls start
    and remain green throughout (except some icons with Chrome runtime).
- Add `--force-light-mode` or `--force-dark-mode` to above command-line.
  - Perform the same actions as above. Notice that OS dark/light theme
    changes are ignored, but Chrome theme changes work as expected.
2024-04-09 16:19:35 -04:00
Marshall Greenblatt
29c21f58e8 views: Generate cef_color_ids.h header (see #3671) 2024-04-03 12:09:22 -04:00
Marshall Greenblatt
54a9c26b92 Disable thin archives with cef_sandbox builds (fixes #3674) 2024-03-28 11:35:37 -04:00
Marshall Greenblatt
6253e69b70 views: cefclient: Fix initial toolbar button state 2024-03-28 11:35:37 -04:00
Marshall Greenblatt
8ba22e9e11 views: Update textfield colors when enabled state changes 2024-03-28 11:35:37 -04:00
Marshall Greenblatt
19ba8b2b8d views: Use default theme background color for all controls (see #3671)
Add new CefViewDelegate::OnThemeChanged callback for optionally overriding
default theme colors when the current theme changes.
2024-03-28 11:35:37 -04:00
Marshall Greenblatt
a13b6dc7f6 chrome: Use square corners for Chrome toolbar when Views-hosted
Chrome design changed to rounded top corners by default with
Chrome Refresh 2023. Square corners look better when the toolbar
is part of a custom Views-hosted layout, like in cefclient.
2024-03-22 14:50:14 -04:00
Marshall Greenblatt
52dac91167 Update to Chromium version 124.0.6367.0 (#1274542) 2024-03-22 13:46:28 -04:00
Marshall Greenblatt
526e934a12 ceftests: Check CefInitialize return value (see #3609) 2024-03-18 18:33:38 -04:00
Marshall Greenblatt
b8f91c5431 Add callbacks for unresponsive render process (fixes #3661)
The client can optionally wait or terminate the render process.

Expose process exit codes via OnRenderProcessTerminated and
CefGetExitCode (fixes #2126).

cefclient: Add a new https://tests/hang page for testing hang behavior.

cefclient: Move message and resource handling to a new BaseClientHandler
class to support loading of test pages in default Chrome UI windows.
2024-03-18 17:45:31 -04:00
Marshall Greenblatt
5e616b2df0 Improve crash reporting of frame connection retry failures (see #3664)
Introduce different call stacks for different types of disconnects,
and log additional state information in the FATAL message.
2024-03-08 14:24:32 -05:00
qqqqqqqqq
9b06b028dc Replace non-standard memory.h with cstring (fixes #3665)
cef_string_wrappers.h uses a non-standard header memory.h, which breaks
the build on UCRT environments. Replace <memory.h> include with <cstring>,
which is guaranteed to contain strlen.
2024-03-08 17:18:15 +00:00
Marshall Greenblatt
d4cf19db29 Update to Chromium version 123.0.6312.0 (#1262506)
- MacOS ARM64 Official builds are currently failing due to
  https://issues.chromium.org/issues/326898585
2024-02-26 12:08:55 -05:00
Marshall Greenblatt
2c5dd120c7 mac: Add fallback for unsupported --lang values (fixes #3653) 2024-02-20 13:15:25 -05:00
Nik Pavlov
ffea0d9c4a chrome: Add SetAccessibilityState support (fixes #3649) 2024-02-20 16:27:48 +00:00
Marshall Greenblatt
8db08e657d win: distrib: Add DirectX compiler binaries for WebGPU (fixes #3646) 2024-02-15 17:00:30 -05:00
Marshall Greenblatt
706193f3d9 Reland "alloy: Allow --remote-debugging-port=0 (fixes #3619)"
This relands commit 70471059cf
with necessary changes.
2024-02-15 16:12:47 -05:00
Marshall Greenblatt
bfed26c5fc alloy: Fix crash on JS dialog from PDF viewer (fixes #3644) 2024-02-15 15:35:11 -05:00
Marshall Greenblatt
71c8b4b2bb chrome: win: Disable taskbar decoration for PiP and DevTools windows (fixes #3645) 2024-02-15 14:17:59 -05:00
Marshall Greenblatt
ec122a9148 chrome: win: Fix crash on ShowProfileErrorDialog (fixes #3648) 2024-02-15 12:22:52 -05:00
Marshall Greenblatt
90775f149f Revert "alloy: Allow --remote-debugging-port=0 (fixes #3619)"
Reason for the revert: Incorrectly enables DevTools remote debugging
by default.

This reverts commit 70471059cf.
2024-02-14 20:02:20 -05:00
Marshall Greenblatt
f071a4a988 alloy: Fix crash when accessing FirstPartySets (fixes #3643)
Initialize FirstPartySets without PrivacySandbox or IdentityManager
dependencies.
2024-02-14 18:51:32 -05:00
Marshall Greenblatt
cc3d77eec5 chrome: Enforce matching context for new user and incognito profiles
Selecting a new user or incognito profile via Chrome UI may result in
the creation of a new Profile object. If that occurs, we should find
or create a matching CefBrowserContext and CefRequestContext instead
of reusing an existing mismatched context (e.g. using the original
context for an incognito window would be a mismatch). If a new
CefRequestContext will be created the client can now implement
CefBrowserProcessHandler::GetDefaultRequestContextHandler() to
provide the handler for that context.

To test with a new user profile:
1. Click "Profile" icon, select "Add". Now you have 2+ profiles.
2. Click "Profile" icon, select the other user name to create a new
   window using the other user profile.
3. The new window should launch successfully.

To test with a new incognito profile:
1. Select "New Incognito window" from the 3-dot menu.
2. The new window should launch successfully.

To test DevTools window creation for the new profile:
1. Right-click in the new window, select Inspect.
2. The DevTools window should launch successfully.
2024-02-14 18:51:32 -05:00
Marshall Greenblatt
a79981bf7f chrome: cefclient: Add support for --request-context-per-browser
Wait for the OnRequestContextInitialized callback before using a
non-global CefRequestContext.

Use default handling of --load-extension for Chrome runtime (fixes #3529).
2024-02-14 18:51:32 -05:00
Vladimir Kharitonov
70471059cf alloy: Allow --remote-debugging-port=0 (fixes #3619) 2024-02-07 18:42:06 +00:00
Marshall Greenblatt
5dc3cc13e7 chrome: win: Fix taskbar grouping of PiP and DevTools windows (fixes #3641) 2024-02-06 13:55:01 -05:00
Marshall Greenblatt
da3899d142 views: win: Fix occlusion tracking of initially-minimized windows (fixes #3638)
Chromium considers initially-minimized windows to be visible at
creation time in the Aura layer. This confuses the native occlusion
detector which knows that the OS window is initially hidden due to
IsIconic returning true. Start occlusion tracking with consistent
state by delaying enablement until the initially-minimized window is
restored for the first time.
2024-02-05 16:24:51 -05:00
Shezan Baig
69fd43f789 Always assign |is_guest_view| in CefBrowserInfo::GetFrameForGlobalToken 2024-02-05 16:31:04 +00:00
Marshall Greenblatt
d3a483ef59 Fix singleton relaunch issues with multi-threaded-message-loop (fixes #3635)
- Fix UI thread shutdown issues on early app exit.
- views: cefclient: Fix threading requirements in RootWindowViews::Init when
  called on the UI thread via OnAlreadyRunningAppRelaunch.
2024-01-30 17:13:51 -05:00
Marshall Greenblatt
bdb070c85c mac: Update target SDK to 10.15 for cmake and tests 2024-01-30 12:33:53 -05:00
Marshall Greenblatt
57bad703ee views: mac: Add CEF_SHOW_STATE_HIDDEN (fixes #3630)
- Adds `--initial-show-state=hidden` support for cefclient and cefsimple
  where the window launches as initially hidden (no dock thumbnail).
- Adds `--hide-window-on-close` support for cefclient where clicking the
  red traffic light button hides the window instead of closing it.
2024-01-30 12:16:03 -05:00
Marshall Greenblatt
47fe9f834a cefclient: linux: Add missing math.h include (see #3187) 2024-01-30 12:07:08 -05:00
Marshall Greenblatt
2f1e782f62 Update to Chromium version 122.0.6261.0 (#1250580)
Frame identifiers have changed from int64_t to string type. This is due
to https://crbug.com/1502660 which removes access to frame routing IDs
in the renderer process. New cross-process frame identifiers are 160-bit
values (32-bit child process ID + 128-bit local frame token) and most
easily represented as strings. All other frame-related expectations and
behaviors remain the same.
2024-01-30 12:07:08 -05:00
Marshall Greenblatt
2a86a02bdd ceftests: Avoid shutdown hang due to leaked TestHandlers 2024-01-26 14:12:11 -05:00
Marshall Greenblatt
132ac7a180 tools: win: Switch to python3.bat
The python.bat file is removed in never versions of depot_tools.
2024-01-24 17:06:57 -05:00
Marshall Greenblatt
a0446a3c8a Fix clang-tidy warnings (see #3632) 2024-01-21 14:18:09 -05:00
Marshall Greenblatt
a02d2ab3e6 libcef: Format with clang-tidy (see #3632) 2024-01-20 19:33:17 -05:00
Marshall Greenblatt
4ea1b6f293 wrapper: Format with clang-tidy (see #3632) 2024-01-20 12:34:13 -05:00
Marshall Greenblatt
befa827da1 ceftests: Format with clang-tidy (see #3632) 2024-01-20 12:06:28 -05:00
Marshall Greenblatt
0a64bb6f9b tests: Format with clang-tidy (see #3632) 2024-01-19 21:42:21 -05:00
Marshall Greenblatt
9fd312ce04 alloy: Don't create GPUCache directory when cache_path is empty (fixes #3617) 2024-01-17 21:33:27 -05:00
Marshall Greenblatt
468e55e553 cefsimple: Minor code and docs cleanup 2024-01-17 17:44:33 -05:00
Marshall Greenblatt
f1fe098e09 Fix parent window move on show modal dialog (fixes #3629) 2024-01-17 14:33:52 -05:00
Marshall Greenblatt
5af6227a6f chrome: Improve positioning of dialogs (fixes #3628)
Dialogs will be excluded from regions near the top of the window
that contain overlays, draggable regions or titlebar.
2024-01-12 18:13:36 -05:00
Marshall Greenblatt
0d50d5a8c6 tools: Add env var to filter output configs (fixes #2423)
Adds a new GN_OUT_CONFIGS environment variable that, if specified,
will limit the generated configurations to a list of comma-delimited
values (e.g. "Debug_GN_x64,Release_GN_x64").
2024-01-11 13:08:50 -05:00
Marshall Greenblatt
a097b62b6e alloy: Update extensions-related interface registration to match chrome 2024-01-08 14:20:45 -05:00
Marshall Greenblatt
ffc703276a alloy: Fix print preview WebUI registration (fixes #3625) 2024-01-08 13:50:50 -05:00
Julien Bouix
3592d36808 osr: Fix potential null ptr dereference during DnD 2024-01-05 20:20:37 +00:00
Sergey Markelov
deb4664038 capi: Update list comments in generated files 2024-01-05 15:04:12 -05:00
Sergey Markelov
9f6995f839 tools: Fix formatting of lists in capi comments 2024-01-05 15:04:12 -05:00
Sergey Markelov
784302280b tools: Write generated files with UNIX line endings on all platforms (see #3627) 2024-01-05 15:03:45 -05:00
Sergey Markelov
7c2bd75f7a docs: Fix typos "recieve" -> "receive" 2024-01-05 15:03:20 -05:00
Mike Wiedenbauer
3507249202 cefclient: osr: Implement shader-based rendering for Linux (fixes #3187)
Windows still uses OpenGL 1.1 to avoid the added complexity of linking
newer OpenGL APIs on that platform. MacOS has deprecated OpenGL and we
should eventually provide a Metal-based implementation on that platform.
2024-01-05 14:09:30 -05:00
Philipp Thiel
5a9b8e2bc4 views: Add can_activate parameter to AddOverlayView 2024-01-05 13:46:49 -05:00
Marshall Greenblatt
9a45102db0 Update copyright year for generated files 2024-01-05 13:03:36 -05:00
Marshall Greenblatt
1f55d2e12f osr: Fix potential shared memory OOB access 2024-01-05 12:14:58 -05:00
Marshall Greenblatt
9dc7653ddc chrome: mac: Support locale configuration (fixes #3623) 2024-01-03 14:00:39 -05:00
Nik Pavlov
e4acacee18 chrome: Fix unintended show of minimized window on navigation (fixes #3618) 2023-12-18 18:26:31 +00:00
Marshall Greenblatt
206b7b1c95 Fix mojom_ts_generator.py error with Python 3.11 2023-12-13 18:46:06 -05:00
Marshall Greenblatt
262a93b2f7 Split UI thread shutdown into before and after stages (see #3609)
Existing UI thread shutdown tasks need to be executed before the UI
thread RunLoop is terminated. Those tasks have now been moved to
CefMainRunner::StartShutdownOnUIThread and FinishShutdownOnUIThread is
now called after the RunLoop is terminated.

This fixes a shutdown crash in ChromeProcessSingleton::DeleteInstance.
DeleteInstance needs to be called on the UI thread near the end of the
shutdown process (after ChromeProcessSingleton::Cleanup is called via
PostMainMessageLoopRun).
2023-12-13 12:58:55 -05:00
Marshall Greenblatt
80c65f25a3 Update to Chromium version 121.0.6167.0 (#1233107) 2023-12-13 12:58:55 -05:00
Marshall Greenblatt
2f0b00f8f5 cmake: Fix docs for CMake and Xcode version 2023-12-06 13:18:23 -05:00
Marshall Greenblatt
be734efe68 linux: Disable compiler TLS in libxml2 (fixes #3616) 2023-12-06 12:27:08 -05:00
Marshall Greenblatt
0dd7dca229 alloy: Add callback for already running app relaunch (fixes #3615)
Executes CefBrowserProcessHandler::OnAlreadyRunningAppRelaunch
callback for when an already running app is relaunched with the
same CefSettings.root_cache_path.

Adds "Root Cache Path" value and related explainer text to
chrome://version.

Adds a LOG(WARNING) that will be output on startup if
CefSettings.root_cache_path is unset in the client app.
2023-12-06 11:50:08 -05:00
Marshall Greenblatt
5613af8f53 alloy: Fix crash loading chrome://system 2023-12-04 19:11:23 -05:00
Marshall Greenblatt
a25f89f9e4 chrome: Add callback for already running app relaunch (fixes #3609)
Adds a new CefBrowserProcessHandler::OnAlreadyRunningAppRelaunch
callback for when an already running app is relaunched with the
same CefSettings.root_cache_path.

Client apps should check the CefInitialize() return value for early
exit of the relaunch source process.
2023-12-04 15:43:45 -05:00
Marshall Greenblatt
d6af79e7a6 tests: Remove accidental C++20 dependency (see #3611) 2023-11-28 12:48:50 -05:00
Marshall Greenblatt
f781ea373f Update to Chromium version 120.0.6099.0 (#1217362)
- chrome: Disable upgrade/downgrade behavior (see #3608)
- chrome: Disable process singleton behavior (see #3609)
- chrome: Disable config as default system browser (see #3613)
2023-11-28 12:47:00 -05:00
Marshall Greenblatt
738192addf chrome: win: Add CefSettings.chrome_app_icon_id (see #3606) 2023-11-21 11:24:20 -05:00
Marshall Greenblatt
2b1922746f Fix minor include and docs errors 2023-11-21 11:22:37 -05:00
Marshall Greenblatt
3b652a9966 chrome: win: Fix app icon for default Chrome windows (fixes #3606)
This fixes the app icon for default Chrome windows such as DevTools
and Task Manager.

An ICON with value IDR_MAINFRAME (101) will be loaded from the main
executable is available. Otherwise, the default Chromium ICON will be
loaded from libcef.dll.
2023-11-20 19:35:09 -05:00
Marshall Greenblatt
cf934a20a7 Fix cookie exclusion for fetch CORS pre-flight requests (fixes #3596)
Cookies (and other credentials) will be excluded when appropriate by
downgrading |credentials_mode| from kSameOrigin to kOmit.

Improve logic for Origin header inclusion, including a fix for
Referrer/Origin calculation in URLRequestJob::ComputeReferrerForPolicy
when used with custom standard schemes.

Specify correct CookiePartitionKeyCollection when loading cookies.

To test:
- Run tests from https://browseraudit.com/ with and without
  `--disable-request-handling-for-testing`. Results are the same.
- Run `ceftests --gtest_filter=CorsTest.*`.
2023-11-20 14:44:43 -05:00
Marshall Greenblatt
a9f1ce090a tools: Fix typo in make_distrib.py 2023-11-14 12:27:28 -05:00
Nik Pavlov
1886f68490 Remove virtual attribute from CefStringBase destructor (fixes #3587) 2023-11-14 17:20:26 +00:00
Marshall Greenblatt
53ef570f57 chrome: Support Chrome and DevTools command execution (fixes #3282, fixes #3600)
Add new CefBrowserHost::[Can]ExecuteChromeCommand methods for executing
arbitrary Chrome commands.

Add support for existing CefBrowserHost::ShowDevTools, CloseDevTools and
HasDevTools methods.

DevTools windows now support the same Views callbacks as normal popup
windows with the new CefLifeSpanHandler::OnBeforeDevToolsPopup callback
as the DevTools-specific equivalent of OnBeforePopup.

Always create DevTools as an undocked window to support use of
ShowDevTools with default Chrome browser windows.

To test:

Run `ceftests --enable-chrome-runtime [--use-views]
     --gtest_filter=V8Test.OnUncaughtExceptionDevTools`

OR:

1. Run `cefclient --enable-chrome-runtime [--use-native]`
2. Select "Show DevTools", "Close DevTools" or "Inspect" from the
   right-click menu.
3. Notice that the DevTools window is Views-hosted (or native-hosted)
   and works as expected.

Add --use-default-popup to get a default styled popup in step 3.
2023-11-14 17:16:43 +00:00
Marshall Greenblatt
d3d465b32e views: Support per-accelerator priority config (fixes #3598) 2023-11-08 14:27:50 -05:00
Marshall Greenblatt
2b38e2f793 Add workaround for https://crbug.com/1500371 (see #3597) 2023-11-07 17:14:02 -05:00
Marshall Greenblatt
3837f209e1 mac: Update CSS on fullscreen window exit (fixes #3597) 2023-11-07 16:40:29 -05:00
Marshall Greenblatt
21e01d4889 chrome: Hit-test PiP draggable regions before resize border (see #3566) 2023-11-06 15:47:07 -05:00
Nik Pavlov
44323082b1 Add binary format support to CefMessageRouter (fixes #3502) 2023-10-25 18:20:55 +00:00
Marshall Greenblatt
1b74ac5124 mac: chrome: Updated fix for crash in BrowserView::ShouldHideUIForFullscreen (see #3527) 2023-10-24 11:02:35 -04:00
Marshall Greenblatt
b2274f534d Update to Chromium version 119.0.6045.0 (#1204232)
Mac: 13.5+ build system w/ 14.0 base SDK (Xcode 15.0) is now required.
2023-10-24 10:56:39 -04:00
Marshall Greenblatt
3476199bc5 ceftests: More cleanup of TestHandler::OnTestTimeout 2023-10-23 12:31:44 -04:00
Marshall Greenblatt
6651523d86 ceftests: Simplify completion for tests that don't just create browsers
Some test cases don't create browsers at all, or require additional signals
such as request context destruction.

To test: Run `ceftests --gtest_filter=URLRequestTest.*`
2023-10-18 15:42:14 -04:00
Marshall Greenblatt
f594ca3785 ceftests: Fix flaky URLRequestTest due to server response timing
In some cases the browser may be closed before the server response is sent.
2023-10-18 15:42:14 -04:00
Nik Pavlov
15caa9858d Update ipc_performance_test to compare similar transfers (see #3502) 2023-10-18 19:41:33 +00:00
Marshall Greenblatt
e6a96e2bec chrome: views: Fix close of popup windows when parent is destroyed
When running ceftests with Views enabled always close the CefWindow
when the browser is destroyed and wait for both CefBrowser and
CefWindow destruction before signaling test completion.

To test:
Run `ceftests --enable-chrome-runtime --use-views
     --gtest_filter=FrameHandlerTest.OrderMainPopup*:RequestContextTest.PopupNavDestroyParent*`
2023-10-17 11:48:11 -04:00
Marshall Greenblatt
90aea56de6 ceftests: Change CreateTestRequestContext to async usage
With Chrome runtime, custom request contexts may be initialized asynchronously.
Wait for that initialization before using the request context.

This also removes TEST_RC_MODE_CUSTOM (uses TEST_RC_MODE_CUSTOM_WITH_HANDLER
instead) since we always need a handler to get the initialization callback.
2023-10-16 18:44:20 -04:00
Marshall Greenblatt
a2a1b66ea5 chrome: Support configuration of Chrome policy management (fixes #3581)
Disable Chrome policy management by default. Add CefSettings.chrome_policy_id
which, when configured, enables Chrome policy management. See
https://support.google.com/chrome/a/answer/9037717 for background.

To test:
- Start with a machine where Google Chrome is managed.
- Run `cefclient --enable-chrome-runtime --url=chrome://policy/`
  There should be no configured policies.
- Run `cefclient --enable-chrome-runtime --url=chrome://policy/
       --enable-chrome-policy`
  Configured Platform properties should match Google Chrome.
- Run `cefclient --enable-chrome-runtime --url=chrome://policy/
       --enable-chrome-policy --enable-chrome-browser-cloud-management`
  Configured Platform and Cloud properties should match Google Chrome.
2023-10-16 18:44:15 -04:00
Nik Pavlov
8d7001adc3 Replace ReadOnlySharedMemoryRegion with WritableSharedMemoryRegion (see #3502)
Write access to the shared memory region is required because JavaScript lacks
the capability to create read-only ArrayBuffers. When a user attempts to modify
an ArrayBuffer that utilizes a ReadOnlySharedMemoryRegion as its BackingStore
it triggers an access violation.

Note that this pull request may be reverted in the future if JavaScript adds
read-only ArrayBuffer support.
2023-10-16 22:43:29 +00:00
Marshall Greenblatt
f3e92b45fc Fix incorrect includes (see #3284) 2023-10-09 13:13:00 -04:00
Marshall Greenblatt
64c2dc13ca Remove CefBrowserSettings.accept_language_list (fixes #3555)
Chromium does not support configuration of this value on a per-Browser basis.
2023-10-05 18:28:49 -04:00
Marshall Greenblatt
a8a96235a8 chrome: Set prefs for accept_language_list on Profile init (fixes #3579) 2023-10-05 16:43:45 -04:00
Marshall Greenblatt
29938f9cb0 Add new CanZoom/Zoom API (fixes #3284)
Add a simpler CanZoom/Zoom API as an alternative to the more error-prone
SetZoomLevel/GetZoomLevel API. Both APIs are now implemented for both runtimes.
With the Chrome runtime a zoom notification bubble will be displayed unless
CefBrowserSettings.chrome_zoom_bubble is set to STATE_DISABLED.

To test:
- Run cefclient and select zoom entries from the Tests menu.
- chrome: Run cefclient with `--hide-chrome-bubbles` command-line flag to hide
  the zoom notification bubble.
2023-10-05 13:22:44 -04:00
Nik Pavlov
d8ea7363f5 Remove unnecessary copy during CefBinaryValue creation (see #3502) 2023-10-05 16:57:01 +00:00
Nik Pavlov
f8dd0dbfb4 Avoid signed integer overflow UB in IdGenerator 2023-10-05 15:34:40 +00:00
Cristian Amarie
bdec92caf8 Add CefDragData::GetFilePaths to return file paths (fixes #3568)
GetFileNames now returns just the display names with a fallback to
path.BaseName() if the display name is empty.
2023-10-04 12:25:52 -04:00
Diego Pino
4ae030fec1 automate-git: Print out invalid options on error 2023-10-04 16:22:12 +00:00
Marshall Greenblatt
c7d4d9690c Add missing media router prefs registration (fixes #3570) 2023-09-29 13:52:22 -04:00
Marshall Greenblatt
39e64d8cc9 chrome: Standardize fullscreen transition behavor/callbacks (fixes #3571)
Use the same code path for all fullscreen transitions so that Chrome UI updates
correctly. All user-initiated fullscreen transitions now result in
CefWindowDelegate::OnWindowFullscreenTransition callbacks.
2023-09-28 17:44:35 -04:00
Marshall Greenblatt
262ed72348 cefclient: Use HTTPS for test URLs
Some features that we wish to test require HTTPS. Also, Chrome runtime is
redirecting HTTP URLs to HTTPS due to HSTS.
2023-09-28 12:01:04 -04:00
Marshall Greenblatt
27c6a4eabc Update to Chromium version 118.0.5993.0 (#1192594) 2023-09-20 12:07:47 -04:00
Marshall Greenblatt
4df2933516 alloy: Disable DocumentPictureInPictureAPI feature (see #3448)
This feature is default-enabled in M116+ but is not supported by the
Alloy runtime.
2023-09-20 12:07:46 -04:00
Marshall Greenblatt
57d7d89b53 Remove cef_template_util.h (see #3362)
This file is no longer required after cherry-picking C++17 migration
changes from https://crbug.com/1320019.

This also fixes compile errors with Xcode 15:
__has_trivial_destructor is deprecated; use __is_trivially_destructible instead
2023-09-20 12:07:46 -04:00
Marshall Greenblatt
cab404578d Add new Go project to README.md 2023-09-18 19:48:27 +00:00
Marshall Greenblatt
ef6ae3071d chrome: Support frameless document PiP window with draggable regions (fixes #3566) 2023-09-14 12:41:24 -04:00
Nik Pavlov
b064ba08f3 Use python3.bat in cef_create_projects.bat 2023-09-11 15:15:26 +00:00
Marshall Greenblatt
f808926fbd chrome: Add support for CefBrowserViewDelegate::OnGestureCommand 2023-08-31 13:28:27 -04:00
Marshall Greenblatt
f4ecc23213 Disable Chromium field trials in official builds (fixes #3560) 2023-08-30 13:21:06 -04:00
Marshall Greenblatt
0a633e361b win: Fix stickyness of force-[light|dark]-mode on theme change (see #3534) 2023-08-29 15:24:49 -04:00
Marshall Greenblatt
2133d8f5b3 mac: Add support for force-[light|dark]-mode flags (see #3534) 2023-08-29 14:38:18 -04:00
Marshall Greenblatt
445da33efe win: Enable Rust dependencies for x86 builds (see #3553) 2023-08-16 19:09:46 -04:00
Marshall Greenblatt
a4b27a7248 Update to Chromium version 117.0.5938.0 (#1181205) 2023-08-15 12:07:58 -04:00
Marshall Greenblatt
52cb08b973 win: Reduce length of command line for combine_libs.py
This fixes "command line is too long" error when running make_distrib.py.
2023-08-15 12:07:57 -04:00
Marshall Greenblatt
52a9794659 win: Add delayloads to libcef.dll and exe targets
Delay-load as many DLLs as possible for sandbox and startup perf
improvements.
2023-08-15 12:07:57 -04:00
Marshall Greenblatt
605c2bac86 win: Add support for --force-light-mode command-line flag (fixes #3534)
Like the existing --force-dark-mode flag.
2023-08-09 15:16:11 -04:00
Julien Bouix
01e1a0f44d alloy: Add setting to customize log items 2023-08-07 13:40:40 -04:00
Marshall Greenblatt
52b4d7ba5a Fix content_shell build with CEF enabled 2023-07-28 11:54:50 -04:00
Marshall Greenblatt
94d51ffe20 win: Fix implicit conversion changes signedness error 2023-07-25 15:08:42 -04:00
Marshall Greenblatt
4fc5fb8690 mac: tests: Fix NOTREACHED with ViewsTextfieldTest.TextfieldKeyEvent 2023-07-24 16:03:39 -04:00
Marshall Greenblatt
b07a9e1843 mac: cefclient: Fix deprecation warnings 2023-07-24 12:57:37 -04:00
Marshall Greenblatt
8b46735b79 Update to Chromium version 117.0.5895.0 (#1171312) 2023-07-20 18:11:34 -04:00
Marshall Greenblatt
1353677a98 Don't run UI thread tasks after calling CefQuitMessageLoop
This avoids a situation where misbehaving clients may cause the
application to continue running indefinitely by posting new UI
thread tasks after calling CefQuitMessageLoop.
2023-07-11 15:59:52 +03:00
Marshall Greenblatt
a576150ab5 cefclient: mac: Fix type conversion error with Xcode 2023-07-06 13:19:51 +03:00
Marshall Greenblatt
7a033d7585 chrome: linux: Fix NativeWidgetType for bubble popups 2023-07-04 16:38:44 +03:00
Marshall Greenblatt
1f11ce8700 chrome: mac: Keep bubble popups on-screen 2023-07-04 16:38:44 +03:00
Marshall Greenblatt
59bfb32221 cefclient: views: Add option for bottom controls placement
Run with the `--use-bottom-controls` command-line flag to place all controls
at the bottom of the window instead of the top.
2023-07-04 16:38:44 +03:00
Marshall Greenblatt
04c042d9d1 linux: Fix invalid argument type in CHECK 2023-06-28 11:46:38 +03:00
Marshall Greenblatt
8603545aef tests: Fix timing issue with DownloadTest.ClickedInvalid 2023-06-28 11:43:11 +03:00
Marshall Greenblatt
650755a092 Update to Chromium version 116.0.5845.0 (#1160321) 2023-06-28 11:43:11 +03:00
Marshall Greenblatt
71c588c16a alloy: mac/linux: Support OS execution via OnProtocolExecution (fixes #1340) 2023-06-26 13:08:04 +03:00
Marshall Greenblatt
0b99f92e97 views: Add support for modal browser dialogs
A modal dialog is a child CefWindow that implements some special behaviors
relative to a parent CefWindow. Like any CefWindow it can be framed with
titlebar or frameless, and optionally contain draggable regions (subject to
platform limitations described below). Modal dialogs are shown centered on
the parent window (inside a single display) and always stay on top of the
parent window in z-order. Sizing behavior and available window buttons are
controlled via the usual CefWindowDelegate callbacks. For example, the dialog
can have a preferred size with resize, minimize and maximize disabled (via
GetPreferredSize, CanResize, CanMinimize and CanMaximize respectively).

This change adds support for two modality modes. With window modality all
controls in the parent window are disabled. With browser modality only the
browser view in the parent window is disabled.

Both modality modes require that a valid parent window be returned via
GetParentWindow. For window modality return true from IsWindowModalDialog
and call CefWindow::Show. For browser modality return false from
IsWindowModalDialog (the default value) and call
CefWindow::ShowAsBrowserModalDialog with a reference to the parent window's
browser view.

Window modal dialog behavior depends on the platform. On Windows and
Linux these dialogs have a titlebar and can be moved independent of the
parent window. On macOS these dialogs do not have a titlebar, move with
the parent window, and do not support draggable regions (because they are
implemented using sheets). On Linux disabling the parent window controls
requires a window manager the supports _NET_WM_STATE_MODAL.

Browser modal dialog behavior is similar on all platforms. The dialog will
be automatically sized and positioned relative to the parent window's
browser view. Closing the parent window or navigating the parent browser
view will dismiss the dialog. The dialog can also be moved independent of
the parent window though it will be recentered when the parent window
itself is resized or redisplayed. On MacOS the dialog will move along with
the parent window while on Windows and Linux the parent window can be moved
independently.

To test: Use the Tests > Dialog Window menu option in cefclient with Views
enabled (`--use-views` or `--enable-chrome-runtime` command-line flag).
Browser modal dialog is the default behavior. For window modal dialog add
the `--use-window-modal-dialog` command-line flag.
2023-06-21 11:18:24 +03:00
Marshall Greenblatt
05930b7bc9 views: win: Use black title bar with dark mode 2023-06-21 11:18:16 +03:00
Marshall Greenblatt
12d0bccbd4 mac: Fix char16_t declaration error with Xcode 14.2 (fixes #3526) 2023-06-07 13:25:23 +03:00
Marshall Greenblatt
b5386249bd alloy: Remove CefSettings.user_data_path (fixes #3511)
This change replaces existing CefSettings.user_data_path usage with
CefSettings.root_cache_path for better alignment with the Chrome runtime.
All files should now be written inside the root_cache_path directory.
2023-06-06 17:41:57 +03:00
Chris Frank
36a645ffd8 linux: alloy: Fix window resize after context menu dismissal (fixes #3466) 2023-06-06 12:33:52 +00:00
Marshall Greenblatt
3bd2cd78c7 mac: Fix <uchar.h> not available with Xcode < 14.3 (fixes #3526) 2023-06-06 14:43:20 +03:00
Marshall Greenblatt
cbdda6b03b mac: chrome: Fix crash in BrowserView::ShouldHideUIForFullscreen (fixes #3527) 2023-06-06 12:05:02 +03:00
Marshall Greenblatt
6355aaf33b mac: cefclient: Fix compile error with Xcode 14.3.1 2023-06-02 17:28:41 +03:00
Marshall Greenblatt
e53bff712a Delete cef_basictypes.h which is no longer required (fixes #3507) 2023-06-01 19:32:36 +03:00
Marshall Greenblatt
b854992ae6 Update generated files for int/char typedef removal (see #3507) 2023-06-01 19:32:36 +03:00
Marshall Greenblatt
5042d71408 Remove CEF-specific integer and char16 typedef's (see #3507) 2023-06-01 19:32:36 +03:00
Marshall Greenblatt
695ee2a041 Update to Chromium version 115.0.5790.0 (#1148114)
- Mac: 13.3 SDK (Xcode 14.3) is now required
2023-06-01 13:44:39 +03:00
Marshall Greenblatt
cf8b7db4b4 win: Ship d3dcompiler_47.dll on ARM64 (fixes #3515)
Use the same file from the Windows SDK as Chromium on all architectures
("$windows_sdk_path/Redist/D3D/$target_cpu/d3dcompiler_47.dll").
2023-06-01 13:38:38 +03:00
Marshall Greenblatt
5d8c6799fc win: cmake: VS2022 is now required (fixes #3516) 2023-06-01 13:10:56 +03:00
Marshall Greenblatt
bd368f5d3a win: Fix ambiguous max() usage (fixes #3524, see #3422) 2023-06-01 12:55:30 +03:00
Marshall Greenblatt
87a04aba03 win: Update msvs_env.bat to prefer VS2022 (fixes #3509) 2023-06-01 12:55:30 +03:00
Marshall Greenblatt
df4dddee0b win: Fix MSVC compile errors in registry.cc (fixes #3519) 2023-05-30 11:57:41 +03:00
Nik Pavlov
eb63f9e7ae alloy: views: mac: Add three-finger-swipe navigation gesture support
This adds support for the three-finger-swipe navigation gesture with
Alloy/Views. The default implementation matches the Chrome runtime
and navigates the browser back/forward. We also add an Alloy/Views-
specific client callback in CefBrowserViewDelegate for optional
custom handling of the gesture event.
2023-05-26 09:05:33 +00:00
Marshall Greenblatt
29b5999fd7 Add missing include for std::numeric_limits (see #3422) 2023-05-26 08:35:09 +00:00
Marshall Greenblatt
5707889555 Add methods for configuring website/content settings (fixes #3490)
This approach is now used to allow popups on a case-by-case basis in
tests instead of globally disabling the popup blocker with the Chrome
runtime.
2023-05-25 11:15:06 +00:00
Vladimir Kharitonov
ecdfd467f8 Update CefRange type to match gfx::Range (fixes #3422) 2023-05-16 14:44:19 +03:00
Marshall Greenblatt
e5334a5a18 mac: Enable ARC in libcef (fixes #3496)
Also enables debugging of zombie Objective-C objects.
2023-05-09 18:26:47 +03:00
Marshall Greenblatt
e5c4b27366 tools: Fix incorrect SharedMemoryRegion translation (fixes #3498) 2023-05-09 12:37:42 +03:00
Marshall Greenblatt
c18545a7f5 Replace NOTREACHED() with DCHECK(false) in generated files (see #3500)
Restores the old behavior of assertion in Debug build only.
2023-05-08 18:36:00 +03:00
Marshall Greenblatt
dc9e64308a Replace NOTREACHED() with DCHECK(false) (fixes #3500)
Restores the old behavior of assertion in Debug build only.
2023-05-08 18:36:00 +03:00
Marshall Greenblatt
b8e1c6a59d Remove TRACE_EVENT_COPY_XXX overloads (fixes #3497)
This functionality is not compatible with Chromium's new tracing implementation
based on Perfetto.
2023-05-08 18:32:54 +03:00
Takashi Hashida
cf14b2a972 Add CefDownloadItem IsInterrupted and GetInterruptReason methods (fixes #3486) 2023-05-06 16:11:16 +03:00
Marshall Greenblatt
5a22a5c8a3 cmake: win: Fix incorrect /STACK value (fixes #3491) 2023-05-06 15:37:19 +03:00
Marshall Greenblatt
5e80ea3371 mac: Remove libtest_trace_processor.dylib as a runtime dependency 2023-05-05 22:53:16 +03:00
Marshall Greenblatt
d0b3042940 tests: Fix SchemeHandlerTest.HttpXSSDifferentOriginWithDomain failure
Cross-origin usage of document.domain is now restricted by default with the
Chrome runtime. Relax this policy for XSS tests by setting the
"Origin-Agent-Cluster: ?0" header.

Also remove usage of global variable in tests.
2023-05-05 22:53:16 +03:00
Marshall Greenblatt
de4f9e8908 tests: Change HTTP test URLs to HTTPS
This avoids unexpected HTTP to HTTPS redirects which cause test failures with
the Chrome runtime.
2023-05-05 22:53:16 +03:00
Marshall Greenblatt
ab94a13522 Update to Chromium version 114.0.5735.0 (#1135570)
- Mac: 13.3 SDK (Xcode 14.3) is now supported (see https://crbug.com/1431897).
- Mac: Removed UnderlayOpenGLHostingWindow which is no longer used.
2023-05-05 22:53:16 +03:00
Marshall Greenblatt
09c4142dad chrome: mac: Add Alerts helper app (fixes #3181)
Some Chromium code cleanup will follow in
https://chromium-review.googlesource.com/c/chromium/src/+/4456752
2023-04-21 14:39:19 -04:00
Marshall Greenblatt
e0063880ac chrome: mac: cefclient: Support Find window commands (fixes #3462) 2023-04-20 12:26:07 -04:00
Marshall Greenblatt
7ade772e0b chrome: mac: Support dispatch of window commands (see #3462) 2023-04-20 12:26:07 -04:00
Marshall Greenblatt
a39c2a0068 chrome: Improve positioning of the "Find" widget (fixes #3461)
The "Find" widget will be excluded from regions near the edges of the window
that contain overlays, draggable regions or titlebar.
2023-04-20 12:26:07 -04:00
Marshall Greenblatt
17cab6d955 views: mac: Fix overlay association with host CefWindow (fixes #3456) 2023-04-20 12:23:57 -04:00
Nik Pavlov
cad2498d87 mac: views: Add CefWindowDelegate::OnWindowFullscreenTransition 2023-04-20 14:59:15 +00:00
Marshall Greenblatt
6569ef09c5 Update API hash 2023-04-13 12:10:00 -04:00
Sergey Markelov
78ea5d8c61 Make string map append API match the manuals
Reduce cef_string_[multi]map_key() and cef_string_[multi]map_value() complexities
from O(N) to O(1).
2023-04-13 16:08:48 +00:00
Sergey Markelov
c3648f42b2 Use less error prone string list, map or multimap pointer types
Use pointers to incomplete struct types. If an argument of a not suitable
type is passed to a function of any string collection,
C compiler will warn:
  warning: passing argument 1 of <func> from incompatible pointer type
C++ compiler will raise an error, for example:
  error: cannot convert 'cef_string_list_t' ... to 'cef_string_multimap_t'

With the previously used `void*` pointer types, such errors in a code were not
diagnosed.
2023-04-13 16:06:02 +00:00
Sergey Markelov
f90d5bc49e Remove unused macro FALLTHROUGH
Chromium and CEF now use the attribute `[[fallthrough]]`.
2023-04-13 16:03:41 +00:00
Eric Astor
55e158fe81 Avoid generating an accidental UDL suffix
In the error case, we previously output a pragma with a string immediately
followed by __FILE__ - but with no space between the string terminator and
__FILE__, a compliant C++ compiler can interpret this as a user-defined literal
suffix and end up failing to embed the intended information. We should add
spaces here to ensure our generated code is standards-compliant.
2023-04-12 19:54:31 +00:00
Sergey Markelov
5d48f277f2 Fix typos in cef_origin_whitelist.h and capi/cef_origin_whitelist_capi.h 2023-04-12 18:21:39 +00:00
Marshall Greenblatt
2094a8e221 alloy: Fix incorrect rendering of PiP overlay on mouseover (fixes #3482)
Initialize the Chrome color mixer so that ColorProvider returns the expected
semi-transparent color for overlay background in video_overlay_window_views.cc
instead of the default opaque red color (kPlaceholderColor).
2023-04-11 14:08:36 -04:00
Marshall Greenblatt
4b3c3132cb Update to Chromium version 113.0.5672.0 (#1121455) 2023-04-05 17:48:51 -04:00
Nik Pavlov
c83b3cda24 views: mac: Support dynamic resize of title bar height (see #3189)
This is intended for usage with frameless windows that show the standard window
buttons, where resizing the title bar height changes the button offset. Returning a
different value from CefWindowDelegate::GetTitlebarHeight and forcing a resize of
the NSWindow's theme frame (see ViewsWindow::NudgeWindow) will update the
title bar height.

To test:
1. Run `cefclient --use-views --hide-frame --show-window-buttons --url=http://tests/window`
2. Enter a new value for title bar height and click the "Set Titlebar Height" button
2023-03-16 17:19:50 +00:00
Marshall Greenblatt
0a2c7a1070 chrome: Move ThreadProfiler initialization to the UI thread (fixes #3465)
ThreadProfiler::CreateAndStartOnMainThread and SetMainThreadTaskRunnerImpl
should be called on the same thread.
2023-03-14 15:22:58 -04:00
Marshall Greenblatt
178a44bd18 Rewrite issue links to GitHub (see #3464) 2023-03-13 13:50:48 -04:00
Nik Pavlov
45d771dfb0 views: mac: Enable WindowTestRunnerViews 2023-03-13 17:24:25 +00:00
Marshall Greenblatt
1726176b9b Update GitHub issue templates (see #3464) 2023-03-11 20:59:16 -05:00
Marshall Greenblatt
c6872cec5f Add GitHub issue templates (see #3464) 2023-03-11 20:45:14 -05:00
Marshall Greenblatt
14dd0c0d06 chrome: Add ability to hide toolbar and app menu contents (see issue #3280)
This change adds new CefCommandHandler callbacks for optionally hiding
specific Chrome toolbar icons, buttons and app menu items.

To test: Run `cefclient --enable-chrome-runtime --filter-chrome-commands`.
Most icons, buttons and app/context menu items will be hidden.
2023-03-08 12:02:49 -05:00
Nik Pavlov
06af9c85da views: mac: Show standard window buttons with frame by default (see issue #3189)
This restores the previous default behavior for framed windows.
2023-03-08 16:58:21 +00:00
Marshall Greenblatt
d509d5833d chrome: Don't show gray background during browser load (fixes issue #3459) 2023-03-06 15:55:55 -05:00
Marshall Greenblatt
2c67350605 Update API hash for commit 9ae4da3b38 2023-03-06 15:55:38 -05:00
Sergey Markelov
9ae4da3b38 Fix compile error: this function declaration is not a prototype
`cef_basetime_now()` failed to compile if `-Wstrict-prototypes` is set in clang
or gcc.
2023-03-06 16:48:36 +00:00
梅迎朝
8b79f9cbe7 cefclient: Fix incorrect logic in PassThruResponseFilter 2023-03-06 16:48:03 +00:00
Marshall Greenblatt
3e4f8d1b9c win: Copy dbghelp.dll/dbgcore.dll from the Windows SDK (fixes issue #3356) 2023-03-03 18:26:06 -05:00
Marshall Greenblatt
f3b570cf8e win: Remove CefEnableHighDPISupport function (fixes issue #3452)
High-DPI support is now enabled by default in Chromium.
2023-03-03 16:07:29 -05:00
Marshall Greenblatt
d33b67cb33 tools: mac: Add missing README.sandbox.txt (fixes issue #3453) 2023-03-03 15:48:03 -05:00
Marshall Greenblatt
ae9ede9aa6 win: Add windows_sdk_version GN arg (see https://crbug.com/1420723) 2023-03-03 09:59:30 -05:00
Marshall Greenblatt
584b19967a Update to Chromium version 112.0.5615.0
- Windows: VS2022 and Win11 SDK 10.0.22621.0 are now required.
2023-03-03 09:59:30 -05:00
Marshall Greenblatt
3c85154faf Remove renderer process CefURLRequest support
The CefFrame::CreateURLRequest method is no longer supported in the renderer
process. Usage of this method was already limited to same-origin requests due
to renderer process CORS restrictions, and the underlying Blink API has now
been removed in https://crbug.com/1413912 (M112+).

Existing alternatives include CefURLRequest usage in the browser process, or
JavaScript XMLHttpRequest/fetch API usage in the renderer process.
2023-02-28 13:36:15 -05:00
Nik Pavlov
276423dcfb views: mac: Fix frameless window behavior (fixes issue #3189)
Frameless windows now display as expected. Default traffic light buttons can
optionally be shown at configurable vertical position. Layout respects text
direction.
2023-02-28 18:34:12 +00:00
Marshall Greenblatt
42f351a40d alloy: Fix theme configuration on startup (fixes issue #3449) 2023-02-22 17:11:47 -05:00
Marshall Greenblatt
13f2282754 chrome: cefclient: Add default handler for request tests (see issue #3444)
Support loading of request tests (e.g. http://tests/other_tests) inside default
browsers created via "New window" and "New incognito window" commands.
2023-02-17 16:01:22 -05:00
Marshall Greenblatt
80cfb3c97c chrome: Fix request interception with active extension (fixes issue #3444)
Support chaining of proxies in WillCreateURLLoaderFactory.
2023-02-17 15:18:10 -05:00
Marshall Greenblatt
73082fd2ce chrome: Make primary user profile the default global context (see issue #3444)
Chrome is always loading the primary user profile by default, so with this
change the CEF behavior more accurately reflects reality. Incognito contexts
can still be created explicitly via CefRequestContext::CreateContext.

Prior to this change, the default for the global context was an Incognito
profile based on the primary user profile. That caused request interception
to be bypassed in WillCreateURLLoaderFactory for profiles associated with
the "New window" and "New incognito window" commands. Those profiles, while
also being (or based on) the primary user profile, did not match the specific
Incognito profile assigned to the default global context.

After this change, the "New window" and "New incognito window" commands will
match the default global context when executed on a browser that was created
using the primary user profile.
2023-02-17 14:36:13 -05:00
Marshall Greenblatt
bc29774553 chrome: Fix crash on display of browser via "New window" command 2023-02-17 14:35:42 -05:00
Marshall Greenblatt
ff68c01543 chrome: Use default Browser creation for picture-in-picture popups (see issue #3448)
Note: In current master (based on M111), document PiP partially works when
run with the `--enable-features=DocumentPictureInPictureAPI` command-line
flag. However, the document PiP implementation at this Chromium version is
missing fixes that have already been cherry-picked to the 5563 release
branch. Those fixes will only be available in master after the next Chromium
update (to M112).
2023-02-10 15:42:37 -05:00
Marshall Greenblatt
400fbf7839 automate-git: Remove --chromium-channel parameter (fixes issue #3447)
This functionality is currently unused, and depends on deprecated omahaproxy
data sources from Chromium.
2023-02-08 12:56:20 -05:00
Marshall Greenblatt
f34406c57d Fix potential UAF of CefBPDNativeAura::window_widget_ 2023-02-07 10:45:57 -05:00
Marshall Greenblatt
adfa59f690 ceftests: Fix OSRTest flakyness 2023-02-06 17:45:35 -05:00
Marshall Greenblatt
baf98ee6e9 ceftests: Fix MediaAccessTest.Desktop failures
Fixes InvalidStateError: Failed to execute 'getDisplayMedia' on 'MediaDevices':
getDisplayMedia() requires transient activation (user gesture).
2023-02-03 13:00:26 -05:00
Marshall Greenblatt
dc2231cdfb Update to Chromium version 111.0.5563.0 (#1097615) 2023-02-03 13:00:26 -05:00
Marshall Greenblatt
4c41f14360 Remove deprecated base::[Dictionary|List]Value API usage 2023-01-30 21:32:19 -05:00
Marshall Greenblatt
36ee304ed4 Use default cookie scheme settings for non-global request contexts
The CefSettings cookie scheme configuration will now only impact the global
request context. Custom behavior for other request contexts must now be
configured via CefRequestContextSettings.
2023-01-26 14:37:05 -05:00
Marshall Greenblatt
c3c5d6ff37 chrome: Allow WebUI handling of DevTools scheme (fixes issue #3421) 2023-01-23 14:20:11 -05:00
Marshall Greenblatt
47d2651ea4 Fix patched chrome build with enable_cef=false 2023-01-23 14:20:11 -05:00
Marshall Greenblatt
5c4ac32bb9 tools: Return non-zero exit code from automate-git.py on error 2023-01-19 16:42:55 -05:00
Marshall Greenblatt
8b447e3a6f chrome: Don't show the profile picker on startup (fixes issue #3440) 2023-01-19 16:21:21 -05:00
Marshall Greenblatt
b065ca8cf4 ceftests: Add support for scaling default test timeout values 2023-01-13 14:01:29 -05:00
Marshall Greenblatt
2b906c31b5 cmake: Set PROJECT_ARCH to the host architecture by default 2023-01-12 16:46:46 -05:00
e.jorge
b65d59f27e Fix edit command execution on pdf frames (fixes issue #3429) 2023-01-12 21:45:43 +00:00
Marshall Greenblatt
606e5dddf3 Fix crash calling GetUserData on a non-user V8 object (fixes issue #3438) 2023-01-12 15:56:12 -05:00
Sergey Markelov
4f336c110b Fix the comments to CefCommandLine::AppendSwitch methods 2023-01-12 11:51:25 -05:00
e.jorge
aae420aa8b linux: Fix component build errors (fixes issue #3424) 2023-01-12 16:49:21 +00:00
Vladimir Kharitonov
b1a530c76a mac: Fix OSR scaling behavior when switching displays (fixes issue #3423) 2023-01-12 16:47:19 +00:00
Enrique Turegano Pedruelo
f6d626d979 Linux: Fix build without X11 (fixes issue #3431) 2023-01-10 21:30:47 +00:00
Marshall Greenblatt
2b2c6aa143 win: osr: Fix context menu popup placement (fixes issue 3433) 2023-01-06 15:51:22 -05:00
Marshall Greenblatt
b66c2d1bea Revert "Fix dismissal of select popups on NotifyMoveOrResizeStarted (see issue #3294)"
This reverts commit 5f4bccd672.

Reason for revert: This change causes a native parented browser to lose focus
on move (fixes issue #3426).
2023-01-06 13:48:29 -05:00
Marshall Greenblatt
e65da8fab8 alloy: Avoid initialization of privacy sandbox and identity manager (fixes issue #3434, fixes issue #3401) 2023-01-06 12:12:19 -05:00
Marshall Greenblatt
aef474b909 alloy: Fix crashes when extensions are disabled (fixes issue #3430) 2023-01-05 14:00:22 -05:00
Marshall Greenblatt
8a07a836e1 cmake: Set build target to Windows 10 2023-01-05 12:47:15 -05:00
Marshall Greenblatt
9f8be5ea6c Update include files for bracket style 2023-01-04 21:36:29 -05:00
Marshall Greenblatt
83cb82d50f Rename namespace to "cef_internal" for base types
This fixes duplicate symbol errors when building CEF sample applications as
part of the Chromium build. These applications pick up a link-time dependency
on base.lib via the //sandbox and/or //testing/gtest targets which then
conflict with the symbols provided by the libcef_dll_wrapper target.
2023-01-04 21:36:29 -05:00
Marshall Greenblatt
a986b1c226 ceftests: Fix CorsTest.IframeNone failures
The same console message is sometimes output multiple times.
2023-01-04 21:36:29 -05:00
Marshall Greenblatt
d04b5d4f87 Update to Chromium version 110.0.5481.0 (#1084008) 2023-01-04 21:36:29 -05:00
Marshall Greenblatt
e646827d92 cefclient: Remove console message alert and update google URLs 2023-01-04 17:58:42 -05:00
Marshall Greenblatt
7ba45a0451 Mac: Fix implicit type cast errors with Xcode 14.1 2023-01-04 17:58:42 -05:00
Marshall Greenblatt
3af3eab3e4 Update source files for bracket style 2023-01-04 17:47:17 -05:00
Marshall Greenblatt
d84b07a5cb Update generated files for copyright year and bracket style 2023-01-04 17:47:12 -05:00
Marshall Greenblatt
c7ffa3a122 Update translator tooling for bracket style 2023-01-04 17:32:03 -05:00
David Cernoch
ecc89d7d93 alloy: Generate tagged PDFs when using PrintToPDF
This matches the current behavior in Chrome.
2022-12-14 19:51:03 +00:00
Marshall Greenblatt
30a321b1ce win: Add ENABLE_BASE_TRACING check to fix cef_sandbox build 2022-11-17 12:50:15 -05:00
Marshall Greenblatt
d7d0c2fc6d mac: Fix bug in GetNSBoundsInDisplay (see issue #3359) 2022-11-17 12:50:15 -05:00
Marshall Greenblatt
216e5b31dd tests: Fix CorsTest.Iframe failures (see issue #3348)
Run test initialization after the server has started.
2022-11-17 12:50:15 -05:00
Marshall Greenblatt
47d69a842a Update to Chromium version 109.0.5414.0 (#1070088)
- mac: Xcode 14.0 with macOS SDK 13.0 is now required.
- Remove CefRequestHandler::OnQuotaRequest because persistent quota is no
  longer supported (see https://crbug.com/1208141)
2022-11-17 12:50:15 -05:00
Marshall Greenblatt
74fc5d5573 win: Fix 1px gap with maximized frameless windows on Win11 (fixes issue #3414) 2022-11-09 13:08:16 -05:00
Rye Mutt
7611c4dba6 win: tools: Add VS2022 to msvs_env.bat 2022-11-08 22:19:02 +00:00
Marshall Greenblatt
25954e872e cefclient: mac: Support window state restore (see issue #3359)
The cefclient sample app on macOS will persist window state across application
restart if run with cache_path and persist_user_references enabled.

To test:
1. Run `cefclient --cache-path=/path/to/cache --persist-user-preferences`
2. Move or resize the window, maximize, minimize, etc.
3. Exit cefclient.
4. Run cefclient again with the same arguments. The previous window state will
   be restored.
2022-11-08 16:37:39 -05:00
Marshall Greenblatt
e2a9236106 cefclient: win: Support window state restore (see issue #3359)
The cefclient sample app on Windows will persist window state across application
restart if run with cache_path and persist_user_references enabled.

To test:
1. Run `cefclient --cache-path=/path/to/cache --persist-user-preferences`
2. Move or resize the window, maximize, minimize, etc.
3. Exit cefclient.
4. Run cefclient again with the same arguments. The previous window state will
   be restored.
2022-11-07 15:21:46 -05:00
Marshall Greenblatt
882bc19fdd cefclient: views: Support window state restore (see issue #3359)
The cefclient sample app will persist window state across application restart
if run with views, cache_path and persist_user_references enabled.

To test:
1. Run `cefclient --use-views --cache-path=/path/to/cache --persist-user-preferences`
2. Move or resize the window, maximize, minimize, etc.
3. Exit cefclient.
4. Run cefclient again with the same arguments. The previous window state will
   be restored.
2022-10-28 14:28:53 -04:00
Marshall Greenblatt
09bb643ef6 Support registration of custom preferences.
Custom global and request context preferences can now be registered via
CefBrowserProcessHandler::OnRegisterCustomPreferences. CefRequestContext
now extends CefPreferenceManager and global preferences can be accessed
via CefPreferenceManager::GetGlobalPreferenceManager.
2022-10-26 16:54:33 -04:00
Marshall Greenblatt
767c4422ac windows: Fix size/placement with multi-DPI screen setup (fixes issue #3359)
Use ScreenWin functions to correctly compute DIP/pixel conversions for
CEF-created top-level windows.

Fix incorrect DIPToScreenRect usage in DesktopWindowTreeHostWin when
|has_external_parent_| is true.
2022-10-24 19:53:05 -04:00
Marshall Greenblatt
07bf5dbacc windows: Configure stack size for executables (fixes issue #3250)
Change the default stack size to 8 MiB for 64-bit and 0.5 MiB for 32-bit.

CEF's main thread needs at least a 1.5 MiB stack size in order to avoid
stack overflow crashes. However, if this is set in the PE file then other
threads get this size as well, leading to address-space exhaustion in 32-bit
CEF. A new CefRunWinMainWithPreferredStackSize function uses fibers to switch
the main thread to a 4 MiB stack (roughly the same effective size as the
64-bit build's 8 MiB stack) before running any other code.

This change additionally moves the existing Windows-only functions
CefSetOSModalLoop and CefEnableHighDPISupport from cef_app.h to cef_win.h.
2022-10-21 14:52:50 -04:00
Marshall Greenblatt
dfd1917d9b Remove obsolete call to _set_FMA3_enable(0)
This call was longer required after the switch to VS2015 (see
https://crbug.com/586618).
2022-10-20 13:47:27 -04:00
Marshall Greenblatt
a046794e68 alloy: Fix renderer crashes related to BadgeService (fixes issue #3005) 2022-10-20 12:49:43 -04:00
Marshall Greenblatt
1e4e18240d Linux: Fix deprecated-volatile error with older glib version
Fix "error: use of result of assignment to object of volatile-
qualified type 'volatile gsize' (aka 'volatile unsigned long') is
deprecated [-Werror,-Wdeprecated-volatile]" when building with
use_sysroot=false on Ubuntu 18.04.
2022-10-18 17:58:41 -04:00
Marshall Greenblatt
8b45f32b33 Update to Chromium version 108.0.5359.0 (#1058933) 2022-10-18 17:58:41 -04:00
Marshall Greenblatt
25c75c5fc4 Use new PrintViewManagerBase::PrintToPdf method (fixes issue #3377) 2022-10-14 14:10:30 -04:00
npavlov
485f0b9caf Add screen pixel to screen DIP conversion methods.
On Windows these new CefDisplay methods convert between screen pixel coordinates
and screen DIP coordinates. On macOS and Linux these methods just return a copy
of the input coordinates.
2022-10-14 13:55:07 -04:00
VodBox
fa643b269e Add support for native creation and resolution of Promises (fixes issue #3305) 2022-10-11 14:55:12 -04:00
Marshall Greenblatt
60ee4a34aa Add support for PGO builds (fixes issue #2956)
This configuration applies to Official Release builds only.

Chromium currently provides PGO profiles for Windows x86/x64, MacOS x64/ARM64
and Linux x64. Official builds for these platforms must run automate-git.py with
the `--with-pgo-profiles` command-line flag. Official builds for other platforms
must disable PGO builds by adding `chrome_pgo_phase=0` to GN_DEFINES.
2022-10-10 14:11:22 -04:00
Marshall Greenblatt
f33c062d78 Don't include ceftests/resources in minimal distrib (fixes issue #3408) 2022-10-10 14:11:22 -04:00
Marshall Greenblatt
fce5af14a8 widevine: Support CDM host verification and storage ID (fixes issue #3404)
This functionality will be enabled if .sig files exist in the required
locations. See the issue for details.
2022-10-04 18:21:31 -04:00
Marshall Greenblatt
497e0d2d98 Support GN configuration of enable_rlz (see issue #3404) 2022-10-04 12:52:48 -04:00
Jelle Bleyaert
e0c878df5f Add CefResolveURL function (fixes issue #3402) 2022-10-03 17:46:50 +00:00
Marshall Greenblatt
5433d9fe5c alloy: Fix crash after file dialog selection (fixes issue #3401) 2022-09-30 14:09:37 -04:00
Marshall Greenblatt
dc35b3a93e Linux: Remove the fatal_linker_warnings=false default GN arg
This value is no longer required with Ubuntu 16+ host systems.
2022-09-29 13:12:45 -04:00
Marshall Greenblatt
4e43f90244 chrome: Fix shutdown crashes with multi-threaded-message-loop (fixes issue #3403) 2022-09-29 13:09:35 -04:00
Marshall Greenblatt
4d1fd05740 Update to Chromium version 107.0.5304.0 (#1047731) 2022-09-29 13:09:35 -04:00
Marshall Greenblatt
0089378a0a alloy: Fix crash when requesting periodic-background-sync permission (fixes issue #3393) 2022-09-09 11:58:22 -04:00
Marshall Greenblatt
7e3b084819 cefclient: Fix infinite loop in FilterMenuModel (fixes issue #3392) 2022-09-08 12:41:25 -04:00
Marshall Greenblatt
53c365b752 Fix more space in comments (see issue #3384) 2022-09-06 16:11:02 -04:00
Marshall Greenblatt
9c359b682b docs: Fix API doc link in README.md (see issue #3385) 2022-09-06 16:10:29 -04:00
Marshall Greenblatt
7174c4c328 docs: Add new API docs links to README.md (see issue #3385) 2022-09-06 14:44:38 -04:00
Czarek Tomczak
9ecd25a93b linux: cefclient: Fix MESA_GL_VERSION_OVERRIDE env variable name 2022-09-05 20:56:49 +00:00
Marshall Greenblatt
5ea0c141b5 Convert base::size to std::size from C++17 (see issue #3362) 2022-09-05 16:31:47 -04:00
Marshall Greenblatt
12fc72147c Format include/base comments for Doxygen (see issue #3384) 2022-09-05 16:17:57 -04:00
Marshall Greenblatt
cf7e10aacc Fix space in comments (see issue #3384) 2022-09-05 14:10:30 -04:00
Marshall Greenblatt
09b4cbd32c docs: Use README.md as the Doxygen main page (see issue #3384)
Also set FULL_SIDEBAR=NO for consistency with older Doxygen versions where
this option is not supported.
2022-09-05 14:06:23 -04:00
Marshall Greenblatt
8645e88e0e tools: Add make_cppdocs.sh for Linux/MacOS (see issue #3385)
The make_distrib script will now generate Doxygen docs by default
if the doxygen command-line tool is installed. Run with `--no-docs`
(`--no-distrib-docs` with automate-git.py) to disable docs generation.
2022-09-02 11:27:22 -07:00
Marshall Greenblatt
fa2464e843 cmake: Add a Doxygen target to the binary distribution (fixes issue #3386)
This change also writes a docs/index.html file to provide an easier entry point
for loading the documentation from the docs/html directory.
2022-09-02 13:17:30 -04:00
Marshall Greenblatt
51699e671a Fix line wrapping in comments (see issue #3384) 2022-09-02 13:10:09 -04:00
Marshall Greenblatt
14c0f74707 tools: Update make_cppdocs.bat for Doxygen support (see issue #3384) 2022-09-01 17:21:19 -04:00
Marshall Greenblatt
77582a01b5 tools: Add initial Doxyfile configuration (see issue #3384)
This configuration can be summarized as:

```
$ doxygen.exe -x_noenv
// Difference with default Doxyfile 1.9.5
PROJECT_NAME           = "Chromium Embedded Framework (CEF)"
PROJECT_NUMBER         = $(PROJECT_NUMBER)
OUTPUT_DIRECTORY       = docs
STRIP_FROM_INC_PATH    = .
JAVADOC_AUTOBRIEF      = YES
PYTHON_DOCSTRING       = NO
TAB_SIZE               = 2
TYPEDEF_HIDES_STRUCT   = YES
EXTRACT_ALL            = YES
EXTRACT_STATIC         = YES
FORCE_LOCAL_INCLUDES   = YES
QUIET                  = YES
INPUT                  = include
RECURSIVE              = YES
EXCLUDE                = include/capi \
                         include/test \
                         include/base/internal
EXCLUDE_PATTERNS       = *_internal.h
EXCLUDE_SYMBOLS        = base::cef_internal \
                         base::cef_subtle \
                         base::internal \
                         cef_trace_event \
                         cef::logging
STRIP_CODE_COMMENTS    = NO
REFERENCES_LINK_SOURCE = NO
VERBATIM_HEADERS       = NO
IGNORE_PREFIX          = Cef \
                         cef_
DISABLE_INDEX          = YES
GENERATE_TREEVIEW      = YES
FULL_SIDEBAR           = YES
SEARCHENGINE           = NO
GENERATE_LATEX         = NO
PREDEFINED             = USING_CEF_SHARED \
                         __cplusplus \
                         OS_WIN \
                         OS_LINUX \
                         CEF_X11 \
                         OS_MAC
```
2022-09-01 17:20:54 -04:00
Marshall Greenblatt
d7a153bdd4 Update include/ comments to Doxygen formatting (see issue #3384)
See related guidelines in the issue.
2022-09-01 17:14:30 -04:00
Marshall Greenblatt
7b352159df tools: Update translator tool for Doxygen comment format (see issue #3384)
Comments for translated classes/methods/functions must now take the form:

///
/// ... text ...
///
2022-09-01 17:13:28 -04:00
Marshall Greenblatt
00f34d5e68 cmake: Update supported Xcode to 13.4 2022-08-31 22:06:51 -04:00
Marshall Greenblatt
f8d90a8972 Fix OnReceiveResponse expectations (fixes issue #3380)
OnHeadersReceived may not have been called for cached responses.
2022-08-30 14:20:19 -04:00
Marshall Greenblatt
27d4f1fc97 alloy: Fix crashes related to permissions checks (fixes issue #3379, fixes issue #3381) 2022-08-26 12:23:48 -04:00
Marshall Greenblatt
f2206b8dbc Windows: Enable big PDBs for libcef.dll.pdb in full-symbol builds
This fixes official build linker errors like:

lld-link: error: Output data is larger than 4 GiB. File size 4,341,682,176 too large for current PDB page size 4096
lld-link: error: failed to write PDB file ./libcef.dll.pdb

See https://crbug.com/1245726 for background.
2022-08-25 18:53:38 -04:00
Marshall Greenblatt
713297ee04 Windows: Fix unresolved dependencies error on ARM64 2022-08-25 18:33:24 -04:00
Marshall Greenblatt
37aee4d3a0 Improve the timing of OnLoadEnd (fixes issue #3341)
Use WebContentsDelegate::DidFinishLoad instead of a custom Mojo message.
This fixes flaky OnLoadEnd behavior with NavigationTest.Order.
2022-08-25 18:23:33 -04:00
Marshall Greenblatt
5ec6e62656 tests: Fix DOMTest failure with fractional devicePixelRatio 2022-08-25 14:09:20 -04:00
Marshall Greenblatt
bf467e136a tests: Disable HTTPS server reuse between tests (see issue #3348)
We can't currently reuse the HTTPS server between tests due to
https://crrev.com/dd2a57d753 causing certificate registration issues.
2022-08-25 14:09:20 -04:00
Marshall Greenblatt
e95d1653ac tests: Fix failures on multiple execution of HSTSRedirectTest.Redirect (see issue #3336) 2022-08-25 14:09:20 -04:00
Marshall Greenblatt
5dc69c6cdb alloy: Remove optimization/prediction service usage (see issue #3352)
This service is required by the "PermissionOnDeviceNotificationPredictions"
feature which is enabled by default in https://crbug.com/1350956. It uses a
Google backend service as described at https://go.dev/solutions/google/chrome.

This change removes the usage of PredictionBasedPermissionUiSelector, which
triggered this dependency, along with related startup complexity that was added
to support the optimization/prediction service in the M106 update.
2022-08-25 14:09:20 -04:00
Marshall Greenblatt
7659dd60ba Update to Chromium version 106.0.5249.0 (#1036826) 2022-08-25 14:09:20 -04:00
Marshall Greenblatt
6d71f5ffd7 Don't reconnect after intentional browser frame detach (see issue #3260)
Send a FrameDetached message from CefFrameHostImpl::Detach before closing
the RenderFrame connection to avoid an immediate reconnect attempt by the
renderer.

When BFCache is disabled the intentionally detached frame will never be
reconnected. When BFCache is enabled the intentionally detached frame will
be reconnected via CefFrameImpl::OnWasShown if/when it exits the cache.
2022-08-19 12:38:32 -04:00
Marshall Greenblatt
2bf3d536ea Improve logging of frame connection state (see issue #3260)
Run with "--vmodule=frame_*=1 --enable-logging=stderr --no-sandbox" on the
command-line to see these log messages from both the browser and renderer
processes.
2022-08-19 12:38:32 -04:00
Marshall Greenblatt
a7e50dfe7f Fix same-site calculation for saving cookies from intercepted responses
This fixes an issue where authentication cookies from SAML responses were not
being saved.
2022-08-19 12:38:32 -04:00
Marshall Greenblatt
6d98d2c6ed Fix crashes with PrintToPDF (fixes issue #3373)
- Configure the DPI setting (see https://crrev.com/40e28bcba3)
- Call StopWorker on the UI thread (see https://crrev.com/564fa1d8a4)
2022-08-18 12:29:35 -04:00
Marshall Greenblatt
a4b8935427 Add missing newline at end of file 2022-08-16 16:23:27 -04:00
Marshall Greenblatt
7fdbb427bc alloy: Fix flaky OnDraggableRegionsChanged behavior (fixes issue #3374)
Disable BackForwardCache globally for the Alloy runtime so that
blink::RuntimeEnabledFeatures::BackForwardCacheEnables reports the
correct value in the renderer process.
2022-08-11 17:25:36 -04:00
Marshall Greenblatt
e44f76bbe4 Fix DisplayTest.AutoResize failure 2022-08-11 14:49:54 -04:00
Marshall Greenblatt
f8d10289b5 Fix DOMTest failure related to device scaling 2022-08-11 14:20:23 -04:00
Marshall Greenblatt
8908465546 Fix browser focus assignment on mouse click (fixes issue #3306)
DesktopWindowTreeHostWin ("Chrome_WidgetWin_0") focus needs to be set before
the associated call to WebContents::Focus. In the case of mouse click events,
this means ::SetFocus needs to be called explicitly. See updated comments in
CefBrowserPlatformDelegateNativeWin::SetFocus.
2022-08-10 13:52:42 -04:00
Marshall Greenblatt
0ddb572c03 chrome: Add support for CefRequestHandler::OnCertificateError (see issue #3148) 2022-08-09 15:43:00 -04:00
Marshall Greenblatt
7ce139bd2c chrome: cefclient: Fix crash on launch with --enable-chrome-runtime 2022-08-09 15:42:18 -04:00
Marshall Greenblatt
ecb29b7fa5 alloy: Fix OnCertificateError callback for requests redirected to HTTPS (fixes issue #3364)
This change also adds initial unit test coverage for OnCertificateError (see issue #3148).
2022-08-09 13:31:18 -04:00
Jelle Bleyaert
3b90a084b4 Linux: Fix Debug build v8_context_snapshot_generator failure (fixes issue #3371) 2022-08-08 17:13:18 +00:00
Marshall Greenblatt
21d714ab6e Fix issues with browser focus assignment (fixes issue #3306, fixes issue #3116, see issue #3040)
DesktopWindowTreeHostWin ("Chrome_WidgetWin_0") focus needs to be set
synchronously in response to the parent window WM_SETFOCUS message and
before the associated call to WebContents::Focus. See updated comments in
CefBrowserPlatformDelegateNativeWin::SetFocus.
2022-08-05 15:02:27 -04:00
Marshall Greenblatt
9f7a59536c windows: cefclient: Fix crash when triggering IME popup (see issue #3313) 2022-08-04 13:18:17 -04:00
Marshall Greenblatt
18dac30874 Support configuration of the CefTestServer certificate type (see issue #3348) 2022-08-04 12:37:12 -04:00
Marshall Greenblatt
dcd4a0077c Include net test data in the binary distribution (see issue #3348) 2022-08-03 16:28:52 -04:00
Marshall Greenblatt
46e1c4f177 ceftests: Add HSTS redirect test (see issue #3336, see issue #3348) 2022-08-03 12:14:51 -04:00
Marshall Greenblatt
952f2b0829 ceftests: Rename test_server::Observer::OnHttpRequest to OnTestServerRequest (see issue #3348) 2022-08-01 21:14:12 -04:00
Marshall Greenblatt
0b1c3938c6 ceftests: Fix CookieTest failure with --use-test-http-server (see issue #3348) 2022-08-01 21:09:02 -04:00
Marshall Greenblatt
a895274add ceftests: Add test_server support for CefTestServer (see issue #3348) 2022-08-01 16:20:04 -04:00
Marshall Greenblatt
f24dd61329 Add CefTestServer that supports both HTTP and HTTPS (see issue #3348) 2022-08-01 16:20:03 -04:00
Marshall Greenblatt
ce18bb98ab ceftests: Deprecate the use of test_server constants (see issue #3348) 2022-08-01 16:20:03 -04:00
Marshall Greenblatt
a4d63010c9 ceftests: Refactor test_server to support both HTTP and HTTPS servers (see issue #3348) 2022-08-01 16:20:03 -04:00
Marshall Greenblatt
68be2b8938 ceftests: Generalize the test_server::Observer interface (see issue #3348)
Don't expose CefServer implementation details to consumers.
2022-08-01 15:14:13 -04:00
Marshall Greenblatt
8353564d92 Move testonly support for UI input events to libcef_test_support 2022-07-29 20:15:10 -04:00
Marshall Greenblatt
27525523be Change the 'libcef_static' target type from static_library to source_set
Using a source_set here keeps the linker on Windows from discarding exported
compilation units that are not directly called from inside libcef_static.

This may also fix linker errors on Linux due to CEF's use of an intermediate
static library (see https://crbug.com/1319006#c2).
2022-07-29 12:21:21 -04:00
Marshall Greenblatt
bbc08e4f5e Fix minor style issues with request_impl.[cc|h] 2022-07-29 12:14:20 -04:00
Marshall Greenblatt
f148af1bd6 linux: Fix implicit conversion error on ARM [updated] (see https://crbug.com/1292951#c100) 2022-07-27 14:26:35 -04:00
Marshall Greenblatt
654f570b6e windows: Fix Views test failures (fixes issue #3365) 2022-07-27 13:57:53 -04:00
Marshall Greenblatt
a9043f2e80 Replace macros with C++17 features (see issue #3362)
- Convert ALLOW_UNUSED_LOCAL to [[maybe_unused]]
- Convert WARN_UNUSED_RESULT to [[nodiscard]]
2022-07-27 12:52:45 -04:00
Marshall Greenblatt
02d7a758fe linux: Fix implicit conversion error on ARM (see https://crbug.com/1292951#c100) 2022-07-26 13:37:48 -04:00
Marshall Greenblatt
5034749463 patcher: Skip missing platform-specific third-party directories 2022-07-26 13:37:47 -04:00
Marshall Greenblatt
9af494d36c Update to Chromium version 105.0.5195.0 (#1027018) 2022-07-25 23:47:56 -04:00
Marshall Greenblatt
e9f29ab3d6 Update to Chromium version 105.0.5176.0 (#1023155) 2022-07-22 13:31:29 -04:00
Marshall Greenblatt
5e753d211f Run TimeTest.InvalidBaseTimeToTime on Windows only (see issue #2935)
This test is failing on Linux and MacOS.
2022-07-22 13:31:29 -04:00
Marshall Greenblatt
3838536126 windows: Fix warning C4267 conversion from 'size_t' to 'int' (see issue #3126) 2022-07-19 10:09:36 -04:00
Marshall Greenblatt
4aef0ada9d Add missing newline at end of file (see issue #3126) 2022-07-19 10:09:35 -04:00
Marshall Greenblatt
03176b505c cmake: Switch to C++17 language standard (see issue #3362) 2022-07-19 10:09:35 -04:00
Dmitry Azaraev
27d3089804 Add CefBaseTime and use it instead of CefTime (see issue #2935) 2022-07-19 10:09:35 -04:00
Nik Pavlov
987b932a19 Fix compilation errors from shared message unit tests (see issue #3126) 2022-07-19 14:09:10 +00:00
Marshall Greenblatt
ba947d842a alloy: win: Focus the browser after dismissal of a modal dialog (fixes issue #3361) 2022-07-15 14:05:58 +03:00
Marshall Greenblatt
dad9bf87ef Stop using CefStructBase for POD types (fixes issue #3357) 2022-07-14 08:13:29 +00:00
Marshall Greenblatt
71ef10bb60 Don't copy dbghelp.dll/dbgcore.dll from the Windows SDK (fixes issue #3356) 2022-07-13 13:46:15 +03:00
Marshall Greenblatt
06acc9546f Increase frame reconnect timeout to 10 seconds (see issue #3260) 2022-07-13 12:17:19 +03:00
Marshall Greenblatt
cb02c23c32 alloy: Mac: Fix crash related to geolocation permissions (see issue #3352) 2022-07-08 14:37:58 +03:00
Marshall Greenblatt
c49ffa9723 Update libcef_dll_dylib.cc for compiler deduce types 2022-07-08 14:37:58 +03:00
Sergey Markelov
55cb9d9c1f libcef_dll/wrapper: Let the compiler deduce types of func ptr 2022-07-08 11:37:12 +00:00
Marshall Greenblatt
f1003df810 chrome: Add support for OnRequestMediaAccessPermission callback (see issue #2582) 2022-07-08 07:40:35 +00:00
Marshall Greenblatt
e4b9169221 Add CefPermissionHandler callbacks for permission prompts (see issue #3352) 2022-07-07 10:01:24 +00:00
Nik Pavlov
81e892d19e Add a shared memory variant of CefProcessMessage (fixes issue #3126)
CefSharedProcessMessageBuilder supports creation of a CefProcessMessage
backed by a CefSharedMemoryRegion.

Performance tests comparing the existing ArgumentList approach and the new
SharedMemoryRegion approach have been added to cefclient at
http://tests/ipc_performance.

CefMessageRouter has been updated to use SharedMemoryRegion as transport
for larger message payloads. The threshold is configurable via
|CefMessageRouterConfig.message_size_threshold|.

To test:
run `ceftests --gtest_filter=SendSharedProcessMessageTest.*:SharedProcessMessageTest.*:MessageRouterTest.Threshold*`
2022-07-04 09:49:15 +00:00
Jelle Bleyaert
a931d49f3e Fix duplicate symbol error on MakeVisibleOnScreenRect (fixes issue #3353) 2022-07-01 14:15:22 +00:00
Marshall Greenblatt
daa89115d5 Add OnMediaAccessChange notification (fixes issue #3310) 2022-06-30 12:22:28 +00:00
Nik Pavlov
0c6c44ba0b Use nothrow new when allocating memory for zip file data 2022-06-30 07:32:03 +00:00
Marshall Greenblatt
26e30b3859 Add CefPermissionHandler callback for media access (fixes issue #2582) 2022-06-30 07:31:18 +00:00
Nik Pavlov
d3a2237a5a alloy: mac: Fix default popup window positioning (see issue #3244)
Popup windows will be created on the display that best matches the requested
coordinates. The requested size will apply to the content area (as required by
JS documentation) and window size will be reduced if necessary to fit within the
target display. The requested origin will apply to the window (including frame)
and will be modified if necessary so that the window is fully visible on the
target display.

This change does not implement popup positioning for cefclient which uses an
application-created parent window.

This change grants access to the getScreenDetails JS API without user prompt.
2022-06-27 10:29:16 +00:00
Marshall Greenblatt
1ca4961b27 Windows: Fix AssertBlockingAllowed failure in GetAzureADJoinStateStorage (fixes issue #3342) 2022-06-23 13:59:09 +03:00
Marshall Greenblatt
95373bb042 Windows: Fix unresolved symbol for cef_sandbox build 2022-06-23 11:20:39 +03:00
Marshall Greenblatt
ec8076536e Fix timing issue with OnDraggableRegionsChanged
When bfcache is disabled use the RenderFrameObserver::DidFinishLoad notification
instead of the DidStopLoading notification that originates from the browser
process. During fast navigation the DidStopLoading notification may arrive in
the renderer after a new navigation has commenced and cause the wrong regions to
be reported.
2022-06-22 18:57:52 +03:00
Marshall Greenblatt
100b457743 Windows: Fix time_win.cc compile error with cef_sandbox 2022-06-22 11:17:06 +03:00
Marshall Greenblatt
c7ea0c5958 Update to Chromium version 104.0.5112.0 (#1012729)
- Mac: 10.13 is now the minimum required macOS version
2022-06-22 10:56:35 +03:00
Marshall Greenblatt
35654cd709 alloy: Use Chrome JS dialogs on Windows/Linux (fixes issue #3316) 2022-06-03 22:45:23 +03:00
Marshall Greenblatt
b5eba89598 cefclient: Linux: Fix OSR context menu placement (see issue #2640)
This only fixes the top-level menu placement. Sub-menus are still
placed incorrectly.
2022-06-03 22:45:10 +03:00
JohnKarel
d9b764860a alloy: Add touch handle and quick menu support for OSR (fixes issue #3268)
The client is responsible for rendering both as no default implementation
is currently available for OSR.
2022-05-30 10:51:39 +03:00
Marshall Greenblatt
771e5c7c0c ceftests: Replace unicode characters with encoded equivalent 2022-05-30 10:26:12 +03:00
Marshall Greenblatt
464efb1162 Call OnResourceRedirect for internal network service redirects (fixes issue #3336) 2022-05-25 16:43:30 +03:00
Marshall Greenblatt
ee15eca351 ceftests: Minor code cleanup 2022-05-25 16:42:41 +03:00
Marshall Greenblatt
cb83a7c3fd Windows: Fix time_win.cc compile error with cef_sandbox 2022-05-23 11:10:44 +03:00
Marshall Greenblatt
332d7f4ee1 patcher: Output actual executable name in error message 2022-05-20 19:39:32 +03:00
Marshall Greenblatt
bf168174d0 Set v8_enable_sandbox=false to avoid CefV8Value::CreateArrayBuffer crash (see issue #3332) 2022-05-20 19:39:32 +03:00
Marshall Greenblatt
185a908811 Update to Chromium version 103.0.5060.0 (#1002911) 2022-05-20 19:39:32 +03:00
Marshall Greenblatt
7a372a642b alloy: Use Views context menus on Windows/Linux (fixes issue #3330) 2022-05-20 14:15:17 +03:00
Marshall Greenblatt
2dcee2ccfc alloy: Disable ProxyErrorClient callbacks when extensions are disabled (fixes issue #2830) 2022-05-13 12:05:06 +03:00
Marshall Greenblatt
7702d96b33 Fix type conversion warning with GCC 10 (fixes issue #3324) 2022-04-28 16:40:49 -04:00
Marshall Greenblatt
b62dd2b6ee Update to Chromium version 102.0.5005.0 (#992738)
Linux: 32-bit x86 builds are no longer supported (see issue #2676).
2022-04-28 16:38:50 -04:00
Marshall Greenblatt
916360e2e5 Update to Chromium version 102.0.4997.0 (#990845)
- Windows: SDK version 10.0.20348.0 is now required.
- MacOS: SDK version 12.3 (Xcode 13.3) is now required.
- Legacy swiftshader binaries (`swiftshader/*` on Win/Linux and
  `libswiftshader_*.dylib` on MacOS) have been removed (see issue #3176).
2022-04-26 16:32:20 -04:00
Marshall Greenblatt
b318adddac Don't override Accept-Language header if set by the client (fixes issue #3139) 2022-04-20 14:49:21 -04:00
Marshall Greenblatt
c1b06ccee8 alloy: Delay creation of CefComponentExtensionResourceManager (see issue #3314)
This was causing early access to ResourceBundle on the main thread (via
webui::GetFontFamily) which resulted in crashes on Linux when running
with multi-threaded-message-loop.
2022-04-19 18:52:27 -04:00
Marshall Greenblatt
c04895b222 chrome: Implement GetWindowHandle() for --multi-threaded-message-loop (see issue #3294) 2022-04-19 18:52:26 -04:00
Marshall Greenblatt
2ea7459a89 Use Chrome file dialogs on all platforms and runtimes (fixes issue #3314)
All file dialogs irrespective of source, platform and runtime will now be
routed through CefFileDialogManager and trigger CefDialogHandler callbacks
(see issue #3293).

Adds Chrome runtime support for CefBrowserHost::RunFileDialog and
CefDialogHandler callbacks.

Adds Alloy runtime support for internal GTK file and print dialogs on Linux
subject to the following limitations:

1. Internal GTK implementation:
   - Cannot be used with multi-threaded-message-loop because Chromium's
     internal GTK implementation is not thread-safe (does not use GDK threads).
   - Dialogs will not be modal to application windows when used with off-screen
     rendering due to lack of access to the client's top-level GtkWindow.
2. Cefclient CefDialogHandler implementation:
   - Cannot be used with Views because it requires a top-level GtkWindow.

Due to the above limitations no dialog implementation is currently provided for
Views + multi-threaded-message-loop on Linux. In cases where both
implementations are supported the cefclient version is now behind an optional
`--use-client-dialogs` command-line flag.

Expressly forbids multiple simultaneous file dialogs with the internal platform
implementation which uses modal dialogs. CefDialogHandler will still be notified
and can optionally handle each request without a modal dialog (see issue #3154).

Removes some RunFileDialog parameters that are not supported by the Chrome file
dialog implementation (selected_accept_filter parameter, cef_file_dialog_mode_t
overwrite/read-only flags).
2022-04-19 18:52:26 -04:00
Nik Pavlov
edef01f579 Fix devtools_util_unittest.cc failures 2022-04-19 16:17:16 +00:00
Marshall Greenblatt
b1cd9d1598 win/linux: Use CursorLoader for loading cursor resources (see issue #3270)
Switch to using aura::CursorLoader which knows how to load system, non-system
and pak cursor resources.

On Windows, cursors will be loaded via LoadCursor first if available with a
fallback to pak file if necessary (like with component builds).

On Linux, all non-system cursor resources will be loaded from pak file. Cursors
may be loaded asynchronously resulting in the default (pointer) cursor being
returned on the first request.
2022-04-14 20:21:21 -04:00
Joshua Marler
d6b2b4b144 views: Fix ConvertPointFromPixel for fractional scaling (fixes issue #3312) 2022-04-14 22:30:32 +00:00
Marshall Greenblatt
cbf66a8077 views: Fix crash when clicking a draggable region (fixes issue #3311) 2022-04-14 15:12:23 -04:00
Marshall Greenblatt
fc82de7aa7 alloy: win: Fix range check for system cursors (fixes issue #3270) 2022-04-14 14:06:58 -04:00
Marshall Greenblatt
111b6de46c Fix cursor change notification for OOP iframes (fixes issue #3308) 2022-04-13 20:31:27 -04:00
maikesiwu
512e588e40 Use Uint32::NewFromUnsigned for unsigned values 2022-04-13 19:07:31 +00:00
Marshall Greenblatt
4921dc2213 Fix unintentional state transfer in DetachToUserFree (fixes issue #3309)
Calling DetachToUserFree() on a CefString holding a reference should copy the
value instead of transferring ownership.

A new `StringTest.Ownership` test has been added for this behavior.
2022-04-13 14:33:25 -04:00
Marshall Greenblatt
d8db6fa9da mac: cefclient: Use RootWindowManager to track key window status (fixes issue #3307)
This change provides a generic solution for active (key) window tracking that
works with both Views-hosted and native windows on MacOS. With this new approach
we can now successfully route top menu actions to the currently active window.

Prior to this change CEF's Views API was using focus notifications as a proxy
for window activation notifications. That doesn't work on MacOS where NSWindow
activation (key status) is independent of NSView focus (first responder) status,
and changes in activation don't necessarily generate focus notifications (see
NativeWidgetMac::OnWindowKeyStatusChanged). To make this work reliably on all
platforms we now expose a CefWindowDelegate::OnWindowActivationChanged callback.

This change also fixes an uninitialized variable
(RootWindowMacImpl::with_extension_) that was causing flaky behavior in
RootWindowManager::OnRootWindowActivated.

To test:
1. Run `cefclient [--use-views]`
2. Select Popup Window from the Tests menu. Do not explicitly activate the popup
   window (e.g. don't click on it).
3. Verify that further Tests menu actions go to the popup window.
4. Change activation to a first window by clicking on it. Verify that Test
   menu actions go to that window.
5. Close the currently active window. Do not explicitly activate the remaining
   window (e.g. don't click on it).
6. Verify that Test menu actions go to the only remaining window.
2022-04-12 16:37:01 -04:00
Nik Pavlov
493232ce5a alloy: mac: Fix default popup window positioning (see issue #3244)
Popup windows will be created on the display that best matches the requested
coordinates. The requested size will apply to the content area (as required by
JS documentation) and window size will be reduced if necessary to fit within the
target display. The requested origin will apply to the window (including frame)
and will be modified if necessary so that the window is fully visible on the
target display.
2022-04-12 17:12:16 +00:00
Marshall Greenblatt
17cb26b8b9 Remove compile-time checks for toolkit_views
The toolkit_views=true setting is supported (and now required) on all platforms.
2022-04-12 12:06:53 -04:00
Marshall Greenblatt
a0a7a35fe2 chrome: Change popup default behavior with native parent (see issue #3294)
When using a Views-hosted browser window the client receives Views-related
callbacks for popups and can thereby customize the Views-hosted popup behavior.
When using an external parent window no Views-related callbacks are delivered
and customization options are restricted to providing a new parent handle via
OnBeforePopup. Consequently, we should default to a normal browser window in
the external parent case instead of the very minimial Views-hosted default.

To test (A):
1. Run `cefclient --use-default-popup --enable-chrome-runtime --use-native`
2. Select Tests > Popup Window
3. Get a normal Chrome browser window

To test (B):
1. Run `cefclient --use-default-popup [--enable-chrome-runtime] [--use-views]`
2. Select Tests > Popup Window
3. Get a native or Views-hosted browser window with title bar only
2022-04-12 12:06:52 -04:00
Marshall Greenblatt
75ca552a4e cefclient: Add option to create default popups (see issue #3165, see issue #3294)
This change adds a `--use-default-popup` command-line option to cefclient. When
specified, popup windows will be created with default styling (e.g. without an
application-provided native parent window).

This change also adds some reasonable default window bounds in cases where they
are not specified by the client.
2022-04-12 11:49:27 -04:00
Marshall Greenblatt
3000bc8748 chrome: win/linux: Add support for browser with native parent (see issue #3294)
This change adds Chrome runtime support on Windows and Linux for creating a
browser parented to a native window supplied by the client application.
Expected API usage and window behavior is similar to what already exists with
the Alloy runtime. The parent window handle should be specified by using
CefWindowInfo::SetAsChild in combination with the CefBrowserHost::CreateBrowser
and CefLifeSpanHandler::OnBeforePopup callbacks.

The previously existing behavior of creating a fully-featured Chrome browser
window when empty CefWindowInfo is used with CreateBrowser remains unchanged
and Views is still the preferred API for creating top-level Chrome windows
with custom styling (e.g. title bar only, frameless, etc).

The cefclient Popup Window test with a native parent window continues to crash
on Linux with both the Alloy and Chrome runtimes (see issue #3165).

Also adds Chrome runtime support for CefDisplayHandler::OnCursorChange.

To test:
- Run `cefclient --enable-chrome-runtime [--use-views]` for the default (and
  previously existing) Views-based behavior.
- Run `cefclient --enable-chrome-runtime --use-native` for the new native
  parent window behavior.
- Run `cefclient --enable-chrome-runtime --use-native --no-activate` and the
  window will not be activated (take input focus) on launch (Windows only).
- Run `cefclient --enable-chrome-runtime [--use-views|--use-native]
  --mouse-cursor-change-disabled` and the mouse cursor will not change on
  mouseover of DOM elements.
2022-04-12 11:49:26 -04:00
Marshall Greenblatt
5f4bccd672 Fix dismissal of select popups on NotifyMoveOrResizeStarted (see issue #3294)
This impacts both Alloy and Chrome runtimes when using a native parent window.
2022-04-11 13:11:08 -04:00
Marshall Greenblatt
0428438e72 mac/linux: Use python3 for .sh scripts
Newer OS versions no longer ship with Python 2 by default.
2022-04-08 11:38:12 -04:00
Marshall Greenblatt
21cf732e7f chrome: Update expectations with same-site BFCache enabled (fixes issue #3301)
With same-site BFCache enabled every navigation can now potentially be served
via the BFCache. To support this internally a new top-level RenderFrame object
may be created for each new navigation. As a result, OnBrowserCreated may now
be called multiple times with the same browser ID in a given renderer process
(a behavior previously only seen with cross-site navigations and different
renderer processes).

BFCache navigations do not trigger the same Chromium notifications as a normal
load. To avoid breaking CEF API usage expectations we now synthetically
generate the load-related callbacks that would otherwise be missing
(OnLoadingStateChange with isLoading=true, OnLoadStart, OnLoadEnd). The
|httpStatusCode| argument to OnLoadEnd will be 0 in this case.

To test:
- Run `FrameHandlerTest.*:MessageRouterTest.*:NavigationTest.*`
- Run `NavigationTest.LoadSameOriginLoadURL` for OnBrowserCreated behavior.
- Run `NavigationTest.History` for load-related callback behavior.
2022-04-05 15:30:30 -04:00
Marshall Greenblatt
a3b1dc01ea Set dcheck_always_on=false for cef_sandbox Release builds (fixes issue #3302) 2022-03-31 16:16:48 -04:00
Marshall Greenblatt
b524edc209 Update to Chromium version 101.0.4951.0 (#982481)
Known issues:
- chrome: Some ceftests are failing due to bfcache same-site enabled by default
  (see issue #3301)
2022-03-30 19:54:09 -04:00
Marshall Greenblatt
77466e7b6d alloy: Use chrome's value for ApplicationClientIdForFileScanning (fixes issue #3030)
This change removes CefSettings.application_client_id_for_file_scanning in
favor of always using the same hard-coded value as chrome.
2022-03-24 12:16:11 -04:00
Marshall Greenblatt
e43d2054d1 Increase priority of the EndTracing task (fixes issue #3288)
Use a priority that is guaranteed to execute in a reasonable amount of time.
2022-03-23 17:31:09 -04:00
Marshall Greenblatt
9d52d72ae5 chrome: Add support for persist_session_cookies (fixes issue #3291)
This change configures session restore behavior for the NEXT application
restart by setting the "session.restore_on_startup" preference based on the
[CefSettings|CefRequestContextSettings].persist_session_cookies value.
2022-03-22 20:49:20 -04:00
Marshall Greenblatt
5ec45e5f7f patcher: Improve error message for failed patches 2022-03-22 19:10:36 -04:00
Marshall Greenblatt
6d7a680187 Add permission callback for user-initated downloads (fixes issue #3183)
This change adds a CefDownloadHandler::CanDownload callback for optionally
blocking user-initiated downloads (e.g. alt + link click or link click that
returns a `Content-Disposition: attachment` response from the server).

To test:
- Run `ceftests --gtest_filter=DownloadTest.*`.
- Run `cefclient --hide-controls`. User-initiated downloads will be blocked.
2022-03-22 17:46:44 -04:00
Marshall Greenblatt
2f5838eaaa chrome: Add ability to handle chrome menu/keyboard commands (fixes issue #3280)
This change adds a CefCommandHandler::OnChromeCommand callback for optionally
handling Chrome commands triggered via menus or keyboard shortcuts. Supported
command IDs are listed in a new cef_command_ids.h header file.

To test: Run `cefclient --enable-chrome-runtime --hide-controls`. Most commands
will blocked and removed from context menus.
2022-03-22 15:11:47 -04:00
Marshall Greenblatt
13ca38e4e0 chrome: Fix assertions when showing the incognito data dialog
This dialog is displayed by (for example) pressing ctrl+h to open the history
page while in incognito mode.
2022-03-22 12:39:17 -04:00
Marshall Greenblatt
4615fffafb chrome: Add setting for controlling the status bubble (fixes isse #3279)
This change adds `CefBrowserSettings.chrome_status_bubble` for controlling
whether the Chrome status bubble will be used.

Testable in cefclient by passing the `--hide-chrome-status-bubble`
command-line flag.
2022-03-21 17:25:40 -04:00
Marshall Greenblatt
1eab4322f8 crash_server: Fix assertion when downloading files with larger chunk sizes 2022-03-18 15:10:57 -04:00
Marshall Greenblatt
c38d62b233 Linux: Migrate from breakpad to crashpad (see issue #3249)
Renderer process crashes are currently only reported with `--no-sandbox`.
2022-03-17 15:34:49 -04:00
Marshall Greenblatt
8fc6aced6c Fix DevTools crash due to unknown .md mime type (fixes issue #3278) 2022-03-15 13:06:58 -04:00
Marshall Greenblatt
3474e7abc1 chrome: Fix shutdown crashes with multi-threaded-message-loop (fixes issue #3277) 2022-03-09 15:12:24 -05:00
Marshall Greenblatt
a513e01b01 Fix shutdown crash in RenderProcessHostImpl::Cleanup (fixes issue #3276)
Execute all pending UI thread tasks at the beginning of the shutdown sequence.
2022-03-09 13:59:07 -05:00
Marshall Greenblatt
113a96be0d alloy: Fix PDF download 'With your changes' (fixes issue #3169) 2022-03-04 13:56:30 -05:00
Marshall Greenblatt
705b6ec15c alloy: Fix print preview Save as PDF (fixes issue #2867) 2022-03-04 13:15:20 -05:00
Cristian Amarie
7945baf640 alloy: Fix crash when downloading a modified PDF form (see issue #3169)
Create a CefFileSystemDelegate based on the ShellFileSystemDelegate placeholder
implementation. An actual implementation will still be required to properly
support this download functionality.
2022-03-02 15:16:09 -05:00
Jelle Bleyaert
3c2e97d82e Adding ClearFilenames method to CefDragData (fixes issue #3266) 2022-03-02 19:44:16 +00:00
Jupiter
0cb874c9e1 Update link to Chromium C++ style guide in README 2022-03-01 18:13:57 -05:00
Marshall Greenblatt
fcf5dd036d Fix typo in cef_audio_handler.h 2022-03-01 18:13:56 -05:00
Hunter Laux
477ab61e3b Fix std::result_of deprecation error in C++17 (fixes issue #3194) 2022-02-24 17:34:10 +00:00
2143 changed files with 109214 additions and 76997 deletions

35
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@@ -0,0 +1,35 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen and what happened instead.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Versions (please complete the following information):**
- OS: [e.g. Windows 10, MacOS 13.2, Ubuntu 22.10]
- CEF Version: [e.g. 111.2.2]
**Additional context**
Does the problem reproduce with the cefclient or cefsimple sample application at the same version?
Does the problem reproduce with Google Chrome at the same version?
Add any other context about the problem here.

View File

@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

1
.gitignore vendored
View File

@@ -51,6 +51,5 @@ Thumbs.db
/binary_distrib
/docs
# CEF generated files
/include/cef_config.h
/include/cef_version.h
.ccls-cache/

1004
BUILD.gn

File diff suppressed because it is too large Load Diff

View File

@@ -7,6 +7,6 @@
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
{
'chromium_checkout': 'refs/tags/100.0.4896.127',
'depot_tools_checkout': '32645dfee9'
'chromium_checkout': 'refs/tags/130.0.6723.117',
'depot_tools_checkout': 'c22f4dc74f'
}

View File

@@ -27,23 +27,11 @@
# Files in the chromium/src directory that should be evaluated for changes.
# Similar changes may need to be applied to the CEF source code.
'files': [
'chrome/browser/browser_process.h',
'chrome/browser/extensions/api/tabs/tabs_api.*',
'chrome/browser/extensions/chrome_component_extension_resource_manager.*',
'chrome/browser/extensions/chrome_extension_web_contents_observer.*',
'chrome/browser/extensions/component_loader.*',
'chrome/browser/extensions/extension_service.*',
'chrome/browser/printing/print_view_manager*',
'chrome/browser/printing/printing_message_filter*',
'chrome/browser/profiles/profile.h',
'chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.*',
'chrome/common/extensions/api/*_features.json',
'chrome/renderer/chrome_content_renderer_client.*',
'chrome/renderer/extensions/chrome_extensions_renderer_client.*',
'components/content_settings/core/common/content_settings_types.mojom',
'components/permissions/request_type.h',
'content/browser/renderer_host/render_widget_host_view_base.*',
'content/public/browser/content_browser_client.*',
'content/public/browser/render_widget_host_view.h',
'content/public/browser/storage_partition.h',
'content/public/browser/web_contents_delegate.h',
'content/public/common/content_features.cc',
'content/shell/BUILD.gn',

View File

@@ -12,8 +12,8 @@
# distribution include:
#
# Linux: Ninja, GCC 7.5.0+, Unix Makefiles
# MacOS: Ninja, Xcode 12.2 to 13.0
# Windows: Ninja, Visual Studio 2019+
# MacOS: Ninja, Xcode 12.2 to 15.0
# Windows: Ninja, Visual Studio 2022
#
# Ninja is a cross-platform open-source tool for running fast builds using
# pre-installed platform toolchains (GNU, clang, Xcode or MSVC). It can be
@@ -36,7 +36,7 @@
#
# The below requirements must be met to build this CEF binary distribution.
#
# - CMake version 3.19 or newer.
# - CMake version 3.21 or newer.
#
# - Linux requirements:
# Currently supported distributions include Debian 10 (Buster), Ubuntu 18
@@ -48,15 +48,14 @@
# libgtk3.0-dev (required by the cefclient target only)
#
# - MacOS requirements:
# Xcode 12.2 to 13.0 building on MacOS 10.15.4 (Catalina) or newer. Only
# 64-bit builds are supported. The Xcode command-line tools must also be
# installed. Newer Xcode versions may not have been been tested and are not
# recommended.
# Xcode 12.2 to 15.4 building on MacOS 11.0 (Big Sur) or newer. The Xcode
# command-line tools must also be installed. Newer Xcode versions may not have
# been been tested and are not recommended.
#
# - Windows requirements:
# Visual Studio 2019 or newer building on Windows 7 or newer. Windows 10
# 64-bit is recommended. Newer versions will likely also work but may not have
# been tested.
# Visual Studio 2022 building on Windows 10 or newer. Windows 10/11 64-bit is
# recommended. Newer versions will likely also work but may not have been
# tested.
#
# BUILD EXAMPLES
#
@@ -96,35 +95,35 @@
# > ninja cefclient cefsimple
#
# To perform a Windows build using a 32-bit CEF binary distribution:
# Using the Visual Studio 2019 IDE:
# > cmake -G "Visual Studio 16" -A Win32 ..
# Using the Visual Studio 2022 IDE:
# > cmake -G "Visual Studio 17" -A Win32 ..
# Open build\cef.sln in Visual Studio and select Build > Build Solution.
#
# Using Ninja with Visual Studio 2019 command-line tools:
# Using Ninja with Visual Studio 2022 command-line tools:
# (this path may be different depending on your Visual Studio installation)
# > "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars32.bat"
# > "C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvars32.bat"
# > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
# > ninja cefclient cefsimple
#
# To perform a Windows build using a 64-bit CEF binary distribution:
# Using the Visual Studio 2019 IDE:
# > cmake -G "Visual Studio 16" -A x64 ..
# Using the Visual Studio 2022 IDE:
# > cmake -G "Visual Studio 17" -A x64 ..
# Open build\cef.sln in Visual Studio and select Build > Build Solution.
#
# Using Ninja with Visual Studio 2019 command-line tools:
# Using Ninja with Visual Studio 2022 command-line tools:
# (this path may be different depending on your Visual Studio installation)
# > "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat"
# > "C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvars64.bat"
# > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
# > ninja cefclient cefsimple
#
# To perform a Windows build using an ARM64 CEF binary distribution:
# Using the Visual Studio 2019 IDE:
# > cmake -G "Visual Studio 16" -A arm64 ..
# Using the Visual Studio 2022 IDE:
# > cmake -G "Visual Studio 17" -A arm64 ..
# Open build\cef.sln in Visual Studio and select Build > Build Solution.
#
# Using Ninja with Visual Studio 2019 command-line tools:
# Using Ninja with Visual Studio 2022 command-line tools:
# (this path may be different depending on your Visual Studio installation)
# > "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsamd64_arm64.bat"
# > "C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvarsamd64_arm64.bat"
# > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
# > ninja cefsimple
@@ -132,8 +131,8 @@
# Global setup.
#
# For VS2019 and Xcode 12+ support.
cmake_minimum_required(VERSION 3.19)
# For VS2022 and Xcode 12+ support.
cmake_minimum_required(VERSION 3.21)
# Only generate Debug and Release configuration types.
set(CMAKE_CONFIGURATION_TYPES Debug Release)
@@ -143,7 +142,7 @@ set(CMAKE_CONFIGURATION_TYPES Debug Release)
project(cef)
# Use folders in the resulting project files.
set_property(GLOBAL PROPERTY OS_FOLDERS ON)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
#
@@ -234,3 +233,24 @@ endif()
# Display configuration settings.
PRINT_CEF_CONFIG()
#
# Define the API documentation target.
#
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile")
find_package(Doxygen)
if(DOXYGEN_FOUND)
add_custom_target(apidocs ALL
# Generate documentation in the docs/html directory.
COMMAND "${DOXYGEN_EXECUTABLE}" Doxyfile
# Write a docs/index.html file.
COMMAND ${CMAKE_COMMAND} -E echo "<html><head><meta http-equiv=\"refresh\" content=\"0;URL='html/index.html'\"/></head></html>" > docs/index.html
WORKING_DIRECTORY "${CEF_ROOT}"
COMMENT "Generating API documentation with Doxygen..."
VERBATIM )
else()
message(WARNING "Doxygen must be installed to generate API documentation.")
endif()
endif()

2782
Doxyfile Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -9,8 +9,8 @@ The Chromium Embedded Framework (CEF) is a simple framework for embedding Chromi
* Branches and Building - https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
* Announcements - https://groups.google.com/forum/#!forum/cef-announce
* Support Forum - http://www.magpcss.org/ceforum/
* CEF1 C++ API Docs - http://magpcss.org/ceforum/apidocs/
* CEF3 C++ API Docs - http://magpcss.org/ceforum/apidocs3/
* Issue Tracker - https://github.com/chromiumembedded/cef/issues
* C++ API Docs - [Stable release docs](https://cef-builds.spotifycdn.com/docs/stable.html) / [Beta release docs](https://cef-builds.spotifycdn.com/docs/beta.html)
* Downloads - https://cef-builds.spotifycdn.com/index.html
* Donations - http://www.magpcss.org/ceforum/donate.php
@@ -29,7 +29,7 @@ Numerous individuals and organizations contribute time and resources to support
# Getting Started
Users new to CEF development should start by reading the [Tutorial](https://bitbucket.org/chromiumembedded/cef/wiki/Tutorial) Wiki page for an overview of CEF usage and then proceed to the [GeneralUsage](https://bitbucket.org/chromiumembedded/cef/wiki/GeneralUsage) Wiki page for a more in-depth discussion or architectural and usage issues. Complete API documentation is available [here](http://magpcss.org/ceforum/apidocs3/). CEF support and related discussion is available on the [CEF Forum](http://www.magpcss.org/ceforum/).
Users new to CEF development should start by reading the [Tutorial](https://bitbucket.org/chromiumembedded/cef/wiki/Tutorial) Wiki page for an overview of CEF usage and then proceed to the [GeneralUsage](https://bitbucket.org/chromiumembedded/cef/wiki/GeneralUsage) Wiki page for a more in-depth discussion or architectural and usage issues. Complete API documentation is available [here](https://cef-builds.spotifycdn.com/docs/stable.html). CEF support and related discussion is available on the [CEF Forum](http://www.magpcss.org/ceforum/).
# Binary Distributions
@@ -49,6 +49,7 @@ The base CEF framework includes support for the C and C++ programming languages.
* Delphi - https://github.com/hgourvest/dcef3
* Delphi - https://github.com/salvadordf/CEF4Delphi
* Go - https://github.com/CzarekTomczak/cef2go
* Go - https://github.com/energye/energy
* Java - https://bitbucket.org/chromiumembedded/java-cef
* Python - http://code.google.com/p/cefpython/
@@ -58,7 +59,7 @@ If you're the maintainer of a project not listed above and would like your proje
CEF is still very much a work in progress. Some ways that you can help out:
\- Vote for issues in the [CEF issue tracker](https://bitbucket.org/chromiumembedded/cef/issues?status=new&status=open) that are important to you. This helps with development prioritization.
\- Vote for issues in the [CEF issue tracker](https://github.com/chromiumembedded/cef/issues) that are important to you. This helps with development prioritization.
\- Report any bugs that you find or feature requests that are important to you. Make sure to first search for existing issues before creating new ones. Please use the [CEF Forum](http://magpcss.org/ceforum) and not the issue tracker for usage questions. Each CEF issue should:
@@ -69,7 +70,7 @@ CEF is still very much a work in progress. Some ways that you can help out:
\- Write unit tests for new or existing functionality.
\- Pull requests and patches are welcome. View open issues in the [CEF issue tracker](https://bitbucket.org/chromiumembedded/cef/issues?status=new&status=open) or search for TODO(cef) in the source code for ideas.
\- Pull requests and patches are welcome. View open issues in the [CEF issue tracker](https://github.com/chromiumembedded/cef/issues) or search for TODO(cef) in the source code for ideas.
If you would like to contribute source code changes to CEF please follow the below guidelines:
@@ -78,6 +79,6 @@ If you would like to contribute source code changes to CEF please follow the bel
\- Submit a [pull request](https://bitbucket.org/chromiumembedded/cef/wiki/ContributingWithGit) or create a patch with your changes and attach it to the CEF issue. Changes should:
* Be submitted against the current [CEF master branch](https://bitbucket.org/chromiumembedded/cef/src/?at=master) unless explicitly fixing a bug in a CEF release branch.
* Follow the style of existing CEF source files. In general CEF uses the [Chromium coding style](http://www.chromium.org/developers/coding-style).
* Follow the style of existing CEF source files. In general CEF uses the [Chromium C++ style guide](https://chromium.googlesource.com/chromium/src/+/master/styleguide/c++/c++.md).
* Include new or modified unit tests as appropriate to the functionality.
* Not include unnecessary or unrelated changes.

8
bazel/BUILD.bazel Normal file
View File

@@ -0,0 +1,8 @@
# Copyright (c) 2024 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
# Allow access from targets in other packages.
package(default_visibility = [
"//visibility:public",
])

65
bazel/copy_filegroups.bzl Normal file
View File

@@ -0,0 +1,65 @@
# Copyright (c) 2024 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
def _copy_filegroups_impl(ctx):
inputs = ctx.files.filegroups
remove_prefixes = ctx.attr.remove_prefixes
add_prefix = ctx.attr.add_prefix
outputs = []
for f in inputs:
relative_path = f.path
if relative_path.startswith("external/"):
# Remove the "external/<repo>" component, if any.
relative_path = "/".join(relative_path.split("/")[2:])
for prefix in remove_prefixes:
# Add trailing forward slash if necessary.
if prefix[-1] != "/":
prefix += "/"
if len(prefix) > 0 and relative_path.startswith(prefix):
relative_path = relative_path[len(prefix):]
break
if len(add_prefix) > 0:
# Add trailing forward slash if necessary.
if add_prefix[-1] != "/":
add_prefix += "/"
relative_path = add_prefix + relative_path
out = ctx.actions.declare_file(relative_path)
outputs.append(out)
if relative_path.find("/") > 0:
command="mkdir -p $(dirname {}) && cp {} {}".format(out.path, f.path, out.path)
else:
command="cp {} {}".format(f.path, out.path)
ctx.actions.run_shell(
outputs=[out],
inputs=depset([f]),
command=command
)
# Small sanity check
if len(inputs) != len(outputs):
fail("Output count should be 1-to-1 with input count.")
return DefaultInfo(
files=depset(outputs),
runfiles=ctx.runfiles(files=outputs)
)
# Allows the file contents of |filegroups| to be copied next to a cc_binary
# target via the |data| attribute.
# Implementation based on https://stackoverflow.com/a/57983629
copy_filegroups = rule(
implementation=_copy_filegroups_impl,
attrs={
"filegroups": attr.label_list(),
"remove_prefixes": attr.string_list(default = []),
"add_prefix": attr.string(default = ""),
},
)

90
bazel/library_helpers.bzl Normal file
View File

@@ -0,0 +1,90 @@
# Copyright (c) 2024 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
load("//bazel/win:variables.bzl",
WIN_COMMON_COPTS="COMMON_COPTS",
WIN_COMMON_COPTS_RELEASE="COMMON_COPTS_RELEASE",
WIN_COMMON_COPTS_DEBUG="COMMON_COPTS_DEBUG",
WIN_COMMON_DEFINES="COMMON_DEFINES",
WIN_COMMON_DEFINES_RELEASE="COMMON_DEFINES_RELEASE",
WIN_COMMON_DEFINES_DEBUG="COMMON_DEFINES_DEBUG")
load("//bazel/linux:variables.bzl",
LINUX_COMMON_COPTS="COMMON_COPTS",
LINUX_COMMON_COPTS_RELEASE="COMMON_COPTS_RELEASE",
LINUX_COMMON_COPTS_DEBUG="COMMON_COPTS_DEBUG",
LINUX_COMMON_DEFINES="COMMON_DEFINES",
LINUX_COMMON_DEFINES_RELEASE="COMMON_DEFINES_RELEASE",
LINUX_COMMON_DEFINES_DEBUG="COMMON_DEFINES_DEBUG")
load("//bazel/mac:variables.bzl",
MAC_COMMON_COPTS="COMMON_COPTS",
MAC_COMMON_COPTS_RELEASE="COMMON_COPTS_RELEASE",
MAC_COMMON_COPTS_DEBUG="COMMON_COPTS_DEBUG")
load("@rules_cc//cc:defs.bzl", "cc_library", "objc_library")
def declare_cc_library(copts=[], local_defines=[], **kwargs):
"""
cc_library wrapper that applies common copts and local_defines.
"""
# NOTE: objc_library does not support local_defines on MacOS, so on
# that platform we put the defines in copts instead.
cc_library(
copts = select({
"@platforms//os:windows": WIN_COMMON_COPTS,
"@platforms//os:linux": LINUX_COMMON_COPTS,
"@platforms//os:macos": MAC_COMMON_COPTS,
"//conditions:default": None,
}) + select({
"@cef//:windows_opt": WIN_COMMON_COPTS_RELEASE,
"@cef//:windows_dbg": WIN_COMMON_COPTS_DEBUG,
"@cef//:windows_fastbuild": WIN_COMMON_COPTS_RELEASE,
"@cef//:linux_opt": LINUX_COMMON_COPTS_RELEASE,
"@cef//:linux_dbg": LINUX_COMMON_COPTS_DEBUG,
"@cef//:linux_fastbuild": LINUX_COMMON_COPTS_RELEASE,
"@cef//:macos_opt": MAC_COMMON_COPTS_RELEASE,
"@cef//:macos_dbg": MAC_COMMON_COPTS_DEBUG,
"@cef//:macos_fastbuild": MAC_COMMON_COPTS_RELEASE,
"//conditions:default": None,
}) + copts,
local_defines = select({
"@platforms//os:windows": WIN_COMMON_DEFINES,
"@platforms//os:linux": LINUX_COMMON_DEFINES,
"//conditions:default": None,
}) + select({
"@cef//:windows_opt": WIN_COMMON_DEFINES_RELEASE,
"@cef//:windows_dbg": WIN_COMMON_DEFINES_DEBUG,
"@cef//:windows_fastbuild": WIN_COMMON_DEFINES_RELEASE,
"@cef//:linux_opt": LINUX_COMMON_DEFINES_RELEASE,
"@cef//:linux_dbg": LINUX_COMMON_DEFINES_DEBUG,
"@cef//:linux_fastbuild": LINUX_COMMON_DEFINES_RELEASE,
"//conditions:default": None,
}) + local_defines,
**kwargs
)
def declare_objc_library(copts=[], **kwargs):
"""
objc_library wrapper that applies common copts.
"""
# NOTE: objc_library does not support local_defines on MacOS, so on
# that platform we put the defines in copts instead.
objc_library(
copts = select({
"@platforms//os:windows": WIN_COMMON_COPTS,
"@platforms//os:linux": LINUX_COMMON_COPTS,
"@platforms//os:macos": MAC_COMMON_COPTS,
"//conditions:default": None,
}) + select({
"@cef//:windows_opt": WIN_COMMON_COPTS_RELEASE,
"@cef//:windows_dbg": WIN_COMMON_COPTS_DEBUG,
"@cef//:windows_fastbuild": WIN_COMMON_COPTS_RELEASE,
"@cef//:linux_opt": LINUX_COMMON_COPTS_RELEASE,
"@cef//:linux_dbg": LINUX_COMMON_COPTS_DEBUG,
"@cef//:linux_fastbuild": LINUX_COMMON_COPTS_RELEASE,
"@cef//:macos_opt": MAC_COMMON_COPTS_RELEASE,
"@cef//:macos_dbg": MAC_COMMON_COPTS_DEBUG,
"@cef//:macos_fastbuild": MAC_COMMON_COPTS_RELEASE,
"//conditions:default": None,
}) + copts,
**kwargs
)

8
bazel/linux/BUILD.bazel Executable file
View File

@@ -0,0 +1,8 @@
# Copyright (c) 2024 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
# Allow access from targets in other packages.
package(default_visibility = [
"//visibility:public",
])

63
bazel/linux/exe_helpers.bzl Executable file
View File

@@ -0,0 +1,63 @@
# Copyright (c) 2024 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
load("//bazel:copy_filegroups.bzl", "copy_filegroups")
load("//bazel/linux:fix_rpath.bzl", "fix_rpath")
load("//bazel/linux:variables.bzl",
"COMMON_LINKOPTS",
"COMMON_COPTS", "COMMON_COPTS_RELEASE", "COMMON_COPTS_DEBUG",
"COMMON_DEFINES", "COMMON_DEFINES_RELEASE", "COMMON_DEFINES_DEBUG")
load("@rules_cc//cc:defs.bzl", "cc_binary")
def declare_exe(name, srcs=[], deps=[], linkopts=[], copts=[], local_defines=[], data=[], **kwargs):
# Copy SOs and resources into the current project.
copy_target = "{}_sos_and_resources".format(name)
copy_filegroups(
name = copy_target,
filegroups = [
"@cef//:sos",
"@cef//:resources",
],
remove_prefixes = [
"Debug",
"Release",
"Resources",
],
)
# Executable target.
binary_target = "{}_incorrect_rpath".format(name)
cc_binary(
name = binary_target,
srcs = srcs,
deps = [
"@cef//:cef_wrapper",
"@cef//:cef",
"@cef//:cef_sandbox",
] + deps,
linkopts = COMMON_LINKOPTS + linkopts,
copts = COMMON_COPTS + select({
"@cef//:linux_dbg": COMMON_COPTS_DEBUG,
"//conditions:default": COMMON_COPTS_RELEASE,
}) + copts,
local_defines = COMMON_DEFINES + select({
"@cef//:linux_dbg": COMMON_DEFINES_DEBUG,
"//conditions:default": COMMON_DEFINES_RELEASE,
}) + local_defines,
data = [
":{}".format(copy_target),
] + data,
target_compatible_with = ["@platforms//os:linux"],
**kwargs
)
# Set rpath to $ORIGIN so that libraries can be loaded from next to the
# executable.
fix_rpath(
name = "{}_fixed_rpath".format(name),
src = ":{}".format(binary_target),
out = name,
target_compatible_with = ["@platforms//os:linux"],
)

41
bazel/linux/fix_rpath.bzl Normal file
View File

@@ -0,0 +1,41 @@
# Copyright (c) 2024 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
def _fix_rpath_impl(ctx):
inputs = ctx.runfiles(files = [ctx.file.src])
# Bring over 'data' dependencies from the input.
inputs = inputs.merge_all([ctx.attr.src[DefaultInfo].default_runfiles])
src = ctx.file.src.path
out = ctx.outputs.out.path
ctx.actions.run_shell(
outputs = [ctx.outputs.out],
inputs = inputs.files,
arguments = [src, out],
command = "cp $1 $2 && " +
"chmod +w $2 && " +
"patchelf --remove-rpath $2 && " +
"patchelf --set-rpath '$ORIGIN' $2"
)
return [DefaultInfo(files = depset([ctx.outputs.out]))]
# Set rpath to $ORIGIN so that libraries can be loaded from next to the
# executable. The result can be confirmed with:
# $ objdump -x ./bazel-bin/path/to/binary | grep 'R.*PATH'
#
# Alternatively, define a custom CC toolchain that overrides
# 'runtime_library_search_directories'.
#
# This rule requires preinstallation of the patchelf package:
# $ sudo apt install patchelf
fix_rpath = rule(
implementation = _fix_rpath_impl,
attrs = {
"src": attr.label(allow_single_file = True),
"out": attr.output(mandatory = True),
},
)

View File

@@ -0,0 +1,7 @@
package(default_visibility = ["//visibility:public"])
exports_files([
"pkg_config.bzl",
"BUILD.tmpl",
])

View File

@@ -0,0 +1,32 @@
# vi: ft=bzl
package(default_visibility = ["//visibility:private"])
_imports = [p[:len(p)-2] for p in glob(["{}/**/*.a".format(d) for d in [%{deps}]])]
[cc_import(
name = i.replace("/", "_"),
hdrs = glob([%{hdrs}]),
# TODO: library extension for platform.
static_library = "{}.a".format(i),
shared_library = "{}.dylib".format(i),
) for i in _imports]
cc_library(
name = "internal_lib",
hdrs = glob([%{hdrs}]),
copts = [%{copts}],
includes = [%{includes}],
linkopts = [%{linkopts}],
deps = [(":" + i.replace("/", "_")) for i in _imports],
)
cc_library(
name = "lib",
hdrs = glob(["%{strip_include}/**/*.h"]),
copts = [%{extra_copts}],
linkopts = [%{extra_linkopts}],
deps = [":internal_lib"] + [%{extra_deps}],
visibility = ["//visibility:public"],
strip_include_prefix = "%{strip_include}",
include_prefix = "%{include_prefix}",
)

View File

@@ -0,0 +1,11 @@
Name: pkg_config
URL: https://github.com/cherrry/bazel_pkg_config
Version: 284219a
Description:
Bazel rules for pkg-config tools.
CEF-specific changes:
- Fix failure with duplicate symlinks.
- Remove `--static` flag from pkg-config invocation.

View File

@@ -0,0 +1,2 @@
workspace(name = "pkg_config")

View File

@@ -0,0 +1,194 @@
def _success(value):
return struct(error = None, value = value)
def _error(message):
return struct(error = message, value = None)
def _split(result, delimeter = " "):
if result.error != None:
return result
return _success([arg for arg in result.value.strip().split(delimeter) if arg])
def _find_binary(ctx, binary_name):
binary = ctx.which(binary_name)
if binary == None:
return _error("Unable to find binary: {}".format(binary_name))
return _success(binary)
def _execute(ctx, binary, args):
result = ctx.execute([binary] + args)
if result.return_code != 0:
return _error("Failed execute {} {}".format(binary, args))
return _success(result.stdout)
def _pkg_config(ctx, pkg_config, pkg_name, args):
return _execute(ctx, pkg_config, [pkg_name] + args)
def _check(ctx, pkg_config, pkg_name):
exist = _pkg_config(ctx, pkg_config, pkg_name, ["--exists"])
if exist.error != None:
return _error("Package {} does not exist".format(pkg_name))
if ctx.attr.version != "":
version = _pkg_config(ctx, pkg_config, pkg_name, ["--exact-version", ctx.attr.version])
if version.error != None:
return _error("Require {} version = {}".format(pkg_name, ctx.attr.version))
if ctx.attr.min_version != "":
version = _pkg_config(ctx, pkg_config, pkg_name, ["--atleast-version", ctx.attr.min_version])
if version.error != None:
return _error("Require {} version >= {}".format(pkg_name, ctx.attr.min_version))
if ctx.attr.max_version != "":
version = _pkg_config(ctx, pkg_config, pkg_name, ["--max-version", ctx.attr.max_version])
if version.error != None:
return _error("Require {} version <= {}".format(pkg_name, ctx.attr.max_version))
return _success(None)
def _extract_prefix(flags, prefix, strip = True):
stripped, remain = [], []
for arg in flags:
if arg.startswith(prefix):
if strip:
stripped += [arg[len(prefix):]]
else:
stripped += [arg]
else:
remain += [arg]
return stripped, remain
def _includes(ctx, pkg_config, pkg_name):
includes = _split(_pkg_config(ctx, pkg_config, pkg_name, ["--cflags-only-I"]))
if includes.error != None:
return includes
includes, unused = _extract_prefix(includes.value, "-I", strip = True)
return _success(includes)
def _copts(ctx, pkg_config, pkg_name):
return _split(_pkg_config(ctx, pkg_config, pkg_name, [
"--cflags-only-other",
"--libs-only-L",
]))
def _linkopts(ctx, pkg_config, pkg_name):
return _split(_pkg_config(ctx, pkg_config, pkg_name, [
"--libs-only-other",
"--libs-only-l",
]))
def _ignore_opts(opts, ignore_opts):
remain = []
for opt in opts:
if opt not in ignore_opts:
remain += [opt]
return remain
def _symlinks(ctx, basename, srcpaths):
result = []
root = ctx.path("")
base = root.get_child(basename)
rootlen = len(str(base)) - len(basename)
for src in [ctx.path(p) for p in srcpaths]:
dest = base.get_child(src.basename)
if not dest.exists:
ctx.symlink(src, dest)
result += [str(dest)[rootlen:]]
return result
def _deps(ctx, pkg_config, pkg_name):
deps = _split(_pkg_config(ctx, pkg_config, pkg_name, [
"--libs-only-L",
"--static",
]))
if deps.error != None:
return deps
deps, unused = _extract_prefix(deps.value, "-L", strip = True)
result = []
for dep in {dep: True for dep in deps}.keys():
base = "deps_" + dep.replace("/", "_").replace(".", "_")
result += _symlinks(ctx, base, [dep])
return _success(result)
def _fmt_array(array):
return ",".join(['"{}"'.format(a) for a in array])
def _fmt_glob(array):
return _fmt_array(["{}/**/*.h".format(a) for a in array])
def _pkg_config_impl(ctx):
pkg_name = ctx.attr.pkg_name
if pkg_name == "":
pkg_name = ctx.attr.name
pkg_config = _find_binary(ctx, "pkg-config")
if pkg_config.error != None:
return pkg_config
pkg_config = pkg_config.value
check = _check(ctx, pkg_config, pkg_name)
if check.error != None:
return check
includes = _includes(ctx, pkg_config, pkg_name)
if includes.error != None:
return includes
includes = includes.value
includes = _symlinks(ctx, "includes", includes)
strip_include = "includes"
if len(includes) == 1:
strip_include = includes[0]
if ctx.attr.strip_include != "":
strip_include += "/" + ctx.attr.strip_include
ignore_opts = ctx.attr.ignore_opts
copts = _copts(ctx, pkg_config, pkg_name)
if copts.error != None:
return copts
copts = _ignore_opts(copts.value, ignore_opts)
linkopts = _linkopts(ctx, pkg_config, pkg_name)
if linkopts.error != None:
return linkopts
linkopts = _ignore_opts(linkopts.value, ignore_opts)
deps = _deps(ctx, pkg_config, pkg_name)
if deps.error != None:
return deps
deps = deps.value
include_prefix = ctx.attr.name
if ctx.attr.include_prefix != "":
include_prefix = ctx.attr.include_prefix + "/" + ctx.attr.name
build = ctx.template("BUILD", Label("//:BUILD.tmpl"), substitutions = {
"%{name}": ctx.attr.name,
"%{hdrs}": _fmt_glob(includes),
"%{includes}": _fmt_array(includes),
"%{copts}": _fmt_array(copts),
"%{extra_copts}": _fmt_array(ctx.attr.copts),
"%{deps}": _fmt_array(deps),
"%{extra_deps}": _fmt_array(ctx.attr.deps),
"%{linkopts}": _fmt_array(linkopts),
"%{extra_linkopts}": _fmt_array(ctx.attr.linkopts),
"%{strip_include}": strip_include,
"%{include_prefix}": include_prefix,
}, executable = False)
pkg_config = repository_rule(
attrs = {
"pkg_name": attr.string(doc = "Package name for pkg-config query, default to name."),
"include_prefix": attr.string(doc = "Additional prefix when including file, e.g. third_party. Compatible with strip_include option to produce desired include paths."),
"strip_include": attr.string(doc = "Strip prefix when including file, e.g. libs, files not included will be invisible. Compatible with include_prefix option to produce desired include paths."),
"version": attr.string(doc = "Exact package version."),
"min_version": attr.string(doc = "Minimum package version."),
"max_version": attr.string(doc = "Maximum package version."),
"deps": attr.string_list(doc = "Dependency targets."),
"linkopts": attr.string_list(doc = "Extra linkopts value."),
"copts": attr.string_list(doc = "Extra copts value."),
"ignore_opts": attr.string_list(doc = "Ignore listed opts in copts or linkopts."),
},
local = True,
implementation = _pkg_config_impl,
)

68
bazel/linux/variables.bzl Executable file
View File

@@ -0,0 +1,68 @@
# Copyright (c) 2024 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
#
# Distribution SOs.
#
SOS = [
"libcef.so",
"libEGL.so",
"libGLESv2.so",
"libvk_swiftshader.so",
"libvulkan.so.1",
]
#
# Common 'linkopts' for cc_binary targets.
#
# Standard link libraries.
STANDARD_LIBS = [
"X11",
]
COMMON_LINKOPTS_DEBUG = [
]
COMMON_LINKOPTS_RELEASE = [
]
COMMON_LINKOPTS = [
"-l{}".format(lib) for lib in STANDARD_LIBS
] + select({
"@cef//:linux_dbg": COMMON_LINKOPTS_DEBUG,
"//conditions:default": COMMON_LINKOPTS_RELEASE,
})
#
# Common 'copts' for cc_libary and cc_binary targets.
#
COMMON_COPTS = [
]
COMMON_COPTS_DEBUG = [
]
COMMON_COPTS_RELEASE = [
]
#
# Common 'defines' for cc_libary targets.
#
COMMON_DEFINES = [
# Used by apps to test if the sandbox is enabled
"CEF_USE_SANDBOX",
]
COMMON_DEFINES_DEBUG = [
]
COMMON_DEFINES_RELEASE = [
# Not a debug build
"NDEBUG",
]

8
bazel/mac/BUILD.bazel Normal file
View File

@@ -0,0 +1,8 @@
# Copyright (c) 2024 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
# Allow access from targets in other packages.
package(default_visibility = [
"//visibility:public",
])

113
bazel/mac/app_helpers.bzl Normal file
View File

@@ -0,0 +1,113 @@
# Copyright (c) 2024 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
load("@build_bazel_rules_apple//apple:macos.bzl", "macos_application")
load("//bazel:variables.bzl", "VERSION_PLIST")
load("//bazel/mac:variables.bzl",
"MACOS_DEPLOYMENT_TARGET",
"MACOS_BUNDLE_ID_BASE",
"CEF_FRAMEWORK_NAME",
"COMMON_LINKOPTS")
def _declare_helper_app(name, info_plist, deps, helper_base_name, helper_suffix, **kwargs):
"""
Creates a Helper .app target.
"""
helper_name = "{} Helper".format(name)
bundle_id_suffix = ""
if helper_suffix:
helper_name += " ({})".format(helper_suffix)
bundle_id_suffix += ".{}".format(helper_suffix.lower())
# Helper app bundle Info.plist.
expand_template(
name = "{}_InfoPList".format(helper_base_name),
template = info_plist,
out = "{}Info.plist".format(helper_base_name),
substitutions = {
"${EXECUTABLE_NAME}": helper_name,
"${PRODUCT_NAME}": name,
"${BUNDLE_ID_SUFFIX}": bundle_id_suffix,
"${VERSION_SHORT}": VERSION_PLIST,
"${VERSION_LONG}": VERSION_PLIST,
},
)
# Helper app bundle.
macos_application(
name = helper_base_name,
bundle_name = helper_name,
bundle_id = "{}.{}.helper{}".format(MACOS_BUNDLE_ID_BASE, name.lower(), bundle_id_suffix),
infoplists = [":{}_InfoPList".format(helper_base_name)],
minimum_os_version = MACOS_DEPLOYMENT_TARGET,
deps = [
"@cef//:cef_sandbox",
] + deps,
**kwargs,
)
HELPERS = {
"HelperBase": "",
"HelperAlerts": "Alerts",
"HelperGPU": "GPU",
"HelperPlugin": "Plugin",
"HelperRenderer": "Renderer",
}
def declare_all_helper_apps(name, info_plist, deps, **kwargs):
"""
Creates all Helper .app targets.
"""
[_declare_helper_app(
name = name,
info_plist = info_plist,
deps = deps,
helper_base_name = h,
helper_suffix = v,
**kwargs,
) for h, v in HELPERS.items()]
def declare_main_app(name, info_plist, deps, resources, linkopts=[], **kwargs):
"""
Creates the main .app target.
"""
# Main app bundle Info.plist.
expand_template(
name = "InfoPList",
template = info_plist,
out = "Info.plist",
substitutions = {
"${EXECUTABLE_NAME}": name,
"${PRODUCT_NAME}": name,
"${VERSION_SHORT}": VERSION_PLIST,
"${VERSION_LONG}": VERSION_PLIST,
},
)
# Main app bindle.
macos_application(
name = name,
additional_contents = {
":HelperBase": "Frameworks",
":HelperAlerts": "Frameworks",
":HelperGPU": "Frameworks",
":HelperPlugin": "Frameworks",
":HelperRenderer": "Frameworks",
"@cef//:cef_framework": "Frameworks/{}.framework".format(CEF_FRAMEWORK_NAME),
},
bundle_name = name,
bundle_id = "{}.{}".format(MACOS_BUNDLE_ID_BASE, name.lower()),
infoplists = [":InfoPList"],
linkopts = COMMON_LINKOPTS + linkopts,
minimum_os_version = MACOS_DEPLOYMENT_TARGET,
resources = resources,
target_compatible_with = [
"@platforms//os:macos",
],
deps = deps,
**kwargs,
)

52
bazel/mac/variables.bzl Normal file
View File

@@ -0,0 +1,52 @@
# Copyright (c) 2024 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
MACOS_DEPLOYMENT_TARGET="11.0"
MACOS_BUNDLE_ID_BASE="org.cef"
CEF_FRAMEWORK_NAME="Chromium Embedded Framework"
#
# Common 'linkopts' for macos_application targets.
#
# Standard link frameworks.
STANDARD_FRAMEWORKS = [
"AppKit",
]
COMMON_LINKOPTS_DEBUG = [
]
COMMON_LINKOPTS_RELEASE = [
]
COMMON_LINKOPTS = [
"-framework {}".format(lib) for lib in STANDARD_FRAMEWORKS
] + select({
"@cef//:macos_dbg": COMMON_LINKOPTS_DEBUG,
"//conditions:default": COMMON_LINKOPTS_RELEASE,
})
#
# Common 'copts' for cc_libary, objc_library and macos_application targets.
# We include defines in 'copts' because objc_library does not support
# 'local_defines'. See https://github.com/bazelbuild/bazel/issues/17482.
#
COMMON_COPTS = [
"-Wno-undefined-var-template",
"-Wno-missing-field-initializers",
"-Wno-deprecated-copy",
# Used by apps to test if the sandbox is enabled
"-DCEF_USE_SANDBOX",
]
COMMON_COPTS_DEBUG = [
]
COMMON_COPTS_RELEASE = [
# Not a debug build
"-DNDEBUG",
]

8
bazel/win/BUILD.bazel Normal file
View File

@@ -0,0 +1,8 @@
# Copyright (c) 2024 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
# Allow access from targets in other packages.
package(default_visibility = [
"//visibility:public",
])

33
bazel/win/cc_env.bzl Normal file
View File

@@ -0,0 +1,33 @@
# Copyright (c) 2024 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain", _use_cpp_toolchain="use_cpp_toolchain")
load("@rules_cc//cc:action_names.bzl", "CPP_COMPILE_ACTION_NAME")
# Since we need windows.h and other headers, we should ensure we have the same
# development environment as a regular cl.exe call. So use the current toolchain
# to grab environment variables to feed into the actual rc.exe call
# Much of this is taken from:
# https://github.com/bazelbuild/rules_cc/blob/main/examples/my_c_archive/my_c_archive.bzl
def collect_compilation_env(ctx):
cc_toolchain = find_cpp_toolchain(ctx)
feature_configuration = cc_common.configure_features(
ctx = ctx,
cc_toolchain = cc_toolchain,
requested_features = ctx.features,
unsupported_features = ctx.disabled_features,
)
compiler_variables = cc_common.create_compile_variables(
feature_configuration = feature_configuration,
cc_toolchain = cc_toolchain,
)
return cc_common.get_environment_variables(
feature_configuration = feature_configuration,
action_name = CPP_COMPILE_ACTION_NAME,
variables = compiler_variables,
)
use_cpp_toolchain=_use_cpp_toolchain

82
bazel/win/exe_helpers.bzl Normal file
View File

@@ -0,0 +1,82 @@
# Copyright (c) 2024 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
load("//bazel:copy_filegroups.bzl", "copy_filegroups")
load("//bazel/win:mt.bzl", "add_manifest")
load("//bazel/win:rc.bzl", "compile_rc")
load("//bazel/win:variables.bzl",
"COMMON_LINKOPTS",
"COMMON_COPTS", "COMMON_COPTS_RELEASE", "COMMON_COPTS_DEBUG",
"COMMON_DEFINES", "COMMON_DEFINES_RELEASE", "COMMON_DEFINES_DEBUG")
load("@rules_cc//cc:defs.bzl", "cc_binary")
def declare_exe(name, srcs, manifest_srcs, rc_file, resources_srcs, resources_deps=[],
deps=[], linkopts=[], copts=[], local_defines=[], data=[],
additional_linker_inputs=[], features=[], **kwargs):
# Resource file.
res_target = "{}_res".format(name)
compile_rc(
name = res_target,
rc_file = rc_file,
srcs = resources_srcs,
deps = resources_deps,
out = "{}.res".format(name),
target_compatible_with = ["@platforms//os:windows"],
)
# Copy DLLs and resources into the current project.
copy_target = "{}_dlls_and_resources".format(name)
copy_filegroups(
name = copy_target,
filegroups = [
"@cef//:dlls",
"@cef//:resources",
],
remove_prefixes = [
"Debug",
"Release",
"Resources",
],
)
# Executable target.
binary_target = "{}_no_manifest".format(name)
cc_binary(
name = binary_target,
srcs = srcs,
deps = [
"@cef//:cef_wrapper",
"@cef//:cef",
"@cef//:cef_sandbox",
] + deps,
linkopts = [
"$(location :{})".format(res_target),
] + COMMON_LINKOPTS + linkopts,
copts = COMMON_COPTS + select({
"@cef//:windows_dbg": COMMON_COPTS_DEBUG,
"//conditions:default": COMMON_COPTS_RELEASE,
}) + copts,
local_defines = COMMON_DEFINES + select({
"@cef//:windows_dbg": COMMON_DEFINES_DEBUG,
"//conditions:default": COMMON_DEFINES_RELEASE,
}) + local_defines,
additional_linker_inputs = [
":{}".format(res_target),
] + additional_linker_inputs,
data = [
":{}".format(copy_target),
] + data,
features = ["generate_pdb_file"] + features,
target_compatible_with = ["@platforms//os:windows"],
**kwargs
)
# Add manifest and rename to final executable.
add_manifest(
name = name,
mt_files = manifest_srcs,
in_binary = ":{}".format(binary_target),
out_binary = "{}.exe".format(name),
target_compatible_with = ["@platforms//os:windows"],
)

72
bazel/win/mt.bzl Normal file
View File

@@ -0,0 +1,72 @@
# Copyright (c) 2024 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
load("//bazel/win:cc_env.bzl", "collect_compilation_env", "use_cpp_toolchain")
# Copy exe and pdb file without tracking the destination as an output.
# Based on https://github.com/bazelbuild/bazel-skylib/blob/main/rules/private/copy_file_private.bzl
def _write_copy_cmd(ctx, src, dst):
# Most Windows binaries built with MSVC use a certain argument quoting
# scheme. Bazel uses that scheme too to quote arguments. However,
# cmd.exe uses different semantics, so Bazel's quoting is wrong here.
# To fix that we write the command to a .bat file so no command line
# quoting or escaping is required.
bat = ctx.actions.declare_file(ctx.label.name + "-cmd.bat")
src_path = src.path.replace("/", "\\")
dst_path = dst.path.replace("/", "\\")
ctx.actions.write(
output = bat,
# Do not use lib/shell.bzl's shell.quote() method, because that uses
# Bash quoting syntax, which is different from cmd.exe's syntax.
content = "@copy /Y \"%s\" \"%s\" >NUL\n@copy /Y \"%s\" \"%s\" >NUL" % (
src_path,
dst_path,
src_path.replace(".exe", ".pdb"),
dst_path.replace(".exe", ".pdb"),
),
is_executable = True,
)
return bat
def _add_mt_impl(ctx):
mt_files = ctx.files.mt_files
input = ctx.attr.in_binary[DebugPackageInfo].unstripped_file
output = ctx.outputs.out_binary
bat = _write_copy_cmd(ctx, input, output)
inputs = mt_files + [input, bat]
# Bring over 'data' dependencies from the input.
deps_inputs = ctx.runfiles(files = inputs)
deps_inputs = deps_inputs.merge_all([ctx.attr.in_binary[DefaultInfo].default_runfiles])
ctx.actions.run(
executable = ctx.executable._tool,
inputs = deps_inputs.files,
outputs = [output],
env = collect_compilation_env(ctx),
# The bat file will be executed before the tool command.
arguments = [bat.path, "-nologo", "-manifest"] + [f.path for f in mt_files] +
["-outputresource:{}".format(output.path)],
mnemonic = "AddMT"
)
return DefaultInfo(files = depset([output]))
add_manifest = rule(
implementation = _add_mt_impl,
attrs = {
"mt_files": attr.label_list(allow_files = [".manifest"]),
"in_binary": attr.label(providers = [CcInfo], allow_single_file = True),
"out_binary": attr.output(),
"_cc_toolchain": attr.label(default = Label("@bazel_tools//tools/cpp:current_cc_toolchain")),
"_tool": attr.label(
default = "@winsdk//:mt_pybin",
executable = True,
cfg = "exec"
)
},
fragments = ["cpp"],
toolchains = use_cpp_toolchain(),
)

50
bazel/win/rc.bzl Normal file
View File

@@ -0,0 +1,50 @@
# Copyright (c) 2024 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
load("//bazel/win:cc_env.bzl", "collect_compilation_env", "use_cpp_toolchain")
def _compile_rc_impl(ctx):
rc_file = ctx.file.rc_file
output = ctx.outputs.out
inputs = [rc_file] + ctx.files.srcs
includes = ["/i{}/{}".format(ctx.label.package, i) for i in ctx.attr.includes]
# Grab all include paths/files required for the run
for dep in ctx.attr.deps:
comp_ctx = dep[CcInfo].compilation_context
includes += ["/i{}".format(i) for i in comp_ctx.quote_includes.to_list()]
includes += ["/i{}".format(i) for i in comp_ctx.system_includes.to_list()]
inputs += comp_ctx.headers.to_list()
ctx.actions.run(
executable = ctx.executable._tool,
inputs = inputs,
outputs = [output],
env = collect_compilation_env(ctx),
arguments = includes + ["/fo", output.path, rc_file.path],
mnemonic = "CompileRC"
)
return DefaultInfo(files = depset([output]))
compile_rc = rule(
implementation = _compile_rc_impl,
attrs = {
"rc_file": attr.label(allow_single_file = [".rc"]),
"srcs": attr.label_list(allow_files = True),
"deps": attr.label_list(providers = [CcInfo]),
"includes": attr.string_list(),
"out": attr.output(),
"_cc_toolchain": attr.label(default = Label("@bazel_tools//tools/cpp:current_cc_toolchain")),
"_tool": attr.label(
default = "@winsdk//:rc_pybin",
executable = True,
cfg = "exec"
)
},
fragments = ["cpp"],
toolchains = use_cpp_toolchain(),
)

124
bazel/win/setup_sdk.bzl Normal file
View File

@@ -0,0 +1,124 @@
# Copyright (c) 2024 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
load("@bazel_tools//tools/cpp:windows_cc_configure.bzl", "find_vc_path", "setup_vc_env_vars")
def _get_arch(rctx):
if rctx.os.arch == "amd64":
return "x64"
def _is_windows(rctx):
return rctx.os.name.find("windows") != -1
# Tools in the form <Target>: [<Tool>, <Other files needed for that target>]
TOOLS = {
"mt": {
"tool": "mt.exe",
"deps": [],
},
"rc": {
"tool": "rc.exe",
"deps": ["rcdll.dll"],
},
}
def _setup_tools(rctx, sdk_bin_path, sdk_metadata_path):
contents = ""
rctx.symlink(sdk_metadata_path, "VerUnionMetadata")
contents += """
exports_files(["VerUnionMetadata"])
"""
for toolname, toolcfg in TOOLS.items():
toolexec = toolcfg["tool"]
deps = toolcfg["deps"]
direct_deps = [toolexec] + deps
shared_deps = toolcfg.get("shared_deps", [])
# Symlink any tools into the right places
for dep in direct_deps:
rctx.symlink(
"{}/{}".format(sdk_bin_path, dep),
dep,
)
# Setting up a filegroup for those dependents
contents += """
filegroup(
name = "{}_deps",
srcs = {},
)
""".format(toolname, direct_deps + shared_deps)
# Now create a wrapper for this tool that simply calls it
rctx.template(
"{}_wrapper.py".format(toolname),
Label("//bazel/win:wrapper.py.tpl"),
substitutions = {
"${binary}": toolexec,
},
executable = True,
)
# And add that newly created wrapper to the BUILD.bazel file
contents += """
py_binary(
name = "{0}_pybin",
srcs = ["{0}_wrapper.py"],
main = "{0}_wrapper.py",
data = [
"@rules_python//python/runfiles",
":{0}_deps"
],
python_version = "PY3",
)
""".format(toolname)
return contents
def _setup_vc_debug_runtime(rctx, sdk_bin_path):
ucrtbased_dll = "ucrtbased.dll"
rctx.symlink("{}/ucrt/{}".format(sdk_bin_path, ucrtbased_dll), ucrtbased_dll)
contents = """
filegroup(
name = "vc_debug_runtime",
srcs = ["{}"],
)
""".format(ucrtbased_dll)
return contents
def _windows_sdk_impl(rctx):
# We only support Windows
if not _is_windows(rctx):
fail("This rule only supports Windows")
# Figure out where the SDK is, which is based on a registry key.
vc_path = find_vc_path(rctx)
env = setup_vc_env_vars(rctx, vc_path, envvars = ["WINDOWSSDKVERBINPATH", "WindowsSdkDir", "WindowsSDKVersion"])
sdk_bin_path = "{}{}".format(env["WINDOWSSDKVERBINPATH"], _get_arch(rctx))
sdk_metadata_path = "{}UnionMetadata/{}".format(env["WindowsSdkDir"], env["WindowsSDKVersion"])
# Start with some pre-amble
contents = """# Autogenerated by //bazel/win:sdk.bzl
load("@rules_python//python:defs.bzl", "py_binary")
package(default_visibility = ["//visibility:public"])
"""
# Handle setting up tools from our list
contents += _setup_tools(rctx, sdk_bin_path, sdk_metadata_path)
contents += _setup_vc_debug_runtime(rctx, sdk_bin_path)
rctx.file("BUILD.bazel", contents)
setup_sdk = repository_rule(
attrs = {},
local = True,
configure = True,
implementation = _windows_sdk_impl,
)

199
bazel/win/variables.bzl Normal file
View File

@@ -0,0 +1,199 @@
# Copyright (c) 2024 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
#
# Distribution DLLs.
#
# NOTE: libcef.dll is included via the //:cef dependency.
DLLS = [
"chrome_elf.dll",
"d3dcompiler_47.dll",
"libEGL.dll",
"libGLESv2.dll",
"vk_swiftshader.dll",
"vulkan-1.dll",
]
DLLS_X64 = [
"dxil.dll",
"dxcompiler.dll",
]
#
# Common 'linkopts' for cc_binary targets.
#
# Windows delayload DLLs.
# Delayload most libraries as the DLLs are simply not required at startup (or
# at all, depending on the process type). Some dlls open handles when they are
# loaded, and we may not want them to be loaded in renderers or other sandboxed
# processes. Conversely, some DLLs must be loaded before sandbox lockdown. In
# unsandboxed processes they will load when first needed. The linker will
# automatically ignore anything which is not linked to the binary at all (it is
# harmless to have an unmatched /delayload). This list should be kept in sync
# with Chromium's "delayloads" target from the //build/config/win/BUILD.gn file.
DELAYLOAD_DLLS = [
"api-ms-win-core-winrt-error-l1-1-0.dll",
"api-ms-win-core-winrt-l1-1-0.dll",
"api-ms-win-core-winrt-string-l1-1-0.dll",
"advapi32.dll",
"comctl32.dll",
"comdlg32.dll",
"credui.dll",
"cryptui.dll",
"d3d11.dll",
"d3d9.dll",
"dwmapi.dll",
"dxgi.dll",
"dxva2.dll",
"esent.dll",
"gdi32.dll",
"hid.dll",
"imagehlp.dll",
"imm32.dll",
"msi.dll",
"netapi32.dll",
"ncrypt.dll",
"ole32.dll",
"oleacc.dll",
"propsys.dll",
"psapi.dll",
"rpcrt4.dll",
"rstrtmgr.dll",
"setupapi.dll",
"shell32.dll",
"shlwapi.dll",
"uiautomationcore.dll",
"urlmon.dll",
"user32.dll",
"usp10.dll",
"uxtheme.dll",
"wer.dll",
"wevtapi.dll",
"wininet.dll",
"winusb.dll",
"wsock32.dll",
"wtsapi32.dll",
]
# Standard link libraries.
STANDARD_LIBS = [
"comctl32.lib",
"gdi32.lib",
"rpcrt4.lib",
"shlwapi.lib",
"user32.lib",
"ws2_32.lib",
]
# Sandbox link libraries.
SANDBOX_LIBS = [
"Advapi32.lib",
"dbghelp.lib",
"Delayimp.lib",
"ntdll.lib",
"OleAut32.lib",
"PowrProf.lib",
"Propsys.lib",
"psapi.lib",
"SetupAPI.lib",
"Shcore.lib",
"Shell32.lib",
"Userenv.lib",
"version.lib",
"wbemuuid.lib",
"WindowsApp.lib",
"winmm.lib",
]
COMMON_LINKOPTS_DEBUG = [
]
COMMON_LINKOPTS_RELEASE = [
]
COMMON_LINKOPTS = [
# No default manifest (see compile_rc target).
"/MANIFEST:NO",
# Allow 32-bit processes to access 3GB of RAM.
"/LARGEADDRESSAWARE",
# Generate Debug information.
# TODO: Remove after fixing opt builds to work without it.
"/DEBUG",
] + [
"/DELAYLOAD:{}".format(dll) for dll in DELAYLOAD_DLLS
] + [
"/DEFAULTLIB:{}".format(lib) for lib in STANDARD_LIBS
] + select({
# Set the initial stack size to 0.5MiB, instead of the 1.5MiB minimum
# needed by CEF's main thread. This saves significant memory on threads
# (like those in the Windows thread pool, and others) whose stack size we
# can only control through this setting. The main thread (in 32-bit builds
# only) uses fibers to switch to a 4MiB stack at runtime via
# CefRunWinMainWithPreferredStackSize().
"@cef//:windows_32": ["/STACK:0x80000"],
# Increase the initial stack size to 8MiB from the default 1MiB.
"//conditions:default": ["/STACK:0x800000"],
}) + select({
"@cef//:windows_dbg": COMMON_LINKOPTS_DEBUG,
"//conditions:default": COMMON_LINKOPTS_RELEASE,
})
#
# Common 'copts' for cc_libary and cc_binary targets.
#
COMMON_COPTS = [
]
COMMON_COPTS_DEBUG = [
]
COMMON_COPTS_RELEASE = [
]
#
# Common 'defines' for cc_libary targets.
#
COMMON_DEFINES = [
# Windows platform
"WIN32",
"_WIN32",
"_WINDOWS",
# Unicode build
"UNICODE",
"_UNICODE",
# Targeting Windows 10. We can't say `=_WIN32_WINNT_WIN10` here because
# some files do `#if WINVER < 0x0600` without including windows.h before,
# and then _WIN32_WINNT_WIN10 isn't yet known to be 0x0A00.
"WINVER=0x0A00",
"_WIN32_WINNT=0x0A00",
"NTDDI_VERSION=NTDDI_WIN10_FE",
# Use the standard's templated min/max
"NOMINMAX",
# Exclude less common API declarations
"WIN32_LEAN_AND_MEAN",
# Disable exceptions
"_HAS_EXCEPTIONS=0",
# Required by cef_sandbox.lib
"PSAPI_VERSION=1",
# Used by apps to test if the sandbox is enabled
"CEF_USE_SANDBOX",
]
COMMON_DEFINES_DEBUG = [
# Required by cef_sandbox.lib
# Disable iterator debugging
"HAS_ITERATOR_DEBUGGING=0",
"_ITERATOR_DEBUG_LEVEL=0",
]
COMMON_DEFINES_RELEASE = [
# Not a debug build
"NDEBUG",
"_NDEBUG",
]

69
bazel/win/wrapper.py.tpl Normal file
View File

@@ -0,0 +1,69 @@
# Copyright (c) 2024 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
import os
import subprocess
import sys
from rules_python.python.runfiles import runfiles
REPLACEMENTS = {
"XXX_GETCWD_XXX": os.getcwd(),
}
def replace_in_str(input):
output = input
for placeholder, replacement in REPLACEMENTS.items():
if placeholder in output:
output = output.replace(placeholder, replacement)
return output
def print_error(str):
print(str, file=sys.stderr)
r = runfiles.Create()
wrapped_binary = r.Rlocation("winsdk/${binary}")
args = list(map(replace_in_str, sys.argv[1:]))
# Optionally execute a script before tool execution.
if args[0].endswith('.bat') or args[0].endswith('.cmd'):
if sys.platform != 'win32':
raise RuntimeError("Error running bat file; unsupported platform")
# Execute the .bat file first.
bat_file = args[0].replace('/', '\\')
p = subprocess.run(
bat_file, shell=True,
stdout = subprocess.PIPE,
stderr = subprocess.STDOUT,
text=True)
if p.returncode != 0:
print_error("[Generated python wrapper] Error running bat file:")
print_error(f"CWD: {os.getcwd()}")
print_error(f"EXEC: {bat_file}")
print_error(f"Exec output:")
print_error(p.stdout)
raise RuntimeError(f"Error running bat file; {bat_file}")
args = args[1:]
try:
p = subprocess.run(
[wrapped_binary] + args,
stdout = subprocess.PIPE,
stderr = subprocess.STDOUT,
text=True)
if p.returncode != 0:
print_error("[Generated python wrapper] Error running command:")
print_error(f"CWD: {os.getcwd()}")
print_error(f"EXEC: {wrapped_binary}")
print_error(f"ARGS: {args}")
print_error(f"Exec output:")
print_error(p.stdout)
raise RuntimeError(f"Error running wrapped command; {wrapped_binary}")
except OSError as e:
print_error("[Generated python wrapper] Error running command:")
print_error(f"CWD: {os.getcwd()}")
print_error(f"EXEC: {wrapped_binary}")
print_error(f"ARGS: {args}")
raise

View File

@@ -1,2 +1,2 @@
@echo off
python.bat tools\gclient_hook.py
python3.bat tools\gclient_hook.py

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2022 The Chromium Embedded Framework Authors. All rights
# Copyright (c) 2024 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
#
@@ -8,7 +8,7 @@
# by hand. See the translator.README.txt file in the tools directory for
# more information.
#
# $hash=3d75809bdc9a72a0df9df727981f0796b7ddbbc8$
# $hash=e092ed49124ef5969b2052fd6ae5f6e6d89390ba$
#
{
@@ -22,6 +22,7 @@
'include/cef_browser_process_handler.h',
'include/cef_callback.h',
'include/cef_client.h',
'include/cef_command_handler.h',
'include/cef_command_line.h',
'include/cef_context_menu_handler.h',
'include/cef_cookie.h',
@@ -34,8 +35,6 @@
'include/cef_download_item.h',
'include/cef_drag_data.h',
'include/cef_drag_handler.h',
'include/cef_extension.h',
'include/cef_extension_handler.h',
'include/cef_file_util.h',
'include/cef_find_handler.h',
'include/cef_focus_handler.h',
@@ -54,6 +53,8 @@
'include/cef_origin_whitelist.h',
'include/cef_parser.h',
'include/cef_path_util.h',
'include/cef_permission_handler.h',
'include/cef_preference.h',
'include/cef_print_handler.h',
'include/cef_print_settings.h',
'include/cef_process_message.h',
@@ -73,13 +74,17 @@
'include/cef_response_filter.h',
'include/cef_scheme.h',
'include/cef_server.h',
'include/cef_shared_memory_region.h',
'include/cef_shared_process_message_builder.h',
'include/cef_ssl_info.h',
'include/cef_ssl_status.h',
'include/cef_stream.h',
'include/cef_string_visitor.h',
'include/cef_task.h',
'include/cef_task_manager.h',
'include/cef_thread.h',
'include/cef_trace.h',
'include/cef_unresponsive_process_callback.h',
'include/cef_urlrequest.h',
'include/cef_v8.h',
'include/cef_values.h',
@@ -88,6 +93,7 @@
'include/cef_xml_reader.h',
'include/cef_zip_reader.h',
'include/test/cef_test_helpers.h',
'include/test/cef_test_server.h',
'include/test/cef_translator_test.h',
'include/views/cef_box_layout.h',
'include/views/cef_browser_view.h',
@@ -120,6 +126,7 @@
'include/capi/cef_browser_process_handler_capi.h',
'include/capi/cef_callback_capi.h',
'include/capi/cef_client_capi.h',
'include/capi/cef_command_handler_capi.h',
'include/capi/cef_command_line_capi.h',
'include/capi/cef_context_menu_handler_capi.h',
'include/capi/cef_cookie_capi.h',
@@ -132,8 +139,6 @@
'include/capi/cef_download_item_capi.h',
'include/capi/cef_drag_data_capi.h',
'include/capi/cef_drag_handler_capi.h',
'include/capi/cef_extension_capi.h',
'include/capi/cef_extension_handler_capi.h',
'include/capi/cef_file_util_capi.h',
'include/capi/cef_find_handler_capi.h',
'include/capi/cef_focus_handler_capi.h',
@@ -152,6 +157,8 @@
'include/capi/cef_origin_whitelist_capi.h',
'include/capi/cef_parser_capi.h',
'include/capi/cef_path_util_capi.h',
'include/capi/cef_permission_handler_capi.h',
'include/capi/cef_preference_capi.h',
'include/capi/cef_print_handler_capi.h',
'include/capi/cef_print_settings_capi.h',
'include/capi/cef_process_message_capi.h',
@@ -171,13 +178,17 @@
'include/capi/cef_response_filter_capi.h',
'include/capi/cef_scheme_capi.h',
'include/capi/cef_server_capi.h',
'include/capi/cef_shared_memory_region_capi.h',
'include/capi/cef_shared_process_message_builder_capi.h',
'include/capi/cef_ssl_info_capi.h',
'include/capi/cef_ssl_status_capi.h',
'include/capi/cef_stream_capi.h',
'include/capi/cef_string_visitor_capi.h',
'include/capi/cef_task_capi.h',
'include/capi/cef_task_manager_capi.h',
'include/capi/cef_thread_capi.h',
'include/capi/cef_trace_capi.h',
'include/capi/cef_unresponsive_process_callback_capi.h',
'include/capi/cef_urlrequest_capi.h',
'include/capi/cef_v8_capi.h',
'include/capi/cef_values_capi.h',
@@ -186,6 +197,7 @@
'include/capi/cef_xml_reader_capi.h',
'include/capi/cef_zip_reader_capi.h',
'include/capi/test/cef_test_helpers_capi.h',
'include/capi/test/cef_test_server_capi.h',
'include/capi/test/cef_translator_test_capi.h',
'include/capi/views/cef_box_layout_capi.h',
'include/capi/views/cef_browser_view_capi.h',
@@ -242,6 +254,8 @@
'libcef_dll/cpptoc/callback_cpptoc.h',
'libcef_dll/ctocpp/client_ctocpp.cc',
'libcef_dll/ctocpp/client_ctocpp.h',
'libcef_dll/ctocpp/command_handler_ctocpp.cc',
'libcef_dll/ctocpp/command_handler_ctocpp.h',
'libcef_dll/cpptoc/command_line_cpptoc.cc',
'libcef_dll/cpptoc/command_line_cpptoc.h',
'libcef_dll/ctocpp/completion_callback_ctocpp.cc',
@@ -288,10 +302,6 @@
'libcef_dll/ctocpp/drag_handler_ctocpp.h',
'libcef_dll/ctocpp/end_tracing_callback_ctocpp.cc',
'libcef_dll/ctocpp/end_tracing_callback_ctocpp.h',
'libcef_dll/cpptoc/extension_cpptoc.cc',
'libcef_dll/cpptoc/extension_cpptoc.h',
'libcef_dll/ctocpp/extension_handler_ctocpp.cc',
'libcef_dll/ctocpp/extension_handler_ctocpp.h',
'libcef_dll/cpptoc/file_dialog_callback_cpptoc.cc',
'libcef_dll/cpptoc/file_dialog_callback_cpptoc.h',
'libcef_dll/cpptoc/views/fill_layout_cpptoc.cc',
@@ -304,8 +314,6 @@
'libcef_dll/cpptoc/frame_cpptoc.h',
'libcef_dll/ctocpp/frame_handler_ctocpp.cc',
'libcef_dll/ctocpp/frame_handler_ctocpp.h',
'libcef_dll/cpptoc/get_extension_resource_callback_cpptoc.cc',
'libcef_dll/cpptoc/get_extension_resource_callback_cpptoc.h',
'libcef_dll/cpptoc/image_cpptoc.cc',
'libcef_dll/cpptoc/image_cpptoc.h',
'libcef_dll/cpptoc/jsdialog_callback_cpptoc.cc',
@@ -324,6 +332,8 @@
'libcef_dll/cpptoc/list_value_cpptoc.h',
'libcef_dll/ctocpp/load_handler_ctocpp.cc',
'libcef_dll/ctocpp/load_handler_ctocpp.h',
'libcef_dll/cpptoc/media_access_callback_cpptoc.cc',
'libcef_dll/cpptoc/media_access_callback_cpptoc.h',
'libcef_dll/ctocpp/media_observer_ctocpp.cc',
'libcef_dll/ctocpp/media_observer_ctocpp.h',
'libcef_dll/cpptoc/media_route_cpptoc.cc',
@@ -360,10 +370,18 @@
'libcef_dll/ctocpp/views/panel_delegate_ctocpp.h',
'libcef_dll/ctocpp/pdf_print_callback_ctocpp.cc',
'libcef_dll/ctocpp/pdf_print_callback_ctocpp.h',
'libcef_dll/ctocpp/permission_handler_ctocpp.cc',
'libcef_dll/ctocpp/permission_handler_ctocpp.h',
'libcef_dll/cpptoc/permission_prompt_callback_cpptoc.cc',
'libcef_dll/cpptoc/permission_prompt_callback_cpptoc.h',
'libcef_dll/cpptoc/post_data_cpptoc.cc',
'libcef_dll/cpptoc/post_data_cpptoc.h',
'libcef_dll/cpptoc/post_data_element_cpptoc.cc',
'libcef_dll/cpptoc/post_data_element_cpptoc.h',
'libcef_dll/cpptoc/preference_manager_cpptoc.cc',
'libcef_dll/cpptoc/preference_manager_cpptoc.h',
'libcef_dll/cpptoc/preference_registrar_cpptoc.cc',
'libcef_dll/cpptoc/preference_registrar_cpptoc.h',
'libcef_dll/cpptoc/print_dialog_callback_cpptoc.cc',
'libcef_dll/cpptoc/print_dialog_callback_cpptoc.h',
'libcef_dll/ctocpp/print_handler_ctocpp.cc',
@@ -412,6 +430,8 @@
'libcef_dll/cpptoc/run_context_menu_callback_cpptoc.h',
'libcef_dll/ctocpp/run_file_dialog_callback_ctocpp.cc',
'libcef_dll/ctocpp/run_file_dialog_callback_ctocpp.h',
'libcef_dll/cpptoc/run_quick_menu_callback_cpptoc.cc',
'libcef_dll/cpptoc/run_quick_menu_callback_cpptoc.h',
'libcef_dll/cpptoc/sslinfo_cpptoc.cc',
'libcef_dll/cpptoc/sslinfo_cpptoc.h',
'libcef_dll/cpptoc/sslstatus_cpptoc.cc',
@@ -430,6 +450,10 @@
'libcef_dll/ctocpp/server_handler_ctocpp.h',
'libcef_dll/ctocpp/set_cookie_callback_ctocpp.cc',
'libcef_dll/ctocpp/set_cookie_callback_ctocpp.h',
'libcef_dll/cpptoc/shared_memory_region_cpptoc.cc',
'libcef_dll/cpptoc/shared_memory_region_cpptoc.h',
'libcef_dll/cpptoc/shared_process_message_builder_cpptoc.cc',
'libcef_dll/cpptoc/shared_process_message_builder_cpptoc.h',
'libcef_dll/cpptoc/stream_reader_cpptoc.cc',
'libcef_dll/cpptoc/stream_reader_cpptoc.h',
'libcef_dll/cpptoc/stream_writer_cpptoc.cc',
@@ -438,8 +462,16 @@
'libcef_dll/ctocpp/string_visitor_ctocpp.h',
'libcef_dll/ctocpp/task_ctocpp.cc',
'libcef_dll/ctocpp/task_ctocpp.h',
'libcef_dll/cpptoc/task_manager_cpptoc.cc',
'libcef_dll/cpptoc/task_manager_cpptoc.h',
'libcef_dll/cpptoc/task_runner_cpptoc.cc',
'libcef_dll/cpptoc/task_runner_cpptoc.h',
'libcef_dll/cpptoc/test/test_server_cpptoc.cc',
'libcef_dll/cpptoc/test/test_server_cpptoc.h',
'libcef_dll/cpptoc/test/test_server_connection_cpptoc.cc',
'libcef_dll/cpptoc/test/test_server_connection_cpptoc.h',
'libcef_dll/ctocpp/test/test_server_handler_ctocpp.cc',
'libcef_dll/ctocpp/test/test_server_handler_ctocpp.h',
'libcef_dll/cpptoc/views/textfield_cpptoc.cc',
'libcef_dll/cpptoc/views/textfield_cpptoc.h',
'libcef_dll/ctocpp/views/textfield_delegate_ctocpp.cc',
@@ -472,6 +504,8 @@
'libcef_dll/cpptoc/urlrequest_cpptoc.h',
'libcef_dll/ctocpp/urlrequest_client_ctocpp.cc',
'libcef_dll/ctocpp/urlrequest_client_ctocpp.h',
'libcef_dll/cpptoc/unresponsive_process_callback_cpptoc.cc',
'libcef_dll/cpptoc/unresponsive_process_callback_cpptoc.h',
'libcef_dll/ctocpp/v8accessor_ctocpp.cc',
'libcef_dll/ctocpp/v8accessor_ctocpp.h',
'libcef_dll/ctocpp/v8array_buffer_release_callback_ctocpp.cc',
@@ -546,6 +580,8 @@
'libcef_dll/ctocpp/callback_ctocpp.h',
'libcef_dll/cpptoc/client_cpptoc.cc',
'libcef_dll/cpptoc/client_cpptoc.h',
'libcef_dll/cpptoc/command_handler_cpptoc.cc',
'libcef_dll/cpptoc/command_handler_cpptoc.h',
'libcef_dll/ctocpp/command_line_ctocpp.cc',
'libcef_dll/ctocpp/command_line_ctocpp.h',
'libcef_dll/cpptoc/completion_callback_cpptoc.cc',
@@ -592,10 +628,6 @@
'libcef_dll/cpptoc/drag_handler_cpptoc.h',
'libcef_dll/cpptoc/end_tracing_callback_cpptoc.cc',
'libcef_dll/cpptoc/end_tracing_callback_cpptoc.h',
'libcef_dll/ctocpp/extension_ctocpp.cc',
'libcef_dll/ctocpp/extension_ctocpp.h',
'libcef_dll/cpptoc/extension_handler_cpptoc.cc',
'libcef_dll/cpptoc/extension_handler_cpptoc.h',
'libcef_dll/ctocpp/file_dialog_callback_ctocpp.cc',
'libcef_dll/ctocpp/file_dialog_callback_ctocpp.h',
'libcef_dll/ctocpp/views/fill_layout_ctocpp.cc',
@@ -608,8 +640,6 @@
'libcef_dll/ctocpp/frame_ctocpp.h',
'libcef_dll/cpptoc/frame_handler_cpptoc.cc',
'libcef_dll/cpptoc/frame_handler_cpptoc.h',
'libcef_dll/ctocpp/get_extension_resource_callback_ctocpp.cc',
'libcef_dll/ctocpp/get_extension_resource_callback_ctocpp.h',
'libcef_dll/ctocpp/image_ctocpp.cc',
'libcef_dll/ctocpp/image_ctocpp.h',
'libcef_dll/ctocpp/jsdialog_callback_ctocpp.cc',
@@ -628,6 +658,8 @@
'libcef_dll/ctocpp/list_value_ctocpp.h',
'libcef_dll/cpptoc/load_handler_cpptoc.cc',
'libcef_dll/cpptoc/load_handler_cpptoc.h',
'libcef_dll/ctocpp/media_access_callback_ctocpp.cc',
'libcef_dll/ctocpp/media_access_callback_ctocpp.h',
'libcef_dll/cpptoc/media_observer_cpptoc.cc',
'libcef_dll/cpptoc/media_observer_cpptoc.h',
'libcef_dll/ctocpp/media_route_ctocpp.cc',
@@ -664,10 +696,18 @@
'libcef_dll/cpptoc/views/panel_delegate_cpptoc.h',
'libcef_dll/cpptoc/pdf_print_callback_cpptoc.cc',
'libcef_dll/cpptoc/pdf_print_callback_cpptoc.h',
'libcef_dll/cpptoc/permission_handler_cpptoc.cc',
'libcef_dll/cpptoc/permission_handler_cpptoc.h',
'libcef_dll/ctocpp/permission_prompt_callback_ctocpp.cc',
'libcef_dll/ctocpp/permission_prompt_callback_ctocpp.h',
'libcef_dll/ctocpp/post_data_ctocpp.cc',
'libcef_dll/ctocpp/post_data_ctocpp.h',
'libcef_dll/ctocpp/post_data_element_ctocpp.cc',
'libcef_dll/ctocpp/post_data_element_ctocpp.h',
'libcef_dll/ctocpp/preference_manager_ctocpp.cc',
'libcef_dll/ctocpp/preference_manager_ctocpp.h',
'libcef_dll/ctocpp/preference_registrar_ctocpp.cc',
'libcef_dll/ctocpp/preference_registrar_ctocpp.h',
'libcef_dll/ctocpp/print_dialog_callback_ctocpp.cc',
'libcef_dll/ctocpp/print_dialog_callback_ctocpp.h',
'libcef_dll/cpptoc/print_handler_cpptoc.cc',
@@ -716,6 +756,8 @@
'libcef_dll/ctocpp/run_context_menu_callback_ctocpp.h',
'libcef_dll/cpptoc/run_file_dialog_callback_cpptoc.cc',
'libcef_dll/cpptoc/run_file_dialog_callback_cpptoc.h',
'libcef_dll/ctocpp/run_quick_menu_callback_ctocpp.cc',
'libcef_dll/ctocpp/run_quick_menu_callback_ctocpp.h',
'libcef_dll/ctocpp/sslinfo_ctocpp.cc',
'libcef_dll/ctocpp/sslinfo_ctocpp.h',
'libcef_dll/ctocpp/sslstatus_ctocpp.cc',
@@ -734,6 +776,10 @@
'libcef_dll/cpptoc/server_handler_cpptoc.h',
'libcef_dll/cpptoc/set_cookie_callback_cpptoc.cc',
'libcef_dll/cpptoc/set_cookie_callback_cpptoc.h',
'libcef_dll/ctocpp/shared_memory_region_ctocpp.cc',
'libcef_dll/ctocpp/shared_memory_region_ctocpp.h',
'libcef_dll/ctocpp/shared_process_message_builder_ctocpp.cc',
'libcef_dll/ctocpp/shared_process_message_builder_ctocpp.h',
'libcef_dll/ctocpp/stream_reader_ctocpp.cc',
'libcef_dll/ctocpp/stream_reader_ctocpp.h',
'libcef_dll/ctocpp/stream_writer_ctocpp.cc',
@@ -742,8 +788,16 @@
'libcef_dll/cpptoc/string_visitor_cpptoc.h',
'libcef_dll/cpptoc/task_cpptoc.cc',
'libcef_dll/cpptoc/task_cpptoc.h',
'libcef_dll/ctocpp/task_manager_ctocpp.cc',
'libcef_dll/ctocpp/task_manager_ctocpp.h',
'libcef_dll/ctocpp/task_runner_ctocpp.cc',
'libcef_dll/ctocpp/task_runner_ctocpp.h',
'libcef_dll/ctocpp/test/test_server_ctocpp.cc',
'libcef_dll/ctocpp/test/test_server_ctocpp.h',
'libcef_dll/ctocpp/test/test_server_connection_ctocpp.cc',
'libcef_dll/ctocpp/test/test_server_connection_ctocpp.h',
'libcef_dll/cpptoc/test/test_server_handler_cpptoc.cc',
'libcef_dll/cpptoc/test/test_server_handler_cpptoc.h',
'libcef_dll/ctocpp/views/textfield_ctocpp.cc',
'libcef_dll/ctocpp/views/textfield_ctocpp.h',
'libcef_dll/cpptoc/views/textfield_delegate_cpptoc.cc',
@@ -776,6 +830,8 @@
'libcef_dll/ctocpp/urlrequest_ctocpp.h',
'libcef_dll/cpptoc/urlrequest_client_cpptoc.cc',
'libcef_dll/cpptoc/urlrequest_client_cpptoc.h',
'libcef_dll/ctocpp/unresponsive_process_callback_ctocpp.cc',
'libcef_dll/ctocpp/unresponsive_process_callback_ctocpp.h',
'libcef_dll/cpptoc/v8accessor_cpptoc.cc',
'libcef_dll/cpptoc/v8accessor_cpptoc.h',
'libcef_dll/cpptoc/v8array_buffer_release_callback_cpptoc.cc',

View File

@@ -8,7 +8,6 @@
'include/base/cef_atomic_flag.h',
'include/base/cef_atomic_ref_count.h',
'include/base/cef_auto_reset.h',
'include/base/cef_basictypes.h',
'include/base/cef_bind.h',
'include/base/cef_build.h',
'include/base/cef_callback.h',
@@ -17,21 +16,20 @@
'include/base/cef_callback_list.h',
'include/base/cef_cancelable_callback.h',
'include/base/cef_compiler_specific.h',
'include/base/cef_cxx17_backports.h',
'include/base/cef_dump_without_crashing.h',
'include/base/cef_lock.h',
'include/base/cef_logging.h',
'include/base/cef_macros.h',
'include/base/cef_platform_thread.h',
'include/base/cef_ptr_util.h',
'include/base/cef_ref_counted.h',
'include/base/cef_scoped_refptr.h',
'include/base/cef_template_util.h',
'include/base/cef_thread_checker.h',
'include/base/cef_trace_event.h',
'include/base/cef_tuple.h',
'include/base/cef_weak_ptr.h',
'include/base/internal/cef_bind_internal.h',
'include/base/internal/cef_callback_internal.h',
'include/base/internal/cef_color_id_macros.inc',
'include/base/internal/cef_lock_impl.h',
'include/base/internal/cef_raw_scoped_refptr_mismatch_checker.h',
'include/base/internal/cef_scoped_policy.h',
@@ -42,9 +40,11 @@
'include/internal/cef_export.h',
'include/internal/cef_ptr.h',
'include/internal/cef_string_wrappers.h',
'include/internal/cef_time_wrappers.h',
'include/internal/cef_types_wrappers.h',
],
'includes_common_capi': [
'include/internal/cef_dump_without_crashing_internal.h',
'include/internal/cef_logging_internal.h',
'include/internal/cef_string.h',
'include/internal/cef_string_list.h',
@@ -55,7 +55,10 @@
'include/internal/cef_time.h',
'include/internal/cef_trace_event_internal.h',
'include/internal/cef_types.h',
'include/internal/cef_types_content_settings.h',
'include/internal/cef_types_geometry.h',
'include/internal/cef_types_runtime.h',
'include/internal/cef_types_color.h',
],
'includes_capi': [
'include/capi/cef_base_capi.h',
@@ -79,6 +82,7 @@
'include/internal/cef_win.h',
],
'includes_win_capi': [
'include/internal/cef_app_win.h',
'include/internal/cef_types_win.h',
],
'includes_mac': [
@@ -121,6 +125,7 @@
'libcef_dll/base/cef_atomic_flag.cc',
'libcef_dll/base/cef_callback_helpers.cc',
'libcef_dll/base/cef_callback_internal.cc',
'libcef_dll/base/cef_dump_without_crashing.cc',
'libcef_dll/base/cef_lock.cc',
'libcef_dll/base/cef_lock_impl.cc',
'libcef_dll/base/cef_logging.cc',
@@ -147,6 +152,8 @@
'libcef_dll/wrapper/cef_byte_read_handler.cc',
'libcef_dll/wrapper/cef_closure_task.cc',
'libcef_dll/wrapper/cef_message_router.cc',
'libcef_dll/wrapper/cef_message_router_utils.cc',
'libcef_dll/wrapper/cef_message_router_utils.h',
'libcef_dll/wrapper/cef_resource_manager.cc',
'libcef_dll/wrapper/cef_scoped_temp_dir.cc',
'libcef_dll/wrapper/cef_stream_resource_handler.cc',
@@ -162,8 +169,6 @@
'shared_sources_browser': [
'tests/shared/browser/client_app_browser.cc',
'tests/shared/browser/client_app_browser.h',
'tests/shared/browser/extension_util.cc',
'tests/shared/browser/extension_util.h',
'tests/shared/browser/file_util.cc',
'tests/shared/browser/file_util.h',
'tests/shared/browser/geometry_util.cc',
@@ -177,12 +182,16 @@
'tests/shared/browser/resource_util.h',
],
'shared_sources_common': [
'tests/shared/common/binary_value_utils.cc',
'tests/shared/common/binary_value_utils.h',
'tests/shared/common/client_app.cc',
'tests/shared/common/client_app.h',
'tests/shared/common/client_app_other.cc',
'tests/shared/common/client_app_other.h',
'tests/shared/common/client_switches.cc',
'tests/shared/common/client_switches.h',
'tests/shared/common/string_util.cc',
'tests/shared/common/string_util.h',
],
'shared_sources_renderer': [
'tests/shared/renderer/client_app_renderer.cc',
@@ -214,6 +223,10 @@
'tests/shared/browser/util_win.h',
],
'cefclient_sources_browser': [
'tests/cefclient/browser/base_client_handler.cc',
'tests/cefclient/browser/base_client_handler.h',
'tests/cefclient/browser/binary_transfer_test.cc',
'tests/cefclient/browser/binary_transfer_test.h',
'tests/cefclient/browser/binding_test.cc',
'tests/cefclient/browser/binding_test.h',
'tests/cefclient/browser/browser_window.cc',
@@ -229,9 +242,15 @@
'tests/cefclient/browser/client_handler_osr.h',
'tests/cefclient/browser/client_handler_std.cc',
'tests/cefclient/browser/client_handler_std.h',
'tests/cefclient/browser/client_prefs.cc',
'tests/cefclient/browser/client_prefs.h',
'tests/cefclient/browser/client_types.h',
'tests/cefclient/browser/default_client_handler.cc',
'tests/cefclient/browser/default_client_handler.h',
'tests/cefclient/browser/dialog_test.cc',
'tests/cefclient/browser/dialog_test.h',
'tests/cefclient/browser/hang_test.cc',
'tests/cefclient/browser/hang_test.h',
'tests/cefclient/browser/image_cache.cc',
'tests/cefclient/browser/image_cache.h',
'tests/cefclient/browser/main_context.cc',
@@ -260,6 +279,8 @@
'tests/cefclient/browser/scheme_test.h',
'tests/cefclient/browser/server_test.cc',
'tests/cefclient/browser/server_test.h',
'tests/cefclient/browser/task_manager_test.cc',
'tests/cefclient/browser/task_manager_test.h',
'tests/cefclient/browser/temp_window.h',
'tests/cefclient/browser/test_runner.cc',
'tests/cefclient/browser/test_runner.h',
@@ -267,6 +288,8 @@
'tests/cefclient/browser/urlrequest_test.h',
'tests/cefclient/browser/views_menu_bar.cc',
'tests/cefclient/browser/views_menu_bar.h',
'tests/cefclient/browser/views_overlay_browser.cc',
'tests/cefclient/browser/views_overlay_browser.h',
'tests/cefclient/browser/views_overlay_controls.cc',
'tests/cefclient/browser/views_overlay_controls.h',
'tests/cefclient/browser/views_style.cc',
@@ -289,15 +312,20 @@
'tests/cefclient/renderer/client_app_delegates_renderer.cc',
'tests/cefclient/renderer/client_renderer.cc',
'tests/cefclient/renderer/client_renderer.h',
'tests/cefclient/renderer/ipc_performance_test.cc',
'tests/cefclient/renderer/ipc_performance_test.h',
'tests/cefclient/renderer/performance_test.cc',
'tests/cefclient/renderer/performance_test.h',
'tests/cefclient/renderer/performance_test_setup.h',
'tests/cefclient/renderer/performance_test_tests.cc',
],
'cefclient_sources_resources': [
'tests/cefclient/resources/binary_transfer.html',
'tests/cefclient/resources/binding.html',
'tests/cefclient/resources/dialogs.html',
'tests/cefclient/resources/draggable.html',
'tests/cefclient/resources/hang.html',
'tests/cefclient/resources/ipc_performance.html',
'tests/cefclient/resources/localstorage.html',
'tests/cefclient/resources/logo.png',
'tests/cefclient/resources/media_router.html',
@@ -309,19 +337,13 @@
'tests/cefclient/resources/preferences.html',
'tests/cefclient/resources/response_filter.html',
'tests/cefclient/resources/server.html',
'tests/cefclient/resources/task_manager.html',
'tests/cefclient/resources/transparency.html',
'tests/cefclient/resources/urlrequest.html',
'tests/cefclient/resources/websocket.html',
'tests/cefclient/resources/window.html',
'tests/cefclient/resources/xmlhttprequest.html',
],
'cefclient_sources_resources_extensions_set_page_color': [
'tests/cefclient/resources/extensions/set_page_color/icon.png',
'tests/cefclient/resources/extensions/set_page_color/manifest.json',
'tests/cefclient/resources/extensions/set_page_color/popup.html',
'tests/cefclient/resources/extensions/set_page_color/popup.js',
'tests/cefclient/resources/extensions/set_page_color/README.md',
],
'cefclient_sources_win': [
'tests/cefclient/browser/browser_window_osr_win.cc',
'tests/cefclient/browser/browser_window_osr_win.h',
@@ -357,12 +379,14 @@
'tests/cefclient/browser/window_test_runner_win.cc',
'tests/cefclient/browser/window_test_runner_win.h',
'tests/cefclient/cefclient_win.cc',
'tests/cefclient/resources/win/cefclient.rc',
],
'cefclient_sources_resources_win': [
'tests/cefclient/resources/win/cefclient.exe.manifest',
'tests/cefclient/resources/win/cefclient.ico',
'tests/cefclient/resources/win/small.ico',
'tests/cefclient/win/cefclient.exe.manifest',
'tests/cefclient/win/cefclient.ico',
'tests/cefclient/win/small.ico',
],
'cefclient_sources_resources_win_rc': [
'tests/cefclient/win/cefclient.rc',
],
'cefclient_sources_mac': [
'tests/cefclient/browser/browser_window_osr_mac.h',
@@ -381,15 +405,16 @@
'tests/cefclient/browser/temp_window_mac.mm',
'tests/cefclient/browser/text_input_client_osr_mac.h',
'tests/cefclient/browser/text_input_client_osr_mac.mm',
'tests/cefclient/browser/views_window_mac.mm',
'tests/cefclient/browser/window_test_runner_mac.h',
'tests/cefclient/browser/window_test_runner_mac.mm',
'tests/cefclient/cefclient_mac.mm',
],
],
'cefclient_bundle_resources_mac': [
'tests/cefclient/resources/mac/cefclient.icns',
'tests/cefclient/resources/mac/English.lproj/InfoPlist.strings',
'tests/cefclient/resources/mac/English.lproj/MainMenu.xib',
'tests/cefclient/resources/mac/Info.plist',
'tests/cefclient/mac/cefclient.icns',
'tests/cefclient/mac/English.lproj/InfoPlist.strings',
'tests/cefclient/mac/English.lproj/MainMenu.xib',
'tests/cefclient/mac/Info.plist.in',
],
'cefclient_sources_linux': [
'tests/cefclient/browser/browser_window_osr_gtk.cc',
@@ -421,15 +446,17 @@
'tests/cefsimple/simple_handler.h',
],
'cefsimple_sources_win': [
'tests/cefsimple/cefsimple.rc',
'tests/cefsimple/cefsimple_win.cc',
'tests/cefsimple/simple_handler_win.cc',
'tests/cefsimple/resource.h',
'tests/cefsimple/simple_handler_win.cc',
],
'cefsimple_sources_resources_win': [
'tests/cefsimple/cefsimple.exe.manifest',
'tests/cefsimple/res/cefsimple.ico',
'tests/cefsimple/res/small.ico',
'tests/cefsimple/win/cefsimple.exe.manifest',
'tests/cefsimple/win/cefsimple.ico',
'tests/cefsimple/win/small.ico',
],
'cefsimple_sources_resources_win_rc': [
'tests/cefsimple/win/cefsimple.rc',
],
'cefsimple_sources_mac': [
'tests/cefsimple/cefsimple_mac.mm',
@@ -442,15 +469,22 @@
'tests/cefsimple/mac/cefsimple.icns',
'tests/cefsimple/mac/English.lproj/InfoPlist.strings',
'tests/cefsimple/mac/English.lproj/MainMenu.xib',
'tests/cefsimple/mac/Info.plist',
'tests/cefsimple/mac/Info.plist.in',
],
'cefsimple_sources_linux': [
'tests/cefsimple/cefsimple_linux.cc',
'tests/cefsimple/simple_handler_linux.cc',
],
'ceftests_data_resources': [
'tests/ceftests/resources/net/data/ssl/certificates/expired_cert.pem',
'tests/ceftests/resources/net/data/ssl/certificates/localhost_cert.pem',
'tests/ceftests/resources/net/data/ssl/certificates/ok_cert.pem',
'tests/ceftests/resources/net/data/ssl/certificates/root_ca_cert.pem',
],
'ceftests_sources_common': [
'tests/ceftests/audio_output_unittest.cc',
'tests/ceftests/browser_info_map_unittest.cc',
'tests/ceftests/certificate_error_unittest.cc',
'tests/ceftests/command_line_unittest.cc',
'tests/ceftests/cookie_unittest.cc',
'tests/ceftests/cors_unittest.cc',
@@ -460,28 +494,30 @@
'tests/ceftests/dom_unittest.cc',
'tests/ceftests/download_unittest.cc',
'tests/ceftests/draggable_regions_unittest.cc',
'tests/ceftests/extensions/background_unittest.cc',
'tests/ceftests/extensions/chrome_alarms_unittest.cc',
'tests/ceftests/extensions/chrome_storage_unittest.cc',
'tests/ceftests/extensions/chrome_tabs_unittest.cc',
'tests/ceftests/extensions/extension_test_handler.cc',
'tests/ceftests/extensions/extension_test_handler.h',
'tests/ceftests/extensions/view_unittest.cc',
'tests/ceftests/file_util_unittest.cc',
'tests/ceftests/frame_handler_unittest.cc',
'tests/ceftests/frame_unittest.cc',
'tests/ceftests/hsts_redirect_unittest.cc',
'tests/ceftests/image_unittest.cc',
'tests/ceftests/image_util.cc',
'tests/ceftests/image_util.h',
'tests/ceftests/jsdialog_unittest.cc',
'tests/ceftests/life_span_unittest.cc',
'tests/ceftests/message_router_unittest.cc',
'tests/ceftests/media_access_unittest.cc',
'tests/ceftests/message_router_binary_unittest.cc',
'tests/ceftests/message_router_harness_unittest.cc',
'tests/ceftests/message_router_multi_query_unittest.cc',
'tests/ceftests/message_router_single_query_unittest.cc',
'tests/ceftests/message_router_threshold_unittest.cc',
'tests/ceftests/message_router_unittest_utils.cc',
'tests/ceftests/message_router_unittest_utils.h',
'tests/ceftests/navigation_unittest.cc',
'tests/ceftests/os_rendering_unittest.cc',
'tests/ceftests/osr_accessibility_unittest.cc',
'tests/ceftests/osr_display_unittest.cc',
'tests/ceftests/parser_unittest.cc',
'tests/ceftests/pdf_viewer_unittest.cc',
'tests/ceftests/permission_prompt_unittest.cc',
'tests/ceftests/preference_unittest.cc',
'tests/ceftests/print_unittest.cc',
'tests/ceftests/process_message_unittest.cc',
@@ -498,6 +534,8 @@
'tests/ceftests/scheme_handler_unittest.cc',
'tests/ceftests/scoped_temp_dir_unittest.cc',
'tests/ceftests/server_unittest.cc',
'tests/ceftests/send_shared_process_message_unittest.cc',
"tests/ceftests/shared_process_message_unittest.cc",
'tests/ceftests/stream_unittest.cc',
'tests/ceftests/stream_resource_handler_unittest.cc',
'tests/ceftests/string_unittest.cc',
@@ -509,11 +547,21 @@
'tests/ceftests/test_request.h',
'tests/ceftests/test_server.cc',
'tests/ceftests/test_server.h',
'tests/ceftests/test_server_observer.h',
'tests/ceftests/test_server_observer.cc',
'tests/ceftests/test_server_observer_unittest.cc',
'tests/ceftests/test_server_manager.h',
'tests/ceftests/test_server_manager.cc',
'tests/ceftests/test_server_runner.h',
'tests/ceftests/test_server_runner.cc',
'tests/ceftests/test_server_runner_normal.cc',
'tests/ceftests/test_server_runner_test.cc',
'tests/ceftests/test_server_unittest.cc',
'tests/ceftests/test_suite.cc',
'tests/ceftests/test_suite.h',
'tests/ceftests/test_util.cc',
'tests/ceftests/test_util.h',
'tests/ceftests/time_unittest.cc',
'tests/ceftests/thread_helper.cc',
'tests/ceftests/thread_helper.h',
'tests/ceftests/thread_unittest.cc',
@@ -537,34 +585,51 @@
'tests/ceftests/zip_reader_unittest.cc',
],
'ceftests_sources_win': [
'tests/ceftests/resource_util_win_dir.cc',
'tests/ceftests/resource_util_win_idmap.cc',
'tests/ceftests/resources/win/ceftests.rc',
],
'ceftests_sources_resources_win': [
'tests/ceftests/resources/win/ceftests.exe.manifest',
'tests/ceftests/resources/win/ceftests.ico',
'tests/ceftests/resources/win/small.ico',
'tests/ceftests/win/ceftests.exe.manifest',
'tests/ceftests/win/ceftests.ico',
'tests/ceftests/win/small.ico',
],
'ceftests_sources_resources_win_rc': [
'tests/ceftests/win/ceftests.rc',
],
'ceftests_sources_mac': [
'tests/ceftests/os_rendering_unittest_mac.h',
'tests/ceftests/os_rendering_unittest_mac.mm',
'tests/ceftests/run_all_unittests_mac.mm',
],
'ceftests_sources_mac_helper': [
'ceftests_sources_mac_browser_shared': [
'tests/shared/renderer/client_app_renderer.h',
],
'ceftests_sources_mac_helper_shared': [
'tests/shared/browser/client_app_browser.h',
'tests/shared/browser/file_util.cc',
'tests/shared/browser/file_util.h',
'tests/shared/browser/resource_util.h',
'tests/shared/browser/resource_util_mac.mm',
'tests/shared/browser/resource_util_posix.cc',
],
'ceftests_sources_mac_helper': [
'tests/ceftests/audio_output_unittest.cc',
'tests/ceftests/client_app_delegates.cc',
'tests/ceftests/cookie_unittest.cc',
'tests/ceftests/cors_unittest.cc',
'tests/ceftests/dom_unittest.cc',
'tests/ceftests/frame_unittest.cc',
'tests/ceftests/message_router_unittest.cc',
'tests/ceftests/media_access_unittest.cc',
'tests/ceftests/message_router_binary_unittest.cc',
'tests/ceftests/message_router_harness_unittest.cc',
'tests/ceftests/message_router_multi_query_unittest.cc',
'tests/ceftests/message_router_single_query_unittest.cc',
'tests/ceftests/message_router_threshold_unittest.cc',
'tests/ceftests/message_router_unittest_utils.cc',
'tests/ceftests/message_router_unittest_utils.h',
'tests/ceftests/navigation_unittest.cc',
'tests/ceftests/pdf_viewer_unittest.cc',
'tests/ceftests/permission_prompt_unittest.cc',
'tests/ceftests/preference_unittest.cc',
'tests/ceftests/process_message_unittest.cc',
'tests/ceftests/request_handler_unittest.cc',
@@ -574,6 +639,8 @@
'tests/ceftests/routing_test_handler.cc',
'tests/ceftests/routing_test_handler.h',
'tests/ceftests/scheme_handler_unittest.cc',
'tests/ceftests/send_shared_process_message_unittest.cc',
"tests/ceftests/shared_process_message_unittest.cc",
'tests/ceftests/urlrequest_unittest.cc',
'tests/ceftests/test_handler.cc',
'tests/ceftests/test_handler.h',
@@ -581,6 +648,14 @@
'tests/ceftests/test_request.h',
'tests/ceftests/test_server.cc',
'tests/ceftests/test_server.h',
'tests/ceftests/test_server_observer.h',
'tests/ceftests/test_server_observer.cc',
'tests/ceftests/test_server_manager.h',
'tests/ceftests/test_server_manager.cc',
'tests/ceftests/test_server_runner.h',
'tests/ceftests/test_server_runner.cc',
'tests/ceftests/test_server_runner_normal.cc',
'tests/ceftests/test_server_runner_test.cc',
'tests/ceftests/test_suite.cc',
'tests/ceftests/test_suite.h',
'tests/ceftests/test_util.cc',
@@ -593,10 +668,10 @@
'tests/ceftests/v8_unittest.cc',
],
'ceftests_bundle_resources_mac': [
'tests/ceftests/resources/mac/ceftests.icns',
'tests/ceftests/resources/mac/English.lproj/InfoPlist.strings',
'tests/ceftests/resources/mac/English.lproj/MainMenu.xib',
'tests/ceftests/resources/mac/Info.plist',
'tests/ceftests/mac/ceftests.icns',
'tests/ceftests/mac/English.lproj/InfoPlist.strings',
'tests/ceftests/mac/English.lproj/MainMenu.xib',
'tests/ceftests/mac/Info.plist.in',
],
'ceftests_sources_linux': [
'tests/ceftests/resource_util_linux.cc',

View File

@@ -95,43 +95,64 @@ macro(SET_CEF_TARGET_OUT_DIR)
endif()
endmacro()
# Copy a list of files from one directory to another. Relative files paths are maintained.
# The path component of the source |file_list| will be removed.
# Copy a list of files from one directory to another. Relative file paths are maintained.
macro(COPY_FILES target file_list source_dir target_dir)
foreach(FILENAME ${file_list})
set(source_file ${source_dir}/${FILENAME})
# Remove the target file path component.
get_filename_component(target_name ${FILENAME} NAME)
set(target_file ${target_dir}/${target_name})
string(FIND ${source_file} "$<CONFIGURATION>" _pos)
if(NOT ${_pos} EQUAL -1)
# Must test with an actual configuration directory.
string(REPLACE "$<CONFIGURATION>" "Release" existing_source_file ${source_file})
if(NOT EXISTS ${existing_source_file})
string(REPLACE "$<CONFIGURATION>" "Debug" existing_source_file ${source_file})
endif()
else()
set(existing_source_file ${source_file})
endif()
if(IS_DIRECTORY ${existing_source_file})
add_custom_command(
TARGET ${target}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory "${source_file}" "${target_file}"
VERBATIM
)
else()
add_custom_command(
TARGET ${target}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${source_file}" "${target_file}"
VERBATIM
)
endif()
COPY_SINGLE_FILE(${target} ${source_file} ${target_file})
endforeach()
endmacro()
# Copy a list of files from one directory to another. Relative file paths are maintained.
macro(COPY_RESOURCES target file_list prefix_list source_dir target_dir)
foreach(FILENAME ${file_list})
set(source_file ${source_dir}/${FILENAME})
# Remove one or more prefixes from the source paths.
set(TARGET_FILENAME "${FILENAME}")
foreach(PREFIX ${prefix_list})
string(REGEX REPLACE "^.*${PREFIX}" "" TARGET_FILENAME ${TARGET_FILENAME})
endforeach()
set(target_file ${target_dir}/${TARGET_FILENAME})
COPY_SINGLE_FILE(${target} ${source_file} ${target_file})
endforeach()
endmacro()
macro(COPY_SINGLE_FILE target source_file target_file)
string(FIND ${source_file} "$<CONFIGURATION>" _pos)
if(NOT ${_pos} EQUAL -1)
# Must test with an actual configuration directory.
string(REPLACE "$<CONFIGURATION>" "Release" existing_source_file ${source_file})
if(NOT EXISTS ${existing_source_file})
string(REPLACE "$<CONFIGURATION>" "Debug" existing_source_file ${source_file})
endif()
else()
set(existing_source_file ${source_file})
endif()
if(IS_DIRECTORY ${existing_source_file})
add_custom_command(
TARGET ${target}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory "${source_file}" "${target_file}"
VERBATIM
)
else()
add_custom_command(
TARGET ${target}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${source_file}" "${target_file}"
VERBATIM
)
endif()
endmacro()
#
# Linux macros.

View File

@@ -26,18 +26,14 @@ endif()
# Determine the project architecture.
if(NOT DEFINED PROJECT_ARCH)
if(OS_WINDOWS AND "${CMAKE_GENERATOR_PLATFORM}" STREQUAL "arm64")
if(("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "arm64") OR
("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM64"))
set(PROJECT_ARCH "arm64")
elseif(CMAKE_SIZEOF_VOID_P MATCHES 8)
set(PROJECT_ARCH "x86_64")
else()
set(PROJECT_ARCH "x86")
endif()
if(OS_MAC)
# PROJECT_ARCH should be specified on Mac OS X.
message(WARNING "No PROJECT_ARCH value specified, using ${PROJECT_ARCH}")
endif()
endif()
if(${CMAKE_GENERATOR} STREQUAL "Ninja")
@@ -63,7 +59,7 @@ set(CEF_LIBCEF_DLL_WRAPPER_PATH "${_CEF_ROOT}/libcef_dll")
# Shared compiler/linker flags.
list(APPEND CEF_COMPILER_DEFINES
# Allow C++ programs to use stdint.h macros specified in the C99 standard that aren't
# Allow C++ programs to use stdint.h macros specified in the C99 standard that aren't
# in the C++ standard (e.g. UINT8_MAX, INT64_MIN, etc)
__STDC_CONSTANT_MACROS __STDC_FORMAT_MACROS
)
@@ -105,7 +101,7 @@ if(OS_LINUX)
-fno-rtti # Disable real-time type information
-fno-threadsafe-statics # Don't generate thread-safe statics
-fvisibility-inlines-hidden # Give hidden visibility to inlined class member functions
-std=c++14 # Use the C++14 language standard
-std=c++17 # Use the C++17 language standard
-Wsign-compare # Warn about mixed signed/unsigned type comparisons
)
list(APPEND CEF_COMPILER_FLAGS_DEBUG
@@ -227,7 +223,6 @@ if(OS_LINUX)
snapshot_blob.bin
v8_context_snapshot.bin
vk_swiftshader_icd.json
swiftshader
)
# List of CEF resource files.
@@ -277,7 +272,7 @@ if(OS_MAC)
-fno-threadsafe-statics # Don't generate thread-safe statics
-fobjc-call-cxx-cdtors # Call the constructor/destructor of C++ instance variables in ObjC objects
-fvisibility-inlines-hidden # Give hidden visibility to inlined class member functions
-std=c++14 # Use the C++14 language standard
-std=c++17 # Use the C++17 language standard
-Wno-narrowing # Don't warn about type narrowing
-Wsign-compare # Warn about mixed signed/unsigned type comparisons
)
@@ -309,13 +304,14 @@ if(OS_MAC)
# Standard libraries.
set(CEF_STANDARD_LIBS
-lpthread
"-framework Cocoa"
"-framework AppKit"
"-framework Cocoa"
"-framework IOSurface"
)
# Find the newest available base SDK.
execute_process(COMMAND xcode-select --print-path OUTPUT_VARIABLE XCODE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
foreach(OS_VERSION 10.15 10.14 10.13 10.12 10.11)
foreach(OS_VERSION 14.2 14.0 11.0)
set(SDK "${XCODE_PATH}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${OS_VERSION}.sdk")
if(NOT "${CMAKE_OSX_SYSROOT}" AND EXISTS "${SDK}" AND IS_DIRECTORY "${SDK}")
set(CMAKE_OSX_SYSROOT ${SDK})
@@ -323,7 +319,7 @@ if(OS_MAC)
endforeach()
# Target SDK.
set(CEF_TARGET_SDK "10.11")
set(CEF_TARGET_SDK "11.0")
list(APPEND CEF_COMPILER_FLAGS
-mmacosx-version-min=${CEF_TARGET_SDK}
)
@@ -351,6 +347,10 @@ if(OS_MAC)
CEF_USE_SANDBOX # Used by apps to test if the sandbox is enabled
)
list(APPEND CEF_STANDARD_LIBS
-lsandbox
)
# CEF sandbox library paths.
set(CEF_SANDBOX_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/cef_sandbox.a")
set(CEF_SANDBOX_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/cef_sandbox.a")
@@ -360,6 +360,7 @@ if(OS_MAC)
# Format is "<name suffix>:<target suffix>:<plist suffix>".
set(CEF_HELPER_APP_SUFFIXES
"::"
" (Alerts):_alerts:.alerts"
" (GPU):_gpu:.gpu"
" (Plugin):_plugin:.plugin"
" (Renderer):_renderer:.renderer"
@@ -427,17 +428,75 @@ if(OS_WINDOWS)
/Ob2 # Inline any suitable function
/GF # Enable string pooling
)
list(APPEND CEF_CXX_COMPILER_FLAGS
/std:c++17 # Use the C++17 language standard
)
list(APPEND CEF_LINKER_FLAGS_DEBUG
/DEBUG # Generate debug information
)
list(APPEND CEF_EXE_LINKER_FLAGS
/MANIFEST:NO # No default manifest (see ADD_WINDOWS_MANIFEST macro usage)
/LARGEADDRESSAWARE # Allow 32-bit processes to access 3GB of RAM
# Delayload most libraries as the dlls are simply not required at startup (or
# at all, depending on the process type). Some dlls open handles when they are
# loaded, and we may not want them to be loaded in renderers or other sandboxed
# processes. Conversely, some dlls must be loaded before sandbox lockdown. In
# unsandboxed processes they will load when first needed. The linker will
# automatically ignore anything which is not linked to the binary at all (it is
# harmless to have an unmatched /delayload). This list should be kept in sync
# with Chromium's "delayloads" target from the //build/config/win/BUILD.gn file.
/DELAYLOAD:api-ms-win-core-winrt-error-l1-1-0.dll
/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll
/DELAYLOAD:api-ms-win-core-winrt-string-l1-1-0.dll
/DELAYLOAD:advapi32.dll
/DELAYLOAD:comctl32.dll
/DELAYLOAD:comdlg32.dll
/DELAYLOAD:credui.dll
/DELAYLOAD:cryptui.dll
/DELAYLOAD:d3d11.dll
/DELAYLOAD:d3d9.dll
/DELAYLOAD:dwmapi.dll
/DELAYLOAD:dxgi.dll
/DELAYLOAD:dxva2.dll
/DELAYLOAD:esent.dll
/DELAYLOAD:gdi32.dll
/DELAYLOAD:hid.dll
/DELAYLOAD:imagehlp.dll
/DELAYLOAD:imm32.dll
/DELAYLOAD:msi.dll
/DELAYLOAD:netapi32.dll
/DELAYLOAD:ncrypt.dll
/DELAYLOAD:ole32.dll
/DELAYLOAD:oleacc.dll
/DELAYLOAD:propsys.dll
/DELAYLOAD:psapi.dll
/DELAYLOAD:rpcrt4.dll
/DELAYLOAD:rstrtmgr.dll
/DELAYLOAD:setupapi.dll
/DELAYLOAD:shell32.dll
/DELAYLOAD:shlwapi.dll
/DELAYLOAD:uiautomationcore.dll
/DELAYLOAD:urlmon.dll
/DELAYLOAD:user32.dll
/DELAYLOAD:usp10.dll
/DELAYLOAD:uxtheme.dll
/DELAYLOAD:wer.dll
/DELAYLOAD:wevtapi.dll
/DELAYLOAD:wininet.dll
/DELAYLOAD:winusb.dll
/DELAYLOAD:wsock32.dll
/DELAYLOAD:wtsapi32.dll
)
list(APPEND CEF_COMPILER_DEFINES
WIN32 _WIN32 _WINDOWS # Windows platform
UNICODE _UNICODE # Unicode build
WINVER=0x0601 _WIN32_WINNT=0x601 # Targeting Windows 7
# Targeting Windows 10. We can't say `=_WIN32_WINNT_WIN10` here because
# some files do `#if WINVER < 0x0600` without including windows.h before,
# and then _WIN32_WINNT_WIN10 isn't yet known to be 0x0A00.
WINVER=0x0A00
_WIN32_WINNT=0x0A00
NTDDI_VERSION=NTDDI_WIN10_FE
NOMINMAX # Use the standard's templated min/max
WIN32_LEAN_AND_MEAN # Exclude less common API declarations
_HAS_EXCEPTIONS=0 # Disable exceptions
@@ -446,6 +505,23 @@ if(OS_WINDOWS)
NDEBUG _NDEBUG # Not a debug build
)
if(PROJECT_ARCH STREQUAL "x86")
# Set the initial stack size to 0.5MiB, instead of the 1.5MiB minimum
# needed by CEF's main thread. This saves significant memory on threads
# (like those in the Windows thread pool, and others) whose stack size we
# can only control through this setting. The main thread (in 32-bit builds
# only) uses fibers to switch to a 4MiB stack at runtime via
# CefRunWinMainWithPreferredStackSize().
list(APPEND CEF_EXE_LINKER_FLAGS
/STACK:0x80000
)
else()
# Increase the initial stack size to 8MiB from the default 1MiB.
list(APPEND CEF_EXE_LINKER_FLAGS
/STACK:0x800000
)
endif()
# Standard libraries.
set(CEF_STANDARD_LIBS
comctl32.lib
@@ -468,6 +544,7 @@ if(OS_WINDOWS)
# List of CEF binary files.
set(CEF_BINARY_FILES
chrome_elf.dll
d3dcompiler_47.dll
libcef.dll
libEGL.dll
libGLESv2.dll
@@ -476,12 +553,12 @@ if(OS_WINDOWS)
vk_swiftshader.dll
vk_swiftshader_icd.json
vulkan-1.dll
swiftshader
)
if(NOT PROJECT_ARCH STREQUAL "arm64")
if(PROJECT_ARCH STREQUAL "x86_64")
list(APPEND CEF_BINARY_FILES
d3dcompiler_47.dll
dxil.dll
dxcompiler.dll
)
endif()
@@ -508,14 +585,18 @@ if(OS_WINDOWS)
Advapi32.lib
dbghelp.lib
Delayimp.lib
ntdll.lib
OleAut32.lib
PowrProf.lib
Propsys.lib
psapi.lib
SetupAPI.lib
Shell32.lib
Shcore.lib
Userenv.lib
version.lib
wbemuuid.lib
WindowsApp.lib
winmm.lib
)

View File

@@ -49,9 +49,11 @@
namespace base {
// A flag that can safely be set from one thread and read from other threads.
//
// This class IS NOT intended for synchronization between threads.
///
/// A flag that can safely be set from one thread and read from other threads.
///
/// This class IS NOT intended for synchronization between threads.
///
class AtomicFlag {
public:
AtomicFlag();
@@ -61,19 +63,26 @@ class AtomicFlag {
~AtomicFlag();
// Set the flag. Must always be called from the same thread.
///
/// Set the flag. Must always be called from the same thread.
///
void Set();
// Returns true iff the flag was set. If this returns true, the current thread
// is guaranteed to be synchronized with all memory operations on the thread
// which invoked Set() up until at least the first call to Set() on it.
///
/// Returns true iff the flag was set. If this returns true, the current
/// thread is guaranteed to be synchronized with all memory operations on the
/// thread which invoked Set() up until at least the first call to Set() on
/// it.
///
bool IsSet() const {
// Inline here: this has a measurable performance impact on base::WeakPtr.
return flag_.load(std::memory_order_acquire) != 0;
}
// Resets the flag. Be careful when using this: callers might not expect
// IsSet() to return false after returning true once.
///
/// Resets the flag. Be careful when using this: callers might not expect
/// IsSet() to return false after returning true once.
///
void UnsafeResetForTesting();
private:

View File

@@ -58,19 +58,25 @@ class AtomicRefCount {
explicit constexpr AtomicRefCount(int initial_value)
: ref_count_(initial_value) {}
// Increment a reference count.
// Returns the previous value of the count.
///
/// Increment a reference count.
/// Returns the previous value of the count.
///
int Increment() { return Increment(1); }
// Increment a reference count by "increment", which must exceed 0.
// Returns the previous value of the count.
///
/// Increment a reference count by "increment", which must exceed 0.
/// Returns the previous value of the count.
///
int Increment(int increment) {
return ref_count_.fetch_add(increment, std::memory_order_relaxed);
}
// Decrement a reference count, and return whether the result is non-zero.
// Insert barriers to ensure that state written before the reference count
// became zero will be visible to a thread that has just made the count zero.
///
/// Decrement a reference count, and return whether the result is non-zero.
/// Insert barriers to ensure that state written before the reference count
/// became zero will be visible to a thread that has just made the count zero.
///
bool Decrement() {
// TODO(jbroman): Technically this doesn't need to be an acquire operation
// unless the result is 1 (i.e., the ref count did indeed reach zero).
@@ -79,23 +85,29 @@ class AtomicRefCount {
return ref_count_.fetch_sub(1, std::memory_order_acq_rel) != 1;
}
// Return whether the reference count is one. If the reference count is used
// in the conventional way, a refrerence count of 1 implies that the current
// thread owns the reference and no other thread shares it. This call
// performs the test for a reference count of one, and performs the memory
// barrier needed for the owning thread to act on the object, knowing that it
// has exclusive access to the object.
///
/// Return whether the reference count is one. If the reference count is used
/// in the conventional way, a refrerence count of 1 implies that the current
/// thread owns the reference and no other thread shares it. This call
/// performs the test for a reference count of one, and performs the memory
/// barrier needed for the owning thread to act on the object, knowing that it
/// has exclusive access to the object.
///
bool IsOne() const { return ref_count_.load(std::memory_order_acquire) == 1; }
// Return whether the reference count is zero. With conventional object
// referencing counting, the object will be destroyed, so the reference count
// should never be zero. Hence this is generally used for a debug check.
///
/// Return whether the reference count is zero. With conventional object
/// referencing counting, the object will be destroyed, so the reference count
/// should never be zero. Hence this is generally used for a debug check.
///
bool IsZero() const {
return ref_count_.load(std::memory_order_acquire) == 0;
}
// Returns the current reference count (with no barriers). This is subtle, and
// should be used only for debugging.
///
/// Returns the current reference count (with no barriers). This is subtle,
/// and should be used only for debugging.
///
int SubtleRefCountForDebug() const {
return ref_count_.load(std::memory_order_relaxed);
}

View File

@@ -73,8 +73,9 @@ class AutoReset {
}
~AutoReset() {
if (scoped_variable_)
if (scoped_variable_) {
*scoped_variable_ = std::move(original_value_);
}
}
private:

View File

@@ -28,41 +28,42 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// -----------------------------------------------------------------------------
// Usage documentation
// -----------------------------------------------------------------------------
//
// Overview:
// base::BindOnce() and base::BindRepeating() are helpers for creating
// base::OnceCallback and base::RepeatingCallback objects respectively.
//
// For a runnable object of n-arity, the base::Bind*() family allows partial
// application of the first m arguments. The remaining n - m arguments must be
// passed when invoking the callback with Run().
//
// // The first argument is bound at callback creation; the remaining
// // two must be passed when calling Run() on the callback object.
// base::OnceCallback<long(int, long)> cb = base::BindOnce(
// [](short x, int y, long z) { return x * y * z; }, 42);
//
// When binding to a method, the receiver object must also be specified at
// callback creation time. When Run() is invoked, the method will be invoked on
// the specified receiver object.
//
// class C : public base::RefCounted<C> { void F(); };
// auto instance = base::MakeRefCounted<C>();
// auto cb = base::BindOnce(&C::F, instance);
// std::move(cb).Run(); // Identical to instance->F()
//
// See //docs/callback.md for the full documentation.
//
// -----------------------------------------------------------------------------
///
/// \file
/// base::BindOnce() and base::BindRepeating() are helpers for creating
/// base::OnceCallback and base::RepeatingCallback objects respectively.
///
/// For a runnable object of n-arity, the base::Bind*() family allows partial
/// application of the first m arguments. The remaining n - m arguments must be
/// passed when invoking the callback with Run().
///
/// <pre>
/// // The first argument is bound at callback creation; the remaining
/// // two must be passed when calling Run() on the callback object.
/// base::OnceCallback<long(int, long)> cb = base::BindOnce(
/// [](short x, int y, long z) { return x * y * z; }, 42);
/// </pre>
///
/// When binding to a method, the receiver object must also be specified at
/// callback creation time. When Run() is invoked, the method will be invoked on
/// the specified receiver object.
///
/// <pre>
/// class C : public base::RefCounted<C> { void F(); };
/// auto instance = base::MakeRefCounted<C>();
/// auto cb = base::BindOnce(&C::F, instance);
/// std::move(cb).Run(); // Identical to instance->F()
/// </pre>
///
/// See https://chromium.googlesource.com/chromium/src/+/lkgr/docs/callback.md
/// for the full documentation.
///
// Implementation notes
// -----------------------------------------------------------------------------
//
// If you're reading the implementation, before proceeding further, you should
// read the top comment of base/internal/cef_bind_internal.h for a definition of
// common terms and concepts.
// read the top comment of base/internal/cef_bind_internal.h for a definition
// of common terms and concepts.
#ifndef CEF_INCLUDE_BASE_CEF_BIND_H_
#define CEF_INCLUDE_BASE_CEF_BIND_H_
@@ -70,7 +71,7 @@
#if defined(USING_CHROMIUM_INCLUDES)
// When building CEF include the Chromium header directly.
#include "base/bind.h"
#include "base/functional/bind.h"
#else // !USING_CHROMIUM_INCLUDES
// The following is substantially similar to the Chromium implementation.
// If the Chromium implementation diverges the below implementation should be
@@ -83,7 +84,6 @@
#include "include/base/cef_build.h"
#include "include/base/cef_compiler_specific.h"
#include "include/base/cef_template_util.h"
#include "include/base/internal/cef_bind_internal.h"
#if defined(OS_APPLE) && !HAS_FEATURE(objc_arc)
@@ -92,40 +92,45 @@
namespace base {
// Bind as OnceCallback.
///
/// Bind as OnceCallback.
///
template <typename Functor, typename... Args>
inline OnceCallback<internal::MakeUnboundRunType<Functor, Args...>> BindOnce(
Functor&& functor,
Args&&... args) {
static_assert(!internal::IsOnceCallback<std::decay_t<Functor>>() ||
inline OnceCallback<cef_internal::MakeUnboundRunType<Functor, Args...>>
BindOnce(Functor&& functor, Args&&... args) {
static_assert(!cef_internal::IsOnceCallback<std::decay_t<Functor>>() ||
(std::is_rvalue_reference<Functor&&>() &&
!std::is_const<std::remove_reference_t<Functor>>()),
"BindOnce requires non-const rvalue for OnceCallback binding."
" I.e.: base::BindOnce(std::move(callback)).");
static_assert(
conjunction<
internal::AssertBindArgIsNotBasePassed<std::decay_t<Args>>...>::value,
std::conjunction<cef_internal::AssertBindArgIsNotBasePassed<
std::decay_t<Args>>...>::value,
"Use std::move() instead of base::Passed() with base::BindOnce()");
return internal::BindImpl<OnceCallback>(std::forward<Functor>(functor),
std::forward<Args>(args)...);
return cef_internal::BindImpl<OnceCallback>(std::forward<Functor>(functor),
std::forward<Args>(args)...);
}
// Bind as RepeatingCallback.
///
/// Bind as RepeatingCallback.
///
template <typename Functor, typename... Args>
inline RepeatingCallback<internal::MakeUnboundRunType<Functor, Args...>>
inline RepeatingCallback<cef_internal::MakeUnboundRunType<Functor, Args...>>
BindRepeating(Functor&& functor, Args&&... args) {
static_assert(
!internal::IsOnceCallback<std::decay_t<Functor>>(),
!cef_internal::IsOnceCallback<std::decay_t<Functor>>(),
"BindRepeating cannot bind OnceCallback. Use BindOnce with std::move().");
return internal::BindImpl<RepeatingCallback>(std::forward<Functor>(functor),
std::forward<Args>(args)...);
return cef_internal::BindImpl<RepeatingCallback>(
std::forward<Functor>(functor), std::forward<Args>(args)...);
}
// Special cases for binding to a base::Callback without extra bound arguments.
// We CHECK() the validity of callback to guard against null pointers
// accidentally ending up in posted tasks, causing hard-to-debug crashes.
///
/// Special cases for binding to a base::Callback without extra bound arguments.
/// We CHECK() the validity of callback to guard against null pointers
/// accidentally ending up in posted tasks, causing hard-to-debug crashes.
///
template <typename Signature>
OnceCallback<Signature> BindOnce(OnceCallback<Signature> callback) {
CHECK(callback);
@@ -145,198 +150,231 @@ RepeatingCallback<Signature> BindRepeating(
return callback;
}
// Unretained() allows binding a non-refcounted class, and to disable
// refcounting on arguments that are refcounted objects.
//
// EXAMPLE OF Unretained():
//
// class Foo {
// public:
// void func() { cout << "Foo:f" << endl; }
// };
//
// // In some function somewhere.
// Foo foo;
// OnceClosure foo_callback =
// BindOnce(&Foo::func, Unretained(&foo));
// std::move(foo_callback).Run(); // Prints "Foo:f".
//
// Without the Unretained() wrapper on |&foo|, the above call would fail
// to compile because Foo does not support the AddRef() and Release() methods.
///
/// Unretained() allows binding a non-refcounted class, and to disable
/// refcounting on arguments that are refcounted objects.
///
/// EXAMPLE OF Unretained():
///
/// <pre>
/// class Foo {
/// public:
/// void func() { cout << "Foo:f" << endl; }
/// };
///
/// // In some function somewhere.
/// Foo foo;
/// OnceClosure foo_callback =
/// BindOnce(&Foo::func, Unretained(&foo));
/// std::move(foo_callback).Run(); // Prints "Foo:f".
/// </pre>
///
/// Without the Unretained() wrapper on |&foo|, the above call would fail
/// to compile because Foo does not support the AddRef() and Release() methods.
///
template <typename T>
inline internal::UnretainedWrapper<T> Unretained(T* o) {
return internal::UnretainedWrapper<T>(o);
inline cef_internal::UnretainedWrapper<T> Unretained(T* o) {
return cef_internal::UnretainedWrapper<T>(o);
}
// RetainedRef() accepts a ref counted object and retains a reference to it.
// When the callback is called, the object is passed as a raw pointer.
//
// EXAMPLE OF RetainedRef():
//
// void foo(RefCountedBytes* bytes) {}
//
// scoped_refptr<RefCountedBytes> bytes = ...;
// OnceClosure callback = BindOnce(&foo, base::RetainedRef(bytes));
// std::move(callback).Run();
//
// Without RetainedRef, the scoped_refptr would try to implicitly convert to
// a raw pointer and fail compilation:
//
// OnceClosure callback = BindOnce(&foo, bytes); // ERROR!
///
/// RetainedRef() accepts a ref counted object and retains a reference to it.
/// When the callback is called, the object is passed as a raw pointer.
///
/// EXAMPLE OF RetainedRef():
///
/// <pre>
/// void foo(RefCountedBytes* bytes) {}
///
/// scoped_refptr<RefCountedBytes> bytes = ...;
/// OnceClosure callback = BindOnce(&foo, base::RetainedRef(bytes));
/// std::move(callback).Run();
/// </pre>
///
/// Without RetainedRef, the scoped_refptr would try to implicitly convert to
/// a raw pointer and fail compilation:
///
/// <pre>
/// OnceClosure callback = BindOnce(&foo, bytes); // ERROR!
/// </pre>
///
template <typename T>
inline internal::RetainedRefWrapper<T> RetainedRef(T* o) {
return internal::RetainedRefWrapper<T>(o);
inline cef_internal::RetainedRefWrapper<T> RetainedRef(T* o) {
return cef_internal::RetainedRefWrapper<T>(o);
}
template <typename T>
inline internal::RetainedRefWrapper<T> RetainedRef(scoped_refptr<T> o) {
return internal::RetainedRefWrapper<T>(std::move(o));
inline cef_internal::RetainedRefWrapper<T> RetainedRef(scoped_refptr<T> o) {
return cef_internal::RetainedRefWrapper<T>(std::move(o));
}
// Owned() transfers ownership of an object to the callback resulting from
// bind; the object will be deleted when the callback is deleted.
//
// EXAMPLE OF Owned():
//
// void foo(int* arg) { cout << *arg << endl }
//
// int* pn = new int(1);
// RepeatingClosure foo_callback = BindRepeating(&foo, Owned(pn));
//
// foo_callback.Run(); // Prints "1"
// foo_callback.Run(); // Prints "1"
// *pn = 2;
// foo_callback.Run(); // Prints "2"
//
// foo_callback.Reset(); // |pn| is deleted. Also will happen when
// // |foo_callback| goes out of scope.
//
// Without Owned(), someone would have to know to delete |pn| when the last
// reference to the callback is deleted.
///
/// Owned() transfers ownership of an object to the callback resulting from
/// bind; the object will be deleted when the callback is deleted.
///
/// EXAMPLE OF Owned():
///
/// <pre>
/// void foo(int* arg) { cout << *arg << endl }
///
/// int* pn = new int(1);
/// RepeatingClosure foo_callback = BindRepeating(&foo, Owned(pn));
///
/// foo_callback.Run(); // Prints "1"
/// foo_callback.Run(); // Prints "1"
/// *pn = 2;
/// foo_callback.Run(); // Prints "2"
///
/// foo_callback.Reset(); // |pn| is deleted. Also will happen when
/// // |foo_callback| goes out of scope.
/// </pre>
///
/// Without Owned(), someone would have to know to delete |pn| when the last
/// reference to the callback is deleted.
///
template <typename T>
inline internal::OwnedWrapper<T> Owned(T* o) {
return internal::OwnedWrapper<T>(o);
inline cef_internal::OwnedWrapper<T> Owned(T* o) {
return cef_internal::OwnedWrapper<T>(o);
}
template <typename T, typename Deleter>
inline internal::OwnedWrapper<T, Deleter> Owned(
inline cef_internal::OwnedWrapper<T, Deleter> Owned(
std::unique_ptr<T, Deleter>&& ptr) {
return internal::OwnedWrapper<T, Deleter>(std::move(ptr));
return cef_internal::OwnedWrapper<T, Deleter>(std::move(ptr));
}
// OwnedRef() stores an object in the callback resulting from
// bind and passes a reference to the object to the bound function.
//
// EXAMPLE OF OwnedRef():
//
// void foo(int& arg) { cout << ++arg << endl }
//
// int counter = 0;
// RepeatingClosure foo_callback = BindRepeating(&foo, OwnedRef(counter));
//
// foo_callback.Run(); // Prints "1"
// foo_callback.Run(); // Prints "2"
// foo_callback.Run(); // Prints "3"
//
// cout << counter; // Prints "0", OwnedRef creates a copy of counter.
//
// Supports OnceCallbacks as well, useful to pass placeholder arguments:
//
// void bar(int& ignore, const std::string& s) { cout << s << endl }
//
// OnceClosure bar_callback = BindOnce(&bar, OwnedRef(0), "Hello");
//
// std::move(bar_callback).Run(); // Prints "Hello"
//
// Without OwnedRef() it would not be possible to pass a mutable reference to an
// object owned by the callback.
///
/// OwnedRef() stores an object in the callback resulting from
/// bind and passes a reference to the object to the bound function.
///
/// EXAMPLE OF OwnedRef():
///
/// <pre>
/// void foo(int& arg) { cout << ++arg << endl }
///
/// int counter = 0;
/// RepeatingClosure foo_callback = BindRepeating(&foo, OwnedRef(counter));
///
/// foo_callback.Run(); // Prints "1"
/// foo_callback.Run(); // Prints "2"
/// foo_callback.Run(); // Prints "3"
///
/// cout << counter; // Prints "0", OwnedRef creates a copy of counter.
/// </pre>
///
/// Supports OnceCallbacks as well, useful to pass placeholder arguments:
///
/// <pre>
/// void bar(int& ignore, const std::string& s) { cout << s << endl }
///
/// OnceClosure bar_callback = BindOnce(&bar, OwnedRef(0), "Hello");
///
/// std::move(bar_callback).Run(); // Prints "Hello"
/// </pre>
///
/// Without OwnedRef() it would not be possible to pass a mutable reference to
/// an object owned by the callback.
///
template <typename T>
internal::OwnedRefWrapper<std::decay_t<T>> OwnedRef(T&& t) {
return internal::OwnedRefWrapper<std::decay_t<T>>(std::forward<T>(t));
cef_internal::OwnedRefWrapper<std::decay_t<T>> OwnedRef(T&& t) {
return cef_internal::OwnedRefWrapper<std::decay_t<T>>(std::forward<T>(t));
}
// Passed() is for transferring movable-but-not-copyable types (eg. unique_ptr)
// through a RepeatingCallback. Logically, this signifies a destructive transfer
// of the state of the argument into the target function. Invoking
// RepeatingCallback::Run() twice on a callback that was created with a Passed()
// argument will CHECK() because the first invocation would have already
// transferred ownership to the target function.
//
// Note that Passed() is not necessary with BindOnce(), as std::move() does the
// same thing. Avoid Passed() in favor of std::move() with BindOnce().
//
// EXAMPLE OF Passed():
//
// void TakesOwnership(std::unique_ptr<Foo> arg) { }
// std::unique_ptr<Foo> CreateFoo() { return std::make_unique<Foo>();
// }
//
// auto f = std::make_unique<Foo>();
//
// // |cb| is given ownership of Foo(). |f| is now NULL.
// // You can use std::move(f) in place of &f, but it's more verbose.
// RepeatingClosure cb = BindRepeating(&TakesOwnership, Passed(&f));
//
// // Run was never called so |cb| still owns Foo() and deletes
// // it on Reset().
// cb.Reset();
//
// // |cb| is given a new Foo created by CreateFoo().
// cb = BindRepeating(&TakesOwnership, Passed(CreateFoo()));
//
// // |arg| in TakesOwnership() is given ownership of Foo(). |cb|
// // no longer owns Foo() and, if reset, would not delete Foo().
// cb.Run(); // Foo() is now transferred to |arg| and deleted.
// cb.Run(); // This CHECK()s since Foo() already been used once.
//
// We offer 2 syntaxes for calling Passed(). The first takes an rvalue and is
// best suited for use with the return value of a function or other temporary
// rvalues. The second takes a pointer to the scoper and is just syntactic sugar
// to avoid having to write Passed(std::move(scoper)).
//
// Both versions of Passed() prevent T from being an lvalue reference. The first
// via use of enable_if, and the second takes a T* which will not bind to T&.
///
/// Passed() is for transferring movable-but-not-copyable types (eg. unique_ptr)
/// through a RepeatingCallback. Logically, this signifies a destructive
/// transfer of the state of the argument into the target function. Invoking
/// RepeatingCallback::Run() twice on a callback that was created with a
/// Passed() argument will CHECK() because the first invocation would have
/// already transferred ownership to the target function.
///
/// Note that Passed() is not necessary with BindOnce(), as std::move() does the
/// same thing. Avoid Passed() in favor of std::move() with BindOnce().
///
/// EXAMPLE OF Passed():
///
/// <pre>
/// void TakesOwnership(std::unique_ptr<Foo> arg) { }
/// std::unique_ptr<Foo> CreateFoo() { return std::make_unique<Foo>();
/// }
///
/// auto f = std::make_unique<Foo>();
///
/// // |cb| is given ownership of Foo(). |f| is now NULL.
/// // You can use std::move(f) in place of &f, but it's more verbose.
/// RepeatingClosure cb = BindRepeating(&TakesOwnership, Passed(&f));
///
/// // Run was never called so |cb| still owns Foo() and deletes
/// // it on Reset().
/// cb.Reset();
///
/// // |cb| is given a new Foo created by CreateFoo().
/// cb = BindRepeating(&TakesOwnership, Passed(CreateFoo()));
///
/// // |arg| in TakesOwnership() is given ownership of Foo(). |cb|
/// // no longer owns Foo() and, if reset, would not delete Foo().
/// cb.Run(); // Foo() is now transferred to |arg| and deleted.
/// cb.Run(); // This CHECK()s since Foo() already been used once.
/// </pre>
///
/// We offer 2 syntaxes for calling Passed(). The first takes an rvalue and is
/// best suited for use with the return value of a function or other temporary
/// rvalues. The second takes a pointer to the scoper and is just syntactic
/// sugar to avoid having to write Passed(std::move(scoper)).
///
/// Both versions of Passed() prevent T from being an lvalue reference. The
/// first via use of enable_if, and the second takes a T* which will not bind to
/// T&.
///
template <typename T,
std::enable_if_t<!std::is_lvalue_reference<T>::value>* = nullptr>
inline internal::PassedWrapper<T> Passed(T&& scoper) {
return internal::PassedWrapper<T>(std::move(scoper));
inline cef_internal::PassedWrapper<T> Passed(T&& scoper) {
return cef_internal::PassedWrapper<T>(std::move(scoper));
}
template <typename T>
inline internal::PassedWrapper<T> Passed(T* scoper) {
return internal::PassedWrapper<T>(std::move(*scoper));
inline cef_internal::PassedWrapper<T> Passed(T* scoper) {
return cef_internal::PassedWrapper<T>(std::move(*scoper));
}
// IgnoreResult() is used to adapt a function or callback with a return type to
// one with a void return. This is most useful if you have a function with,
// say, a pesky ignorable bool return that you want to use with PostTask or
// something else that expect a callback with a void return.
//
// EXAMPLE OF IgnoreResult():
//
// int DoSomething(int arg) { cout << arg << endl; }
//
// // Assign to a callback with a void return type.
// OnceCallback<void(int)> cb = BindOnce(IgnoreResult(&DoSomething));
// std::move(cb).Run(1); // Prints "1".
//
// // Prints "2" on |ml|.
// ml->PostTask(FROM_HERE, BindOnce(IgnoreResult(&DoSomething), 2);
///
/// IgnoreResult() is used to adapt a function or callback with a return type to
/// one with a void return. This is most useful if you have a function with,
/// say, a pesky ignorable bool return that you want to use with PostTask or
/// something else that expect a callback with a void return.
///
/// EXAMPLE OF IgnoreResult():
///
/// <pre>
/// int DoSomething(int arg) { cout << arg << endl; }
///
/// // Assign to a callback with a void return type.
/// OnceCallback<void(int)> cb = BindOnce(IgnoreResult(&DoSomething));
/// std::move(cb).Run(1); // Prints "1".
///
/// // Prints "2" on |ml|.
/// ml->PostTask(FROM_HERE, BindOnce(IgnoreResult(&DoSomething), 2);
/// </pre>
///
template <typename T>
inline internal::IgnoreResultHelper<T> IgnoreResult(T data) {
return internal::IgnoreResultHelper<T>(std::move(data));
inline cef_internal::IgnoreResultHelper<T> IgnoreResult(T data) {
return cef_internal::IgnoreResultHelper<T>(std::move(data));
}
#if defined(OS_APPLE) && !HAS_FEATURE(objc_arc)
// RetainBlock() is used to adapt an Objective-C block when Automated Reference
// Counting (ARC) is disabled. This is unnecessary when ARC is enabled, as the
// BindOnce and BindRepeating already support blocks then.
//
// EXAMPLE OF RetainBlock():
//
// // Wrap the block and bind it to a callback.
// OnceCallback<void(int)> cb =
// BindOnce(RetainBlock(^(int n) { NSLog(@"%d", n); }));
// std::move(cb).Run(1); // Logs "1".
///
/// RetainBlock() is used to adapt an Objective-C block when Automated Reference
/// Counting (ARC) is disabled. This is unnecessary when ARC is enabled, as the
/// BindOnce and BindRepeating already support blocks then.
///
/// EXAMPLE OF RetainBlock():
///
/// <pre>
/// // Wrap the block and bind it to a callback.
/// OnceCallback<void(int)> cb =
/// BindOnce(RetainBlock(^(int n) { NSLog(@"%d", n); }));
/// std::move(cb).Run(1); // Logs "1".
/// </pre>
///
template <typename R, typename... Args>
base::mac::ScopedBlock<R (^)(Args...)> RetainBlock(R (^block)(Args...)) {
return base::mac::ScopedBlock<R (^)(Args...)>(block,

View File

@@ -27,36 +27,40 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// This file adds defines about the platform we're currently building on.
//
// Operating System:
// OS_AIX / OS_ANDROID / OS_ASMJS / OS_FREEBSD / OS_FUCHSIA / OS_IOS /
// OS_LINUX / OS_MAC / OS_NACL (SFI or NONSFI) / OS_NETBSD / OS_OPENBSD /
// OS_QNX / OS_SOLARIS / OS_WIN
// Operating System family:
// OS_APPLE: IOS or MAC
// OS_BSD: FREEBSD or NETBSD or OPENBSD
// OS_POSIX: AIX or ANDROID or ASMJS or CHROMEOS or FREEBSD or IOS or LINUX
// or MAC or NACL or NETBSD or OPENBSD or QNX or SOLARIS
//
// /!\ Note: OS_CHROMEOS is set by the build system, not this file
//
// Compiler:
// COMPILER_MSVC / COMPILER_GCC
//
// Processor:
// ARCH_CPU_ARM64 / ARCH_CPU_ARMEL / ARCH_CPU_MIPS / ARCH_CPU_MIPS64 /
// ARCH_CPU_MIPS64EL / ARCH_CPU_MIPSEL / ARCH_CPU_PPC64 / ARCH_CPU_S390 /
// ARCH_CPU_S390X / ARCH_CPU_X86 / ARCH_CPU_X86_64
// Processor family:
// ARCH_CPU_ARM_FAMILY: ARMEL or ARM64
// ARCH_CPU_MIPS_FAMILY: MIPS64EL or MIPSEL or MIPS64 or MIPS
// ARCH_CPU_PPC64_FAMILY: PPC64
// ARCH_CPU_S390_FAMILY: S390 or S390X
// ARCH_CPU_X86_FAMILY: X86 or X86_64
// Processor features:
// ARCH_CPU_31_BITS / ARCH_CPU_32_BITS / ARCH_CPU_64_BITS
// ARCH_CPU_BIG_ENDIAN / ARCH_CPU_LITTLE_ENDIAN
/// \file
/// This file adds defines about the platform we're currently building on.
///
/// <pre>
/// Operating System:
/// OS_AIX / OS_ANDROID / OS_ASMJS / OS_FREEBSD / OS_FUCHSIA / OS_IOS /
/// OS_LINUX / OS_MAC / OS_NACL (SFI or NONSFI) / OS_NETBSD / OS_OPENBSD /
/// OS_QNX / OS_SOLARIS / OS_WIN
/// Operating System family:
/// OS_APPLE: IOS or MAC
/// OS_BSD: FREEBSD or NETBSD or OPENBSD
/// OS_POSIX: AIX or ANDROID or ASMJS or CHROMEOS or FREEBSD or IOS or LINUX
/// or MAC or NACL or NETBSD or OPENBSD or QNX or SOLARIS
///
/// /!\ Note: OS_CHROMEOS is set by the build system, not this file
///
/// Compiler:
/// COMPILER_MSVC / COMPILER_GCC
///
/// Processor:
/// ARCH_CPU_ARM64 / ARCH_CPU_ARMEL / ARCH_CPU_MIPS / ARCH_CPU_MIPS64 /
/// ARCH_CPU_MIPS64EL / ARCH_CPU_MIPSEL / ARCH_CPU_PPC64 / ARCH_CPU_S390 /
/// ARCH_CPU_S390X / ARCH_CPU_X86 / ARCH_CPU_X86_64
/// Processor family:
/// ARCH_CPU_ARM_FAMILY: ARMEL or ARM64
/// ARCH_CPU_MIPS_FAMILY: MIPS64EL or MIPSEL or MIPS64 or MIPS
/// ARCH_CPU_PPC64_FAMILY: PPC64
/// ARCH_CPU_S390_FAMILY: S390 or S390X
/// ARCH_CPU_X86_FAMILY: X86 or X86_64
/// Processor features:
/// ARCH_CPU_31_BITS / ARCH_CPU_32_BITS / ARCH_CPU_64_BITS
/// ARCH_CPU_BIG_ENDIAN / ARCH_CPU_LITTLE_ENDIAN
/// </pre>
///
#ifndef CEF_INCLUDE_BASE_CEF_BUILD_H_
#define CEF_INCLUDE_BASE_CEF_BUILD_H_
@@ -65,7 +69,24 @@
#if defined(USING_CHROMIUM_INCLUDES)
// When building CEF include the Chromium header directly.
#include "build/build_config.h"
#include "cef/libcef/features/features.h"
// The following #defines are used in cef/include/ headers and CEF client-side
// code. CEF library-side code should use BUILDFLAG checks directly instead of
// these #defines. CEF client-side code will get these #defines from
// cef_config.h so any changes must also be reflected in
// tools/make_config_header.py.
#if BUILDFLAG(IS_LINUX)
#include "ui/base/ozone_buildflags.h"
#if BUILDFLAG(IS_OZONE_X11)
#define CEF_X11 1
#endif
#endif
#else // !USING_CHROMIUM_INCLUDES
#include "include/cef_config.h"
// The following is substantially similar to the Chromium implementation.
// If the Chromium implementation diverges the below implementation should be
// updated to match.
@@ -228,19 +249,19 @@
// Type detection for wchar_t.
#if defined(OS_WIN)
#define WCHAR_T_IS_UTF16
#define WCHAR_T_IS_16_BIT
#elif defined(OS_FUCHSIA)
#define WCHAR_T_IS_UTF32
#define WCHAR_T_IS_32_BIT
#elif defined(OS_POSIX) && defined(COMPILER_GCC) && defined(__WCHAR_MAX__) && \
(__WCHAR_MAX__ == 0x7fffffff || __WCHAR_MAX__ == 0xffffffff)
#define WCHAR_T_IS_UTF32
#define WCHAR_T_IS_32_BIT
#elif defined(OS_POSIX) && defined(COMPILER_GCC) && defined(__WCHAR_MAX__) && \
(__WCHAR_MAX__ == 0x7fff || __WCHAR_MAX__ == 0xffff)
// On Posix, we'll detect short wchar_t, but projects aren't guaranteed to
// compile in this mode (in particular, Chrome doesn't). This is intended for
// other projects using base who manage their own dependencies and make sure
// short wchar works for them.
#define WCHAR_T_IS_UTF16
#define WCHAR_T_IS_16_BIT
#else
#error Please add support for your compiler in include/base/cef_build.h
#endif
@@ -249,7 +270,7 @@
// The compiler thinks std::string::const_iterator and "const char*" are
// equivalent types.
#define STD_STRING_ITERATOR_IS_CHAR_POINTER
// The compiler thinks std::u16string::const_iterator and "char16*" are
// The compiler thinks std::u16string::const_iterator and "char16_t*" are
// equivalent types.
#define BASE_STRING16_ITERATOR_IS_CHAR16_POINTER
#endif

View File

@@ -28,40 +28,38 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// -----------------------------------------------------------------------------
// Usage documentation
// -----------------------------------------------------------------------------
//
// Overview:
// A callback is similar in concept to a function pointer: it wraps a runnable
// object such as a function, method, lambda, or even another callback, allowing
// the runnable object to be invoked later via the callback object.
//
// Unlike function pointers, callbacks are created with base::BindOnce() or
// base::BindRepeating() and support partial function application.
//
// A base::OnceCallback may be Run() at most once; a base::RepeatingCallback may
// be Run() any number of times. |is_null()| is guaranteed to return true for a
// moved-from callback.
//
// // The lambda takes two arguments, but the first argument |x| is bound at
// // callback creation.
// base::OnceCallback<int(int)> cb = base::BindOnce([] (int x, int y) {
// return x + y;
// }, 1);
// // Run() only needs the remaining unbound argument |y|.
// printf("1 + 2 = %d\n", std::move(cb).Run(2)); // Prints 3
// printf("cb is null? %s\n",
// cb.is_null() ? "true" : "false"); // Prints true
// std::move(cb).Run(2); // Crashes since |cb| has already run.
//
// Callbacks also support cancellation. A common use is binding the receiver
// object as a WeakPtr<T>. If that weak pointer is invalidated, calling Run()
// will be a no-op. Note that |IsCancelled()| and |is_null()| are distinct:
// simply cancelling a callback will not also make it null.
//
// See https://chromium.googlesource.com/chromium/src/+/HEAD/docs/callback.md
// for the full documentation.
/// \file
/// A callback is similar in concept to a function pointer: it wraps a runnable
/// object such as a function, method, lambda, or even another callback,
/// allowing the runnable object to be invoked later via the callback object.
///
/// Unlike function pointers, callbacks are created with base::BindOnce() or
/// base::BindRepeating() and support partial function application.
///
/// A base::OnceCallback may be Run() at most once; a base::RepeatingCallback
/// may be Run() any number of times. |is_null()| is guaranteed to return true
/// for a moved-from callback.
///
/// <pre>
/// // The lambda takes two arguments, but the first argument |x| is bound at
/// // callback creation.
/// base::OnceCallback<int(int)> cb = base::BindOnce([] (int x, int y) {
/// return x + y;
/// }, 1);
/// // Run() only needs the remaining unbound argument |y|.
/// printf("1 + 2 = %d\n", std::move(cb).Run(2)); // Prints 3
/// printf("cb is null? %s\n",
/// cb.is_null() ? "true" : "false"); // Prints true
/// std::move(cb).Run(2); // Crashes since |cb| has already run.
/// </pre>
///
/// Callbacks also support cancellation. A common use is binding the receiver
/// object as a WeakPtr<T>. If that weak pointer is invalidated, calling Run()
/// will be a no-op. Note that |IsCancelled()| and |is_null()| are distinct:
/// simply cancelling a callback will not also make it null.
///
/// See https://chromium.googlesource.com/chromium/src/+/lkgr/docs/callback.md
/// for the full documentation.
#ifndef CEF_INCLUDE_BASE_CEF_CALLBACK_H_
#define CEF_INCLUDE_BASE_CEF_CALLBACK_H_
@@ -69,7 +67,7 @@
#if defined(USING_CHROMIUM_INCLUDES)
// When building CEF include the Chromium header directly.
#include "base/callback.h"
#include "base/functional/callback.h"
#else // !USING_CHROMIUM_INCLUDES
// The following is substantially similar to the Chromium implementation.
// If the Chromium implementation diverges the below implementation should be
@@ -85,18 +83,18 @@
namespace base {
template <typename R, typename... Args>
class OnceCallback<R(Args...)> : public internal::CallbackBase {
class OnceCallback<R(Args...)> : public cef_internal::CallbackBase {
public:
using ResultType = R;
using RunType = R(Args...);
using PolymorphicInvoke = R (*)(internal::BindStateBase*,
internal::PassingType<Args>...);
using PolymorphicInvoke = R (*)(cef_internal::BindStateBase*,
cef_internal::PassingType<Args>...);
constexpr OnceCallback() = default;
OnceCallback(std::nullptr_t) = delete;
explicit OnceCallback(internal::BindStateBase* bind_state)
: internal::CallbackBase(bind_state) {}
explicit OnceCallback(cef_internal::BindStateBase* bind_state)
: cef_internal::CallbackBase(bind_state) {}
OnceCallback(const OnceCallback&) = delete;
OnceCallback& operator=(const OnceCallback&) = delete;
@@ -105,10 +103,10 @@ class OnceCallback<R(Args...)> : public internal::CallbackBase {
OnceCallback& operator=(OnceCallback&&) noexcept = default;
OnceCallback(RepeatingCallback<RunType> other)
: internal::CallbackBase(std::move(other)) {}
: cef_internal::CallbackBase(std::move(other)) {}
OnceCallback& operator=(RepeatingCallback<RunType> other) {
static_cast<internal::CallbackBase&>(*this) = std::move(other);
static_cast<cef_internal::CallbackBase&>(*this) = std::move(other);
return *this;
}
@@ -144,7 +142,7 @@ class OnceCallback<R(Args...)> : public internal::CallbackBase {
OnceCallback<ThenR(Args...)> Then(OnceCallback<ThenR(ThenArgs...)> then) && {
CHECK(then);
return BindOnce(
internal::ThenHelper<
cef_internal::ThenHelper<
OnceCallback, OnceCallback<ThenR(ThenArgs...)>>::CreateTrampoline(),
std::move(*this), std::move(then));
}
@@ -157,7 +155,7 @@ class OnceCallback<R(Args...)> : public internal::CallbackBase {
RepeatingCallback<ThenR(ThenArgs...)> then) && {
CHECK(then);
return BindOnce(
internal::ThenHelper<
cef_internal::ThenHelper<
OnceCallback,
RepeatingCallback<ThenR(ThenArgs...)>>::CreateTrampoline(),
std::move(*this), std::move(then));
@@ -165,18 +163,19 @@ class OnceCallback<R(Args...)> : public internal::CallbackBase {
};
template <typename R, typename... Args>
class RepeatingCallback<R(Args...)> : public internal::CallbackBaseCopyable {
class RepeatingCallback<R(Args...)>
: public cef_internal::CallbackBaseCopyable {
public:
using ResultType = R;
using RunType = R(Args...);
using PolymorphicInvoke = R (*)(internal::BindStateBase*,
internal::PassingType<Args>...);
using PolymorphicInvoke = R (*)(cef_internal::BindStateBase*,
cef_internal::PassingType<Args>...);
constexpr RepeatingCallback() = default;
RepeatingCallback(std::nullptr_t) = delete;
explicit RepeatingCallback(internal::BindStateBase* bind_state)
: internal::CallbackBaseCopyable(bind_state) {}
explicit RepeatingCallback(cef_internal::BindStateBase* bind_state)
: cef_internal::CallbackBaseCopyable(bind_state) {}
// Copyable and movable.
RepeatingCallback(const RepeatingCallback&) = default;
@@ -226,7 +225,7 @@ class RepeatingCallback<R(Args...)> : public internal::CallbackBaseCopyable {
RepeatingCallback<ThenR(ThenArgs...)> then) const& {
CHECK(then);
return BindRepeating(
internal::ThenHelper<
cef_internal::ThenHelper<
RepeatingCallback,
RepeatingCallback<ThenR(ThenArgs...)>>::CreateTrampoline(),
*this, std::move(then));
@@ -237,7 +236,7 @@ class RepeatingCallback<R(Args...)> : public internal::CallbackBaseCopyable {
RepeatingCallback<ThenR(ThenArgs...)> then) && {
CHECK(then);
return BindRepeating(
internal::ThenHelper<
cef_internal::ThenHelper<
RepeatingCallback,
RepeatingCallback<ThenR(ThenArgs...)>>::CreateTrampoline(),
std::move(*this), std::move(then));

View File

@@ -34,7 +34,7 @@
#if defined(USING_CHROMIUM_INCLUDES)
// When building CEF include the Chromium header directly.
#include "base/callback_forward.h"
#include "base/functional/callback_forward.h"
#else // !USING_CHROMIUM_INCLUDES
// The following is substantially similar to the Chromium implementation.
// If the Chromium implementation diverges the below implementation should be
@@ -48,9 +48,11 @@ class OnceCallback;
template <typename Signature>
class RepeatingCallback;
// Syntactic sugar to make OnceClosure<void()> and RepeatingClosure<void()>
// easier to declare since they will be used in a lot of APIs with delayed
// execution.
///
/// Syntactic sugar to make OnceClosure<void()> and RepeatingClosure<void()>
/// easier to declare since they will be used in a lot of APIs with delayed
/// execution.
///
using OnceClosure = OnceCallback<void()>;
using RepeatingClosure = RepeatingCallback<void()>;

View File

@@ -39,7 +39,7 @@
#if defined(USING_CHROMIUM_INCLUDES)
// When building CEF include the Chromium header directly.
#include "base/callback_helpers.h"
#include "base/functional/callback_helpers.h"
#else // !USING_CHROMIUM_INCLUDES
// The following is substantially similar to the Chromium implementation.
// If the Chromium implementation diverges the below implementation should be
@@ -52,7 +52,6 @@
#include "include/base/cef_bind.h"
#include "include/base/cef_callback.h"
#include "include/base/cef_compiler_specific.h"
#include "include/base/cef_logging.h"
namespace base {
@@ -76,24 +75,32 @@ struct IsOnceCallbackImpl<OnceCallback<R(Args...)>> : std::true_type {};
} // namespace internal
// IsBaseCallback<T>::value is true when T is any of the Closure or Callback
// family of types.
///
/// IsBaseCallback<T>::value is true when T is any of the Closure or Callback
/// family of types.
///
template <typename T>
using IsBaseCallback = internal::IsBaseCallbackImpl<std::decay_t<T>>;
// IsOnceCallback<T>::value is true when T is a OnceClosure or OnceCallback
// type.
///
/// IsOnceCallback<T>::value is true when T is a OnceClosure or OnceCallback
/// type.
///
template <typename T>
using IsOnceCallback = internal::IsOnceCallbackImpl<std::decay_t<T>>;
// SFINAE friendly enabler allowing to overload methods for both Repeating and
// OnceCallbacks.
//
// Usage:
// template <template <typename> class CallbackType,
// ... other template args ...,
// typename = EnableIfIsBaseCallback<CallbackType>>
// void DoStuff(CallbackType<...> cb, ...);
///
/// SFINAE friendly enabler allowing to overload methods for both Repeating and
/// OnceCallbacks.
///
/// Usage:
/// <pre>
/// template <template <typename> class CallbackType,
/// ... other template args ...,
/// typename = EnableIfIsBaseCallback<CallbackType>>
/// void DoStuff(CallbackType<...> cb, ...);
/// </pre>
///
template <template <typename> class CallbackType>
using EnableIfIsBaseCallback =
std::enable_if_t<IsBaseCallback<CallbackType<void()>>::value>;
@@ -130,13 +137,16 @@ class OnceCallbackHolder final {
} // namespace internal
// Wraps the given OnceCallback into a RepeatingCallback that relays its
// invocation to the original OnceCallback on the first invocation. The
// following invocations are just ignored.
//
// Note that this deliberately subverts the Once/Repeating paradigm of Callbacks
// but helps ease the migration from old-style Callbacks. Avoid if possible; use
// if necessary for migration. TODO(tzik): Remove it. https://crbug.com/730593
///
/// Wraps the given OnceCallback into a RepeatingCallback that relays its
/// invocation to the original OnceCallback on the first invocation. The
/// following invocations are just ignored.
///
/// Note that this deliberately subverts the Once/Repeating paradigm of
/// Callbacks but helps ease the migration from old-style Callbacks. Avoid if
/// possible; use if necessary for migration.
///
// TODO(tzik): Remove it. https://crbug.com/730593
template <typename... Args>
RepeatingCallback<void(Args...)> AdaptCallbackForRepeating(
OnceCallback<void(Args...)> callback) {
@@ -146,9 +156,11 @@ RepeatingCallback<void(Args...)> AdaptCallbackForRepeating(
/*ignore_extra_runs=*/true));
}
// Wraps the given OnceCallback and returns two OnceCallbacks with an identical
// signature. On first invokation of either returned callbacks, the original
// callback is invoked. Invoking the remaining callback results in a crash.
///
/// Wraps the given OnceCallback and returns two OnceCallbacks with an identical
/// signature. On first invokation of either returned callbacks, the original
/// callback is invoked. Invoking the remaining callback results in a crash.
///
template <typename... Args>
std::pair<OnceCallback<void(Args...)>, OnceCallback<void(Args...)>>
SplitOnceCallback(OnceCallback<void(Args...)> callback) {
@@ -159,10 +171,12 @@ SplitOnceCallback(OnceCallback<void(Args...)> callback) {
return std::make_pair(wrapped_once, wrapped_once);
}
// ScopedClosureRunner is akin to std::unique_ptr<> for Closures. It ensures
// that the Closure is executed no matter how the current scope exits.
// If you are looking for "ScopedCallback", "CallbackRunner", or
// "CallbackScoper" this is the class you want.
///
/// ScopedClosureRunner is akin to std::unique_ptr<> for Closures. It ensures
/// that the Closure is executed no matter how the current scope exits.
/// If you are looking for "ScopedCallback", "CallbackRunner", or
/// "CallbackScoper" this is the class you want.
///
class ScopedClosureRunner {
public:
ScopedClosureRunner();
@@ -184,13 +198,15 @@ class ScopedClosureRunner {
void ReplaceClosure(OnceClosure closure);
// Releases the Closure without calling.
OnceClosure Release() WARN_UNUSED_RESULT;
[[nodiscard]] OnceClosure Release();
private:
OnceClosure closure_;
};
// Creates a null callback.
///
/// Creates a null callback.
///
class NullCallback {
public:
template <typename R, typename... Args>
@@ -203,7 +219,9 @@ class NullCallback {
}
};
// Creates a callback that does nothing when called.
///
/// Creates a callback that does nothing when called.
///
class DoNothing {
public:
template <typename... Args>
@@ -226,9 +244,11 @@ class DoNothing {
}
};
// Useful for creating a Closure that will delete a pointer when invoked. Only
// use this when necessary. In most cases MessageLoop::DeleteSoon() is a better
// fit.
///
/// Useful for creating a Closure that will delete a pointer when invoked. Only
/// use this when necessary. In most cases MessageLoop::DeleteSoon() is a better
/// fit.
///
template <typename T>
void DeletePointer(T* obj) {
delete obj;

View File

@@ -28,54 +28,57 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// OVERVIEW:
//
// A container for a list of callbacks. Provides callers the ability to manually
// or automatically unregister callbacks at any time, including during callback
// notification.
//
// TYPICAL USAGE:
//
// class MyWidget {
// public:
// using CallbackList = base::RepeatingCallbackList<void(const Foo&)>;
//
// // Registers |cb| to be called whenever NotifyFoo() is executed.
// CallbackListSubscription RegisterCallback(CallbackList::CallbackType cb) {
// return callback_list_.Add(std::move(cb));
// }
//
// private:
// // Calls all registered callbacks, with |foo| as the supplied arg.
// void NotifyFoo(const Foo& foo) {
// callback_list_.Notify(foo);
// }
//
// CallbackList callback_list_;
// };
//
//
// class MyWidgetListener {
// private:
// void OnFoo(const Foo& foo) {
// // Called whenever MyWidget::NotifyFoo() is executed, unless
// // |foo_subscription_| has been destroyed.
// }
//
// // Automatically deregisters the callback when deleted (e.g. in
// // ~MyWidgetListener()). Unretained(this) is safe here since the
// // ScopedClosureRunner does not outlive |this|.
// CallbackListSubscription foo_subscription_ =
// MyWidget::Get()->RegisterCallback(
// base::BindRepeating(&MyWidgetListener::OnFoo,
// base::Unretained(this)));
// };
//
// UNSUPPORTED:
//
// * Destroying the CallbackList during callback notification.
//
// This is possible to support, but not currently necessary.
///
/// \file
/// A container for a list of callbacks. Provides callers the ability to
/// manually or automatically unregister callbacks at any time, including during
/// callback notification.
///
/// TYPICAL USAGE:
///
/// <pre>
/// class MyWidget {
/// public:
/// using CallbackList = base::RepeatingCallbackList<void(const Foo&)>;
///
/// // Registers |cb| to be called whenever NotifyFoo() is executed.
/// CallbackListSubscription RegisterCallback(CallbackList::CallbackType cb) {
/// return callback_list_.Add(std::move(cb));
/// }
///
/// private:
/// // Calls all registered callbacks, with |foo| as the supplied arg.
/// void NotifyFoo(const Foo& foo) {
/// callback_list_.Notify(foo);
/// }
///
/// CallbackList callback_list_;
/// };
///
///
/// class MyWidgetListener {
/// private:
/// void OnFoo(const Foo& foo) {
/// // Called whenever MyWidget::NotifyFoo() is executed, unless
/// // |foo_subscription_| has been destroyed.
/// }
///
/// // Automatically deregisters the callback when deleted (e.g. in
/// // ~MyWidgetListener()). Unretained(this) is safe here since the
/// // ScopedClosureRunner does not outlive |this|.
/// CallbackListSubscription foo_subscription_ =
/// MyWidget::Get()->RegisterCallback(
/// base::BindRepeating(&MyWidgetListener::OnFoo,
/// base::Unretained(this)));
/// };
/// </pre>
///
/// UNSUPPORTED:
///
/// * Destroying the CallbackList during callback notification.
///
/// This is possible to support, but not currently necessary.
///
#ifndef CEF_INCLUDE_BASE_CEF_CALLBACK_LIST_H_
#define CEF_INCLUDE_BASE_CEF_CALLBACK_LIST_H_
@@ -83,7 +86,7 @@
#if defined(USING_CHROMIUM_INCLUDES)
// When building CEF include the Chromium header directly.
#include "base/callback_list.h"
#include "base/functional/callback_list.h"
#else // !USING_CHROMIUM_INCLUDES
// The following is substantially similar to the Chromium implementation.
// If the Chromium implementation diverges the below implementation should be
@@ -98,7 +101,6 @@
#include "include/base/cef_bind.h"
#include "include/base/cef_callback.h"
#include "include/base/cef_callback_helpers.h"
#include "include/base/cef_compiler_specific.h"
#include "include/base/cef_logging.h"
#include "include/base/cef_weak_ptr.h"
@@ -191,7 +193,7 @@ class CallbackListBase {
// Registers |cb| for future notifications. Returns a CallbackListSubscription
// whose destruction will cancel |cb|.
CallbackListSubscription Add(CallbackType cb) WARN_UNUSED_RESULT {
[[nodiscard]] CallbackListSubscription Add(CallbackType cb) {
DCHECK(!cb.is_null());
return CallbackListSubscription(base::BindOnce(
&CallbackListBase::CancelCallback, weak_ptr_factory_.GetWeakPtr(),
@@ -240,8 +242,9 @@ class CallbackListBase {
// the reentrant Notify() call.
template <typename... RunArgs>
void Notify(RunArgs&&... args) {
if (empty())
if (empty()) {
return; // Nothing to do.
}
{
AutoReset<bool> iterating(&iterating_, true);
@@ -255,18 +258,20 @@ class CallbackListBase {
});
};
for (auto it = next_valid(callbacks_.begin()); it != callbacks_.end();
it = next_valid(it))
it = next_valid(it)) {
// NOTE: Intentionally does not call std::forward<RunArgs>(args)...,
// since that would allow move-only arguments.
static_cast<CallbackListImpl*>(this)->RunCallback(it++, args...);
}
}
// Re-entrant invocations shouldn't prune anything from the list. This can
// invalidate iterators from underneath higher call frames. It's safe to
// simply do nothing, since the outermost frame will continue through here
// and prune all null callbacks below.
if (iterating_)
if (iterating_) {
return;
}
// Any null callbacks remaining in the list were canceled due to
// Subscription destruction during iteration, and can safely be erased now.
@@ -280,8 +285,9 @@ class CallbackListBase {
// that were executed above have all been removed regardless of whether
// they're counted in |erased_callbacks_|.
if (removal_callback_ &&
(erased_callbacks || IsOnceCallback<CallbackType>::value))
(erased_callbacks || IsOnceCallback<CallbackType>::value)) {
removal_callback_.Run(); // May delete |this|!
}
}
protected:
@@ -293,8 +299,9 @@ class CallbackListBase {
private:
// Cancels the callback pointed to by |it|, which is guaranteed to be valid.
void CancelCallback(const typename Callbacks::iterator& it) {
if (static_cast<CallbackListImpl*>(this)->CancelNullCallback(it))
if (static_cast<CallbackListImpl*>(this)->CancelNullCallback(it)) {
return;
}
if (iterating_) {
// Calling erase() here is unsafe, since the loop in Notify() may be
@@ -304,8 +311,9 @@ class CallbackListBase {
it->Reset();
} else {
callbacks_.erase(it);
if (removal_callback_)
if (removal_callback_) {
removal_callback_.Run(); // May delete |this|!
}
}
}
@@ -382,9 +390,9 @@ class RepeatingCallbackList
}
};
// Syntactic sugar to parallel that used for Callbacks.
// ClosureList explicitly not provided since it is not used, and CallbackList
// is deprecated. {Once,Repeating}ClosureList should instead be used.
///
/// Syntactic sugar to parallel that used for Callbacks.
///
using OnceClosureList = OnceCallbackList<void()>;
using RepeatingClosureList = RepeatingCallbackList<void()>;

View File

@@ -28,44 +28,51 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// CancelableCallback is a wrapper around base::Callback that allows
// cancellation of a callback. CancelableCallback takes a reference on the
// wrapped callback until this object is destroyed or Reset()/Cancel() are
// called.
//
// NOTE:
//
// Calling CancelableCallback::Cancel() brings the object back to its natural,
// default-constructed state, i.e., CancelableCallback::callback() will return
// a null callback.
//
// THREAD-SAFETY:
//
// CancelableCallback objects must be created on, posted to, cancelled on, and
// destroyed on the same thread.
//
//
// EXAMPLE USAGE:
//
// In the following example, the test is verifying that RunIntensiveTest()
// Quit()s the message loop within 4 seconds. The cancelable callback is posted
// to the message loop, the intensive test runs, the message loop is run,
// then the callback is cancelled.
//
// RunLoop run_loop;
//
// void TimeoutCallback(const std::string& timeout_message) {
// FAIL() << timeout_message;
// run_loop.QuitWhenIdle();
// }
//
// CancelableOnceClosure timeout(
// base::BindOnce(&TimeoutCallback, "Test timed out."));
// ThreadTaskRunnerHandle::Get()->PostDelayedTask(FROM_HERE, timeout.callback(),
// TimeDelta::FromSeconds(4));
// RunIntensiveTest();
// run_loop.Run();
// timeout.Cancel(); // Hopefully this is hit before the timeout callback runs.
///
/// \file
/// CancelableCallback is a wrapper around base::Callback that allows
/// cancellation of a callback. CancelableCallback takes a reference on the
/// wrapped callback until this object is destroyed or Reset()/Cancel() are
/// called.
///
/// NOTE:
///
/// Calling CancelableCallback::Cancel() brings the object back to its natural,
/// default-constructed state, i.e., CancelableCallback::callback() will return
/// a null callback.
///
/// THREAD-SAFETY:
///
/// CancelableCallback objects must be created on, posted to, cancelled on, and
/// destroyed on the same thread.
///
///
/// EXAMPLE USAGE:
///
/// In the following example, the test is verifying that RunIntensiveTest()
/// Quit()s the message loop within 4 seconds. The cancelable callback is posted
/// to the message loop, the intensive test runs, the message loop is run,
/// then the callback is cancelled.
///
/// <pre>
/// RunLoop run_loop;
///
/// void TimeoutCallback(const std::string& timeout_message) {
/// FAIL() << timeout_message;
/// run_loop.QuitWhenIdle();
/// }
///
/// CancelableOnceClosure timeout(
/// base::BindOnce(&TimeoutCallback, "Test timed out."));
/// ThreadTaskRunnerHandle::Get()->PostDelayedTask(FROM_HERE,
/// timeout.callback(),
/// TimeDelta::FromSeconds(4));
/// RunIntensiveTest();
/// run_loop.Run();
/// // Hopefully this is hit before the timeout callback runs.
/// timeout.Cancel();
/// </pre>
///
#ifndef CEF_INCLUDE_BASE_CEF_CANCELABLE_CALLBACK_H_
#define CEF_INCLUDE_BASE_CEF_CANCELABLE_CALLBACK_H_
@@ -126,8 +133,9 @@ class CancelableCallbackImpl {
// Returns a callback that can be disabled by calling Cancel().
CallbackType callback() const {
if (!callback_)
if (!callback_) {
return CallbackType();
}
CallbackType forwarder;
MakeForwarder(&forwarder);
return forwarder;
@@ -166,8 +174,10 @@ class CancelableCallbackImpl {
} // namespace internal
// Consider using base::WeakPtr directly instead of base::CancelableCallback for
// the task cancellation.
///
/// Consider using base::WeakPtr directly instead of base::CancelableCallback
/// for the task cancellation.
///
template <typename Signature>
using CancelableOnceCallback =
internal::CancelableCallbackImpl<OnceCallback<Signature>>;

View File

@@ -251,13 +251,6 @@
#define HAS_FEATURE(FEATURE) 0
#endif
// Macro for telling -Wimplicit-fallthrough that a fallthrough is intentional.
#if defined(__clang__)
#define FALLTHROUGH [[clang::fallthrough]]
#else
#define FALLTHROUGH
#endif
#if defined(COMPILER_GCC)
#define PRETTY_FUNCTION __PRETTY_FUNCTION__
#elif defined(COMPILER_MSVC)
@@ -386,26 +379,4 @@ inline constexpr bool AnalyzerAssumeTrue(bool arg) {
#endif
#endif // !USING_CHROMIUM_INCLUDES
// Annotate a function indicating the caller must examine the return value.
// Use like:
// int foo() WARN_UNUSED_RESULT;
// To explicitly ignore a result, use std::ignore from <tuple>.
// Alternately use `[[nodiscard]]` with code that supports C++17.
#undef WARN_UNUSED_RESULT
#if defined(COMPILER_GCC) || defined(__clang__)
#define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
#else
#define WARN_UNUSED_RESULT
#endif
// Annotate a variable indicating it's ok if the variable is not used.
// (Typically used to silence a compiler warning when the assignment
// is important for some other reason.)
// Use like:
// int x = ...;
// ALLOW_UNUSED_LOCAL(x);
// Alternately use `[[maybe_unused]]` with code that supports C++17.
#define ALLOW_UNUSED_LOCAL(x) (void)x
#endif // CEF_INCLUDE_BASE_CEF_COMPILER_SPECIFIC_H_

View File

@@ -1,133 +0,0 @@
// Copyright (c) 2021 Marshall A. Greenblatt. Portions copyright (c) 2021
// Google Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
#ifndef CEF_INCLUDE_BASE_CEF_CXX17_BACKPORTS_H_
#define CEF_INCLUDE_BASE_CEF_CXX17_BACKPORTS_H_
#pragma once
#if defined(USING_CHROMIUM_INCLUDES)
// When building CEF include the Chromium header directly.
// TODO(cef): Change to "base/cxx17_backports.h" in M93.
#include "base/stl_util.h"
#else // !USING_CHROMIUM_INCLUDES
// The following is substantially similar to the Chromium implementation.
// If the Chromium implementation diverges the below implementation should be
// updated to match.
#include <array>
#include <initializer_list>
#include <memory>
#include <string>
namespace base {
// C++14 implementation of C++17's std::size():
// http://en.cppreference.com/w/cpp/iterator/size
template <typename Container>
constexpr auto size(const Container& c) -> decltype(c.size()) {
return c.size();
}
template <typename T, size_t N>
constexpr size_t size(const T (&array)[N]) noexcept {
return N;
}
// C++14 implementation of C++17's std::empty():
// http://en.cppreference.com/w/cpp/iterator/empty
template <typename Container>
constexpr auto empty(const Container& c) -> decltype(c.empty()) {
return c.empty();
}
template <typename T, size_t N>
constexpr bool empty(const T (&array)[N]) noexcept {
return false;
}
template <typename T>
constexpr bool empty(std::initializer_list<T> il) noexcept {
return il.size() == 0;
}
// C++14 implementation of C++17's std::data():
// http://en.cppreference.com/w/cpp/iterator/data
template <typename Container>
constexpr auto data(Container& c) -> decltype(c.data()) {
return c.data();
}
// std::basic_string::data() had no mutable overload prior to C++17 [1].
// Hence this overload is provided.
// Note: str[0] is safe even for empty strings, as they are guaranteed to be
// null-terminated [2].
//
// [1] http://en.cppreference.com/w/cpp/string/basic_string/data
// [2] http://en.cppreference.com/w/cpp/string/basic_string/operator_at
template <typename CharT, typename Traits, typename Allocator>
CharT* data(std::basic_string<CharT, Traits, Allocator>& str) {
return std::addressof(str[0]);
}
template <typename Container>
constexpr auto data(const Container& c) -> decltype(c.data()) {
return c.data();
}
template <typename T, size_t N>
constexpr T* data(T (&array)[N]) noexcept {
return array;
}
template <typename T>
constexpr const T* data(std::initializer_list<T> il) noexcept {
return il.begin();
}
// std::array::data() was not constexpr prior to C++17 [1].
// Hence these overloads are provided.
//
// [1] https://en.cppreference.com/w/cpp/container/array/data
template <typename T, size_t N>
constexpr T* data(std::array<T, N>& array) noexcept {
return !array.empty() ? &array[0] : nullptr;
}
template <typename T, size_t N>
constexpr const T* data(const std::array<T, N>& array) noexcept {
return !array.empty() ? &array[0] : nullptr;
}
} // namespace base
#endif // !USING_CHROMIUM_INCLUDES
#endif // CEF_INCLUDE_BASE_CEF_CXX17_BACKPORTS_H_

View File

@@ -0,0 +1,76 @@
// Copyright (c) 2024 Marshall A. Greenblatt. Portions copyright (c) 2012
// Google Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
///
/// \file
/// Provides functions for generating crash dumps.
///
/// NOTE: The contents of this file are only available to applications that link
/// against the libcef_dll_wrapper target.
///
/// NOTE: Ensure crash reporting is configured before use. See
/// https://bitbucket.org/chromiumembedded/cef/wiki/CrashReporting.md for more
/// information
///
/// WARNING: Crash reporting should not be used in the main/browser process
/// before calling CefInitialize or in sub-processes before CefExecuteProcess.
///
#ifndef CEF_INCLUDE_BASE_CEF_DUMP_WITHOUT_CRASHING_H_
#define CEF_INCLUDE_BASE_CEF_DUMP_WITHOUT_CRASHING_H_
#pragma once
constexpr long long kOneDayInMilliseconds = 86400000;
///
/// CefDumpWithoutCrashing allows for generating crash dumps with a throttling
/// mechanism, preventing frequent dumps from being generated in a short period
/// of time from the same location. The |function_name|, |file_name|, and
/// |line_number| determine the location of the dump. The
/// |mseconds_between_dumps| is an interval between consecutive dumps in
/// milliseconds from the same location.
///
/// Returns true if the dump was successfully generated, false otherwise.
///
bool CefDumpWithoutCrashing(
long long mseconds_between_dumps = kOneDayInMilliseconds,
const char* function_name = __builtin_FUNCTION(),
const char* file_name = __builtin_FILE(),
int line_number = __builtin_LINE());
///
/// CefDumpWithoutCrashingUnthrottled allows for immediate crash dumping without
/// any throttling constraints.
///
/// Returns true if the dump was successfully generated, false otherwise.
///
bool CefDumpWithoutCrashingUnthrottled();
#endif // CEF_INCLUDE_BASE_CEF_DUMP_WITHOUT_CRASHING_H_

View File

@@ -47,9 +47,11 @@
namespace base {
namespace cef_internal {
// A convenient wrapper for an OS specific critical section. The only real
// intelligence in this class is in debug mode for the support for the
// AssertAcquired() method.
///
/// A convenient wrapper for an OS specific critical section. The only real
/// intelligence in this class is in debug mode for the support for the
/// AssertAcquired() method.
///
class Lock {
public:
#if !DCHECK_IS_ON() // Optimized wrapper implementation
@@ -62,10 +64,12 @@ class Lock {
void Acquire() { lock_.Lock(); }
void Release() { lock_.Unlock(); }
// If the lock is not held, take it and return true. If the lock is already
// held by another thread, immediately return false. This must not be called
// by a thread already holding the lock (what happens is undefined and an
// assertion may fail).
///
/// If the lock is not held, take it and return true. If the lock is already
/// held by another thread, immediately return false. This must not be called
/// by a thread already holding the lock (what happens is undefined and an
/// assertion may fail).
///
bool Try() { return lock_.Try(); }
// Null implementation if not debug.
@@ -116,7 +120,9 @@ class Lock {
LockImpl lock_;
};
// A helper class that acquires the given Lock while the AutoLock is in scope.
///
/// A helper class that acquires the given Lock while the AutoLock is in scope.
///
class AutoLock {
public:
struct AlreadyAcquired {};
@@ -139,8 +145,10 @@ class AutoLock {
Lock& lock_;
};
// AutoUnlock is a helper that will Release() the |lock| argument in the
// constructor, and re-Acquire() it in the destructor.
///
/// AutoUnlock is a helper that will Release() the |lock| argument in the
/// constructor, and re-Acquire() it in the destructor.
///
class AutoUnlock {
public:
explicit AutoUnlock(Lock& lock) : lock_(lock) {

View File

@@ -27,110 +27,130 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file are only available to applications that link
// against the libcef_dll_wrapper target.
//
// WARNING: Logging macros should not be used in the main/browser process before
// calling CefInitialize or in sub-processes before calling CefExecuteProcess.
//
// Instructions
// ------------
//
// Make a bunch of macros for logging. The way to log things is to stream
// things to LOG(<a particular severity level>). E.g.,
//
// LOG(INFO) << "Found " << num_cookies << " cookies";
//
// You can also do conditional logging:
//
// LOG_IF(INFO, num_cookies > 10) << "Got lots of cookies";
//
// The CHECK(condition) macro is active in both debug and release builds and
// effectively performs a LOG(FATAL) which terminates the process and
// generates a crashdump unless a debugger is attached.
//
// There are also "debug mode" logging macros like the ones above:
//
// DLOG(INFO) << "Found cookies";
//
// DLOG_IF(INFO, num_cookies > 10) << "Got lots of cookies";
//
// All "debug mode" logging is compiled away to nothing for non-debug mode
// compiles. LOG_IF and development flags also work well together
// because the code can be compiled away sometimes.
//
// We also have
//
// LOG_ASSERT(assertion);
// DLOG_ASSERT(assertion);
//
// which is syntactic sugar for {,D}LOG_IF(FATAL, assert fails) << assertion;
//
// There are "verbose level" logging macros. They look like
//
// VLOG(1) << "I'm printed when you run the program with --v=1 or more";
// VLOG(2) << "I'm printed when you run the program with --v=2 or more";
//
// These always log at the INFO log level (when they log at all).
// The verbose logging can also be turned on module-by-module. For instance,
// --vmodule=profile=2,icon_loader=1,browser_*=3,*/chromeos/*=4 --v=0
// will cause:
// a. VLOG(2) and lower messages to be printed from profile.{h,cc}
// b. VLOG(1) and lower messages to be printed from icon_loader.{h,cc}
// c. VLOG(3) and lower messages to be printed from files prefixed with
// "browser"
// d. VLOG(4) and lower messages to be printed from files under a
// "chromeos" directory.
// e. VLOG(0) and lower messages to be printed from elsewhere
//
// The wildcarding functionality shown by (c) supports both '*' (match
// 0 or more characters) and '?' (match any single character)
// wildcards. Any pattern containing a forward or backward slash will
// be tested against the whole pathname and not just the module.
// E.g., "*/foo/bar/*=2" would change the logging level for all code
// in source files under a "foo/bar" directory.
//
// There's also VLOG_IS_ON(n) "verbose level" condition macro. To be used as
//
// if (VLOG_IS_ON(2)) {
// // do some logging preparation and logging
// // that can't be accomplished with just VLOG(2) << ...;
// }
//
// There is also a VLOG_IF "verbose level" condition macro for sample
// cases, when some extra computation and preparation for logs is not
// needed.
//
// VLOG_IF(1, (size > 1024))
// << "I'm printed when size is more than 1024 and when you run the "
// "program with --v=1 or more";
//
// We also override the standard 'assert' to use 'DLOG_ASSERT'.
//
// Lastly, there is:
//
// PLOG(ERROR) << "Couldn't do foo";
// DPLOG(ERROR) << "Couldn't do foo";
// PLOG_IF(ERROR, cond) << "Couldn't do foo";
// DPLOG_IF(ERROR, cond) << "Couldn't do foo";
// PCHECK(condition) << "Couldn't do foo";
// DPCHECK(condition) << "Couldn't do foo";
//
// which append the last system error to the message in string form (taken from
// GetLastError() on Windows and errno on POSIX).
//
// The supported severity levels for macros that allow you to specify one
// are (in increasing order of severity) INFO, WARNING, ERROR, and FATAL.
//
// Very important: logging a message at the FATAL severity level causes
// the program to terminate (after the message is logged).
//
// There is the special severity of DFATAL, which logs FATAL in debug mode,
// ERROR in normal mode.
//
///
/// \file
/// A bunch of macros for logging.
///
/// NOTE: The contents of this file are only available to applications that link
/// against the libcef_dll_wrapper target.
///
/// WARNING: Logging macros should not be used in the main/browser process
/// before calling CefInitialize or in sub-processes before calling
/// CefExecuteProcess.
///
/// INSTRUCTIONS:
///
/// The way to log things is to stream things to LOG(<a particular severity
/// level>). E.g.,
///
/// <pre>
/// LOG(INFO) << "Found " << num_cookies << " cookies";
/// </pre>
///
/// You can also do conditional logging:
///
/// <pre>
/// LOG_IF(INFO, num_cookies > 10) << "Got lots of cookies";
/// </pre>
///
/// The CHECK(condition) macro is active in both debug and release builds and
/// effectively performs a LOG(FATAL) which terminates the process and
/// generates a crashdump unless a debugger is attached.
///
/// There are also "debug mode" logging macros like the ones above:
///
/// <pre>
/// DLOG(INFO) << "Found cookies";
///
/// DLOG_IF(INFO, num_cookies > 10) << "Got lots of cookies";
/// </pre>
///
/// All "debug mode" logging is compiled away to nothing for non-debug mode
/// compiles. LOG_IF and development flags also work well together
/// because the code can be compiled away sometimes.
///
/// We also have
///
/// <pre>
/// LOG_ASSERT(assertion);
/// DLOG_ASSERT(assertion);
/// </pre>
///
/// which is syntactic sugar for "{,D}LOG_IF(FATAL, assert fails) << assertion;"
///
/// There are "verbose level" logging macros. They look like
///
/// <pre>
/// VLOG(1) << "I'm printed when you run the program with --v=1 or more";
/// VLOG(2) << "I'm printed when you run the program with --v=2 or more";
/// </pre>
///
/// These always log at the INFO log level (when they log at all).
/// The verbose logging can also be turned on module-by-module. For instance,
/// <pre>
/// --vmodule=profile=2,icon_loader=1,browser_*=3,*/chromeos/*=4 --v=0
/// </pre>
/// will cause:
/// 1. VLOG(2) and lower messages to be printed from profile.{h,cc}
/// 2. VLOG(1) and lower messages to be printed from icon_loader.{h,cc}
/// 3. VLOG(3) and lower messages to be printed from files prefixed with
/// "browser"
/// 4. VLOG(4) and lower messages to be printed from files under a
/// "chromeos" directory.
/// 5. VLOG(0) and lower messages to be printed from elsewhere
///
/// The wildcarding functionality shown by (c) supports both '*' (match
/// 0 or more characters) and '?' (match any single character)
/// wildcards. Any pattern containing a forward or backward slash will
/// be tested against the whole pathname and not just the module.
/// E.g., "*/foo/bar/*=2" would change the logging level for all code
/// in source files under a "foo/bar" directory.
///
/// There's also VLOG_IS_ON(n) "verbose level" condition macro. To be used as
///
/// <pre>
/// if (VLOG_IS_ON(2)) {
/// // do some logging preparation and logging
/// // that can't be accomplished with just VLOG(2) << ...;
/// }
/// </pre>
///
/// There is also a VLOG_IF "verbose level" condition macro for sample
/// cases, when some extra computation and preparation for logs is not
/// needed.
///
/// <pre>
/// VLOG_IF(1, (size > 1024))
/// << "I'm printed when size is more than 1024 and when you run the "
/// "program with --v=1 or more";
/// </pre>
///
/// We also override the standard 'assert' to use 'DLOG_ASSERT'.
///
/// Lastly, there is:
///
/// <pre>
/// PLOG(ERROR) << "Couldn't do foo";
/// DPLOG(ERROR) << "Couldn't do foo";
/// PLOG_IF(ERROR, cond) << "Couldn't do foo";
/// DPLOG_IF(ERROR, cond) << "Couldn't do foo";
/// PCHECK(condition) << "Couldn't do foo";
/// DPCHECK(condition) << "Couldn't do foo";
/// </pre>
///
/// which append the last system error to the message in string form (taken from
/// GetLastError() on Windows and errno on POSIX).
///
/// The supported severity levels for macros that allow you to specify one
/// are (in increasing order of severity) INFO, WARNING, ERROR, and FATAL.
///
/// Very important: logging a message at the FATAL severity level causes
/// the program to terminate (after the message is logged).
///
/// There is the special severity of DFATAL, which logs FATAL in debug mode,
/// ERROR in normal mode.
///
#ifndef CEF_INCLUDE_BASE_CEF_LOGGING_H_
#define CEF_INCLUDE_BASE_CEF_LOGGING_H_
@@ -703,6 +723,13 @@ std::ostream& operator<<(std::ostream& out, const wchar_t* wstr);
inline std::ostream& operator<<(std::ostream& out, const std::wstring& wstr) {
return out << wstr.c_str();
}
#if defined(WCHAR_T_IS_32_BIT)
std::ostream& operator<<(std::ostream& out, const char16_t* wstr);
#elif defined(WCHAR_T_IS_16_BIT)
inline std::ostream& operator<<(std::ostream& out, const char16_t* wstr) {
return operator<<(out, reinterpret_cast<const wchar_t*>(wstr));
}
#endif
// The NOTIMPLEMENTED() macro annotates codepaths which have
// not been implemented yet.

View File

@@ -38,8 +38,8 @@
// updated to match.
// ALL DISALLOW_xxx MACROS ARE DEPRECATED; DO NOT USE IN NEW CODE.
// Use explicit deletions instead. See the section on copyability/movability in
// //styleguide/c++/c++-dos-and-donts.md for more information.
// Use explicit deletions instead. For more information see
// https://chromium.googlesource.com/chromium/src/+/lkgr/styleguide/c++/c++-dos-and-donts.md#explicitly-declare-class-copyability_movability
// DEPRECATED: See above. Makes a class uncopyable.
#define DISALLOW_COPY(TypeName) TypeName(const TypeName&) = delete

View File

@@ -43,23 +43,26 @@
// If the Chromium implementation diverges the below implementation should be
// updated to match.
#include "include/base/cef_basictypes.h"
#include "include/base/cef_build.h"
#include "include/internal/cef_thread_internal.h"
namespace base {
// Used for logging. Always an integer value.
///
/// Used for logging. Always an integer value.
///
typedef cef_platform_thread_id_t PlatformThreadId;
// Used for thread checking and debugging.
// Meant to be as fast as possible.
// These are produced by PlatformThread::CurrentRef(), and used to later
// check if we are on the same thread or not by using ==. These are safe
// to copy between threads, but can't be copied to another process as they
// have no meaning there. Also, the internal identifier can be re-used
// after a thread dies, so a PlatformThreadRef cannot be reliably used
// to distinguish a new thread from an old, dead thread.
///
/// Used for thread checking and debugging.
/// Meant to be as fast as possible.
/// These are produced by PlatformThread::CurrentRef(), and used to later
/// check if we are on the same thread or not by using ==. These are safe
/// to copy between threads, but can't be copied to another process as they
/// have no meaning there. Also, the internal identifier can be re-used
/// after a thread dies, so a PlatformThreadRef cannot be reliably used
/// to distinguish a new thread from an old, dead thread.
///
class PlatformThreadRef {
public:
typedef cef_platform_thread_handle_t RefType;
@@ -76,18 +79,24 @@ class PlatformThreadRef {
RefType id_;
};
// A namespace for low-level thread functions.
// Chromium uses a class with static methods but CEF uses an actual namespace
// to avoid linker problems with the sandbox libaries on Windows.
///
/// A namespace for low-level thread functions.
/// Chromium uses a class with static methods but CEF uses an actual namespace
/// to avoid linker problems with the sandbox libaries on Windows.
///
namespace PlatformThread {
// Gets the current thread id, which may be useful for logging purposes.
///
/// Gets the current thread id, which may be useful for logging purposes.
///
inline PlatformThreadId CurrentId() {
return cef_get_current_platform_thread_id();
}
// Gets the current thread reference, which can be used to check if
// we're on the right thread quickly.
///
/// Gets the current thread reference, which can be used to check if
/// we're on the right thread quickly.
///
inline PlatformThreadRef CurrentRef() {
return PlatformThreadRef(cef_get_current_platform_thread_handle());
}

View File

@@ -50,7 +50,6 @@
#include "include/base/cef_compiler_specific.h"
#include "include/base/cef_logging.h"
#include "include/base/cef_scoped_refptr.h"
#include "include/base/cef_template_util.h"
#include "include/base/cef_thread_checker.h"
namespace base {
@@ -105,13 +104,16 @@ class RefCountedBase {
#if DCHECK_IS_ON()
DCHECK(!in_dtor_);
if (ref_count_ == 0)
if (ref_count_ == 0) {
in_dtor_ = true;
}
if (ref_count_ >= 1)
if (ref_count_ >= 1) {
DCHECK(CalledOnValidThread());
if (ref_count_ == 1)
}
if (ref_count_ == 1) {
thread_checker_.DetachFromThread();
}
#endif
return ref_count_ == 0;
@@ -290,52 +292,26 @@ class ScopedAllowCrossThreadRefCountAccess final {
using ScopedAllowCrossThreadRefCountAccess =
cef_subtle::ScopedAllowCrossThreadRefCountAccess;
//
// A base class for reference counted classes. Otherwise, known as a cheap
// knock-off of WebKit's RefCounted<T> class. To use this, just extend your
// class from it like so:
//
// class MyFoo : public base::RefCounted<MyFoo> {
// ...
// private:
// friend class base::RefCounted<MyFoo>;
// ~MyFoo();
// };
//
// Usage Notes:
// 1. You should always make your destructor non-public, to avoid any code
// deleting the object accidentally while there are references to it.
// 2. You should always make the ref-counted base class a friend of your class,
// so that it can access the destructor.
//
// The ref count manipulation to RefCounted is NOT thread safe and has DCHECKs
// to trap unsafe cross thread usage. A subclass instance of RefCounted can be
// passed to another execution thread only when its ref count is 1. If the ref
// count is more than 1, the RefCounted class verifies the ref updates are made
// on the same execution thread as the previous ones. The subclass can also
// manually call IsOnValidThread to trap other non-thread-safe accesses; see
// the documentation for that method.
//
//
// The reference count starts from zero by default, and we intended to migrate
// to start-from-one ref count. Put REQUIRE_ADOPTION_FOR_REFCOUNTED_TYPE() to
// the ref counted class to opt-in.
//
// If an object has start-from-one ref count, the first scoped_refptr need to be
// created by base::AdoptRef() or base::MakeRefCounted(). We can use
// base::MakeRefCounted() to create create both type of ref counted object.
//
// The motivations to use start-from-one ref count are:
// - Start-from-one ref count doesn't need the ref count increment for the
// first reference.
// - It can detect an invalid object acquisition for a being-deleted object
// that has zero ref count. That tends to happen on custom deleter that
// delays the deletion.
// TODO(tzik): Implement invalid acquisition detection.
// - Behavior parity to Blink's WTF::RefCounted, whose count starts from one.
// And start-from-one ref count is a step to merge WTF::RefCounted into
// base::RefCounted.
//
///
/// The reference count starts from zero by default, and we intended to migrate
/// to start-from-one ref count. Put REQUIRE_ADOPTION_FOR_REFCOUNTED_TYPE() to
/// the ref counted class to opt-in.
///
/// If an object has start-from-one ref count, the first scoped_refptr need to
/// be created by base::AdoptRef() or base::MakeRefCounted(). We can use
/// base::MakeRefCounted() to create create both type of ref counted object.
///
/// The motivations to use start-from-one ref count are:
/// - Start-from-one ref count doesn't need the ref count increment for the
/// first reference.
/// - It can detect an invalid object acquisition for a being-deleted object
/// that has zero ref count. That tends to happen on custom deleter that
/// delays the deletion.
/// TODO(tzik): Implement invalid acquisition detection.
/// - Behavior parity to Blink's WTF::RefCounted, whose count starts from one.
/// And start-from-one ref count is a step to merge WTF::RefCounted into
/// base::RefCounted.
///
#define REQUIRE_ADOPTION_FOR_REFCOUNTED_TYPE() \
static constexpr ::base::cef_subtle::StartRefCountFromOneTag \
kRefCountPreference = ::base::cef_subtle::kStartRefCountFromOneTag
@@ -343,6 +319,10 @@ using ScopedAllowCrossThreadRefCountAccess =
template <class T, typename Traits>
class RefCounted;
///
/// Default traits for RefCounted<T>. Deletes the object when its ref count
/// reaches 0. Overload to delete it on a different thread etc.
///
template <typename T>
struct DefaultRefCountedTraits {
static void Destruct(const T* x) {
@@ -350,6 +330,34 @@ struct DefaultRefCountedTraits {
}
};
///
/// A base class for reference counted classes. Otherwise, known as a cheap
/// knock-off of WebKit's RefCounted<T> class. To use this, just extend your
/// class from it like so:
///
/// <pre>
/// class MyFoo : public base::RefCounted<MyFoo> {
/// ...
/// private:
/// friend class base::RefCounted<MyFoo>;
/// ~MyFoo();
/// };
/// </pre>
///
/// Usage Notes:
/// 1. You should always make your destructor non-public, to avoid any code
/// deleting the object accidentally while there are references to it.
/// 2. You should always make the ref-counted base class a friend of your class,
/// so that it can access the destructor.
///
/// The ref count manipulation to RefCounted is NOT thread safe and has DCHECKs
/// to trap unsafe cross thread usage. A subclass instance of RefCounted can be
/// passed to another execution thread only when its ref count is 1. If the ref
/// count is more than 1, the RefCounted class verifies the ref updates are made
/// on the same execution thread as the previous ones. The subclass can also
/// manually call IsOnValidThread to trap other non-thread-safe accesses; see
/// the documentation for that method.
///
template <class T, typename Traits = DefaultRefCountedTraits<T>>
class RefCounted : public cef_subtle::RefCountedBase {
public:
@@ -389,8 +397,10 @@ class RefCounted : public cef_subtle::RefCountedBase {
template <class T, typename Traits>
class RefCountedThreadSafe;
// Default traits for RefCountedThreadSafe<T>. Deletes the object when its ref
// count reaches 0. Overload to delete it on a different thread etc.
///
/// Default traits for RefCountedThreadSafe<T>. Deletes the object when its ref
/// count reaches 0. Overload to delete it on a different thread etc.
///
template <typename T>
struct DefaultRefCountedThreadSafeTraits {
static void Destruct(const T* x) {
@@ -402,21 +412,26 @@ struct DefaultRefCountedThreadSafeTraits {
}
};
//
// A thread-safe variant of RefCounted<T>
//
// class MyFoo : public base::RefCountedThreadSafe<MyFoo> {
// ...
// };
//
// If you're using the default trait, then you should add compile time
// asserts that no one else is deleting your object. i.e.
// private:
// friend class base::RefCountedThreadSafe<MyFoo>;
// ~MyFoo();
//
// We can use REQUIRE_ADOPTION_FOR_REFCOUNTED_TYPE() with RefCountedThreadSafe
// too. See the comment above the RefCounted definition for details.
///
/// A thread-safe variant of RefCounted<T>
///
/// <pre>
/// class MyFoo : public base::RefCountedThreadSafe<MyFoo> {
/// ...
/// };
/// </pre>
///
/// If you're using the default trait, then you should add compile time
/// asserts that no one else is deleting your object. i.e.
/// <pre>
/// private:
/// friend class base::RefCountedThreadSafe<MyFoo>;
/// ~MyFoo();
/// </pre>
///
/// We can use REQUIRE_ADOPTION_FOR_REFCOUNTED_TYPE() with RefCountedThreadSafe
/// too. See the comment above the RefCounted definition for details.
///
template <class T, typename Traits = DefaultRefCountedThreadSafeTraits<T>>
class RefCountedThreadSafe : public cef_subtle::RefCountedThreadSafeBase {
public:
@@ -457,10 +472,10 @@ class RefCountedThreadSafe : public cef_subtle::RefCountedThreadSafeBase {
}
};
//
// A thread-safe wrapper for some piece of data so we can place other
// things in scoped_refptrs<>.
//
///
/// A thread-safe wrapper for some piece of data so we can place other
/// things in scoped_refptrs<>.
///
template <typename T>
class RefCountedData
: public base::RefCountedThreadSafe<base::RefCountedData<T>> {
@@ -469,7 +484,7 @@ class RefCountedData
RefCountedData(const T& in_value) : data(in_value) {}
RefCountedData(T&& in_value) : data(std::move(in_value)) {}
template <typename... Args>
explicit RefCountedData(in_place_t, Args&&... args)
explicit RefCountedData(std::in_place_t, Args&&... args)
: data(std::forward<Args>(args)...) {}
T data;

View File

@@ -46,7 +46,6 @@
#include <type_traits>
#include <utility>
#include "include/base/cef_compiler_specific.h"
#include "include/base/cef_logging.h"
template <class T>
@@ -143,68 +142,76 @@ scoped_refptr<T> WrapRefCounted(T* t) {
} // namespace base
//
// A smart pointer class for reference counted objects. Use this class instead
// of calling AddRef and Release manually on a reference counted object to
// avoid common memory leaks caused by forgetting to Release an object
// reference. Sample usage:
//
// class MyFoo : public RefCounted<MyFoo> {
// ...
// private:
// friend class RefCounted<MyFoo>; // Allow destruction by RefCounted<>.
// ~MyFoo(); // Destructor must be private/protected.
// };
//
// void some_function() {
// scoped_refptr<MyFoo> foo = MakeRefCounted<MyFoo>();
// foo->Method(param);
// // |foo| is released when this function returns
// }
//
// void some_other_function() {
// scoped_refptr<MyFoo> foo = MakeRefCounted<MyFoo>();
// ...
// foo.reset(); // explicitly releases |foo|
// ...
// if (foo)
// foo->Method(param);
// }
//
// The above examples show how scoped_refptr<T> acts like a pointer to T.
// Given two scoped_refptr<T> classes, it is also possible to exchange
// references between the two objects, like so:
//
// {
// scoped_refptr<MyFoo> a = MakeRefCounted<MyFoo>();
// scoped_refptr<MyFoo> b;
//
// b.swap(a);
// // now, |b| references the MyFoo object, and |a| references nullptr.
// }
//
// To make both |a| and |b| in the above example reference the same MyFoo
// object, simply use the assignment operator:
//
// {
// scoped_refptr<MyFoo> a = MakeRefCounted<MyFoo>();
// scoped_refptr<MyFoo> b;
//
// b = a;
// // now, |a| and |b| each own a reference to the same MyFoo object.
// }
//
// Also see Chromium's ownership and calling conventions:
// https://chromium.googlesource.com/chromium/src/+/lkgr/styleguide/c++/c++.md#object-ownership-and-calling-conventions
// Specifically:
// If the function (at least sometimes) takes a ref on a refcounted object,
// declare the param as scoped_refptr<T>. The caller can decide whether it
// wishes to transfer ownership (by calling std::move(t) when passing t) or
// retain its ref (by simply passing t directly).
// In other words, use scoped_refptr like you would a std::unique_ptr except
// in the odd case where it's required to hold on to a ref while handing one
// to another component (if a component merely needs to use t on the stack
// without keeping a ref: pass t as a raw T*).
///
/// A smart pointer class for reference counted objects. Use this class instead
/// of calling AddRef and Release manually on a reference counted object to
/// avoid common memory leaks caused by forgetting to Release an object
/// reference. Sample usage:
///
/// <pre>
/// class MyFoo : public RefCounted<MyFoo> {
/// ...
/// private:
/// friend class RefCounted<MyFoo>; // Allow destruction by RefCounted<>.
/// ~MyFoo(); // Destructor must be
/// private/protected.
/// };
///
/// void some_function() {
/// scoped_refptr<MyFoo> foo = MakeRefCounted<MyFoo>();
/// foo->Method(param);
/// // |foo| is released when this function returns
/// }
///
/// void some_other_function() {
/// scoped_refptr<MyFoo> foo = MakeRefCounted<MyFoo>();
/// ...
/// foo.reset(); // explicitly releases |foo|
/// ...
/// if (foo)
/// foo->Method(param);
/// }
/// </pre>
///
/// The above examples show how scoped_refptr<T> acts like a pointer to T.
/// Given two scoped_refptr<T> classes, it is also possible to exchange
/// references between the two objects, like so:
///
/// <pre>
/// {
/// scoped_refptr<MyFoo> a = MakeRefCounted<MyFoo>();
/// scoped_refptr<MyFoo> b;
///
/// b.swap(a);
/// // now, |b| references the MyFoo object, and |a| references nullptr.
/// }
/// </pre>
///
/// To make both |a| and |b| in the above example reference the same MyFoo
/// object, simply use the assignment operator:
///
/// <pre>
/// {
/// scoped_refptr<MyFoo> a = MakeRefCounted<MyFoo>();
/// scoped_refptr<MyFoo> b;
///
/// b = a;
/// // now, |a| and |b| each own a reference to the same MyFoo object.
/// }
/// </pre>
///
/// Also see Chromium's ownership and calling conventions:
/// https://chromium.googlesource.com/chromium/src/+/lkgr/styleguide/c++/c++.md#object-ownership-and-calling-conventions
/// Specifically:
/// If the function (at least sometimes) takes a ref on a refcounted object,
/// declare the param as scoped_refptr<T>. The caller can decide whether it
/// wishes to transfer ownership (by calling std::move(t) when passing t) or
/// retain its ref (by simply passing t directly).
/// In other words, use scoped_refptr like you would a std::unique_ptr except
/// in the odd case where it's required to hold on to a ref while handing one
/// to another component (if a component merely needs to use t on the stack
/// without keeping a ref: pass t as a raw T*).
///
template <class T>
class TRIVIAL_ABI scoped_refptr {
public:
@@ -222,8 +229,9 @@ class TRIVIAL_ABI scoped_refptr {
// should move or copy construct from an existing scoped_refptr<T> to the
// ref-counted object.
scoped_refptr(T* p) : ptr_(p) {
if (ptr_)
if (ptr_) {
AddRef(ptr_);
}
}
// Copy constructor. This is required in addition to the copy conversion
@@ -254,8 +262,9 @@ class TRIVIAL_ABI scoped_refptr {
"It's unsafe to override the ref count preference."
" Please remove REQUIRE_ADOPTION_FOR_REFCOUNTED_TYPE"
" from subclasses.");
if (ptr_)
if (ptr_) {
Release(ptr_);
}
}
T* get() const { return ptr_; }
@@ -289,7 +298,7 @@ class TRIVIAL_ABI scoped_refptr {
// Returns the owned pointer (if any), releasing ownership to the caller. The
// caller is responsible for managing the lifetime of the reference.
T* release() WARN_UNUSED_RESULT;
[[nodiscard]] T* release();
void swap(scoped_refptr& r) noexcept { std::swap(ptr_, r.ptr_); }

View File

@@ -28,40 +28,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// ScopedTypeRef<> is patterned after std::unique_ptr<>, but maintains ownership
// of a reference to any type that is maintained by Retain and Release methods.
//
// The Traits structure must provide the Retain and Release methods for type T.
// A default ScopedTypeRefTraits is used but not defined, and should be defined
// for each type to use this interface. For example, an appropriate definition
// of ScopedTypeRefTraits for CGLContextObj would be:
//
// template<>
// struct ScopedTypeRefTraits<CGLContextObj> {
// static CGLContextObj InvalidValue() { return nullptr; }
// static CGLContextObj Retain(CGLContextObj object) {
// CGLContextRetain(object);
// return object;
// }
// static void Release(CGLContextObj object) { CGLContextRelease(object); }
// };
//
// For the many types that have pass-by-pointer create functions, the function
// InitializeInto() is provided to allow direct initialization and assumption
// of ownership of the object. For example, continuing to use the above
// CGLContextObj specialization:
//
// base::ScopedTypeRef<CGLContextObj> context;
// CGLCreateContext(pixel_format, share_group, context.InitializeInto());
//
// For initialization with an existing object, the caller may specify whether
// the ScopedTypeRef<> being initialized is assuming the caller's existing
// ownership of the object (and should not call Retain in initialization) or if
// it should not assume this ownership and must create its own (by calling
// Retain in initialization). This behavior is based on the |policy| parameter,
// with |ASSUME| for the former and |RETAIN| for the latter. The default policy
// is to |ASSUME|.
#ifndef CEF_INCLUDE_BASE_CEF_SCOPED_TYPEREF_MAC_H_
#define CEF_INCLUDE_BASE_CEF_SCOPED_TYPEREF_MAC_H_
#pragma once
@@ -74,16 +40,55 @@
// If the Chromium implementation diverges the below implementation should be
// updated to match.
#include "include/base/cef_compiler_specific.h"
#include "include/base/cef_logging.h"
#include "include/base/internal/cef_scoped_policy.h"
namespace base {
template<typename T>
template <typename T>
struct ScopedTypeRefTraits;
template<typename T, typename Traits = ScopedTypeRefTraits<T>>
///
/// ScopedTypeRef<> is patterned after std::unique_ptr<>, but maintains
/// ownership of a reference to any type that is maintained by Retain and
/// Release methods.
///
/// The Traits structure must provide the Retain and Release methods for type T.
/// A default ScopedTypeRefTraits is used but not defined, and should be defined
/// for each type to use this interface. For example, an appropriate definition
/// of ScopedTypeRefTraits for CGLContextObj would be:
///
/// <pre>
/// template<>
/// struct ScopedTypeRefTraits<CGLContextObj> {
/// static CGLContextObj InvalidValue() { return nullptr; }
/// static CGLContextObj Retain(CGLContextObj object) {
/// CGLContextRetain(object);
/// return object;
/// }
/// static void Release(CGLContextObj object) { CGLContextRelease(object); }
/// };
/// </pre>
///
/// For the many types that have pass-by-pointer create functions, the function
/// InitializeInto() is provided to allow direct initialization and assumption
/// of ownership of the object. For example, continuing to use the above
/// CGLContextObj specialization:
///
/// <pre>
/// base::ScopedTypeRef<CGLContextObj> context;
/// CGLCreateContext(pixel_format, share_group, context.InitializeInto());
/// </pre>
///
/// For initialization with an existing object, the caller may specify whether
/// the ScopedTypeRef<> being initialized is assuming the caller's existing
/// ownership of the object (and should not call Retain in initialization) or if
/// it should not assume this ownership and must create its own (by calling
/// Retain in initialization). This behavior is based on the |policy| parameter,
/// with |ASSUME| for the former and |RETAIN| for the latter. The default policy
/// is to |ASSUME|.
///
template <typename T, typename Traits = ScopedTypeRefTraits<T>>
class ScopedTypeRef {
public:
using element_type = T;
@@ -92,22 +97,24 @@ class ScopedTypeRef {
element_type object = Traits::InvalidValue(),
base::scoped_policy::OwnershipPolicy policy = base::scoped_policy::ASSUME)
: object_(object) {
if (object_ && policy == base::scoped_policy::RETAIN)
if (object_ && policy == base::scoped_policy::RETAIN) {
object_ = Traits::Retain(object_);
}
}
ScopedTypeRef(const ScopedTypeRef<T, Traits>& that)
: object_(that.object_) {
if (object_)
ScopedTypeRef(const ScopedTypeRef<T, Traits>& that) : object_(that.object_) {
if (object_) {
object_ = Traits::Retain(object_);
}
}
// This allows passing an object to a function that takes its superclass.
template <typename R, typename RTraits>
explicit ScopedTypeRef(const ScopedTypeRef<R, RTraits>& that_as_subclass)
: object_(that_as_subclass.get()) {
if (object_)
if (object_) {
object_ = Traits::Retain(object_);
}
}
ScopedTypeRef(ScopedTypeRef<T, Traits>&& that) : object_(that.object_) {
@@ -115,8 +122,9 @@ class ScopedTypeRef {
}
~ScopedTypeRef() {
if (object_)
if (object_) {
Traits::Release(object_);
}
}
ScopedTypeRef& operator=(const ScopedTypeRef<T, Traits>& that) {
@@ -127,7 +135,7 @@ class ScopedTypeRef {
// This is to be used only to take ownership of objects that are created
// by pass-by-pointer create functions. To enforce this, require that the
// object be reset to NULL before this may be used.
element_type* InitializeInto() WARN_UNUSED_RESULT {
[[nodiscard]] element_type* InitializeInto() {
DCHECK(!object_);
return &object_;
}
@@ -139,10 +147,12 @@ class ScopedTypeRef {
void reset(element_type object = Traits::InvalidValue(),
base::scoped_policy::OwnershipPolicy policy =
base::scoped_policy::ASSUME) {
if (object && policy == base::scoped_policy::RETAIN)
if (object && policy == base::scoped_policy::RETAIN) {
object = Traits::Retain(object);
if (object_)
}
if (object_) {
Traits::Release(object_);
}
object_ = object;
}
@@ -163,7 +173,7 @@ class ScopedTypeRef {
// ScopedTypeRef<>::release() is like std::unique_ptr<>::release. It is NOT
// a wrapper for Release(). To force a ScopedTypeRef<> object to call
// Release(), use ScopedTypeRef<>::reset().
element_type release() WARN_UNUSED_RESULT {
[[nodiscard]] element_type release() {
element_type temp = object_;
object_ = Traits::InvalidValue();
return temp;

View File

@@ -1,414 +0,0 @@
// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011
// Google Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef CEF_INCLUDE_BASE_CEF_TEMPLATE_UTIL_H_
#define CEF_INCLUDE_BASE_CEF_TEMPLATE_UTIL_H_
#pragma once
#if defined(USING_CHROMIUM_INCLUDES)
// When building CEF include the Chromium header directly.
#include "base/template_util.h"
#else // !USING_CHROMIUM_INCLUDES
// The following is substantially similar to the Chromium implementation.
// If the Chromium implementation diverges the below implementation should be
// updated to match.
#include <stddef.h>
#include <iosfwd>
#include <iterator>
#include <type_traits>
#include <utility>
#include <vector>
#include "include/base/cef_build.h"
// Some versions of libstdc++ have partial support for type_traits, but misses
// a smaller subset while removing some of the older non-standard stuff. Assume
// that all versions below 5.0 fall in this category, along with one 5.0
// experimental release. Test for this by consulting compiler major version,
// the only reliable option available, so theoretically this could fail should
// you attempt to mix an earlier version of libstdc++ with >= GCC5. But
// that's unlikely to work out, especially as GCC5 changed ABI.
#define CR_GLIBCXX_5_0_0 20150123
#if (defined(__GNUC__) && __GNUC__ < 5) || \
(defined(__GLIBCXX__) && __GLIBCXX__ == CR_GLIBCXX_5_0_0)
#define CR_USE_FALLBACKS_FOR_OLD_EXPERIMENTAL_GLIBCXX
#endif
// This hacks around using gcc with libc++ which has some incompatibilies.
// - is_trivially_* doesn't work: https://llvm.org/bugs/show_bug.cgi?id=27538
// TODO(danakj): Remove this when android builders are all using a newer version
// of gcc, or the android ndk is updated to a newer libc++ that works with older
// gcc versions.
#if !defined(__clang__) && defined(_LIBCPP_VERSION)
#define CR_USE_FALLBACKS_FOR_GCC_WITH_LIBCXX
#endif
namespace base {
template <class T> struct is_non_const_reference : std::false_type {};
template <class T> struct is_non_const_reference<T&> : std::true_type {};
template <class T> struct is_non_const_reference<const T&> : std::false_type {};
namespace internal {
// Implementation detail of base::void_t below.
template <typename...>
struct make_void {
using type = void;
};
} // namespace internal
// base::void_t is an implementation of std::void_t from C++17.
//
// We use |base::internal::make_void| as a helper struct to avoid a C++14
// defect:
// http://en.cppreference.com/w/cpp/types/void_t
// http://open-std.org/JTC1/SC22/WG21/docs/cwg_defects.html#1558
template <typename... Ts>
using void_t = typename ::base::internal::make_void<Ts...>::type;
namespace internal {
// Uses expression SFINAE to detect whether using operator<< would work.
template <typename T, typename = void>
struct SupportsOstreamOperator : std::false_type {};
template <typename T>
struct SupportsOstreamOperator<T,
decltype(void(std::declval<std::ostream&>()
<< std::declval<T>()))>
: std::true_type {};
template <typename T, typename = void>
struct SupportsToString : std::false_type {};
template <typename T>
struct SupportsToString<T, decltype(void(std::declval<T>().ToString()))>
: std::true_type {};
// Used to detect whether the given type is an iterator. This is normally used
// with std::enable_if to provide disambiguation for functions that take
// templatzed iterators as input.
template <typename T, typename = void>
struct is_iterator : std::false_type {};
template <typename T>
struct is_iterator<T,
void_t<typename std::iterator_traits<T>::iterator_category>>
: std::true_type {};
// Helper to express preferences in an overload set. If more than one overload
// are available for a given set of parameters the overload with the higher
// priority will be chosen.
template <size_t I>
struct priority_tag : priority_tag<I - 1> {};
template <>
struct priority_tag<0> {};
} // namespace internal
// is_trivially_copyable is especially hard to get right.
// - Older versions of libstdc++ will fail to have it like they do for other
// type traits. This has become a subset of the second point, but used to be
// handled independently.
// - An experimental release of gcc includes most of type_traits but misses
// is_trivially_copyable, so we still have to avoid using libstdc++ in this
// case, which is covered by CR_USE_FALLBACKS_FOR_OLD_EXPERIMENTAL_GLIBCXX.
// - When compiling libc++ from before r239653, with a gcc compiler, the
// std::is_trivially_copyable can fail. So we need to work around that by not
// using the one in libc++ in this case. This is covered by the
// CR_USE_FALLBACKS_FOR_GCC_WITH_LIBCXX define, and is discussed in
// https://llvm.org/bugs/show_bug.cgi?id=27538#c1 where they point out that
// in libc++'s commit r239653 this is fixed by libc++ checking for gcc 5.1.
// - In both of the above cases we are using the gcc compiler. When defining
// this ourselves on compiler intrinsics, the __is_trivially_copyable()
// intrinsic is not available on gcc before version 5.1 (see the discussion in
// https://llvm.org/bugs/show_bug.cgi?id=27538#c1 again), so we must check for
// that version.
// - When __is_trivially_copyable() is not available because we are on gcc older
// than 5.1, we need to fall back to something, so we use __has_trivial_copy()
// instead based on what was done one-off in bit_cast() previously.
// TODO(crbug.com/554293): Remove this when all platforms have this in the std
// namespace and it works with gcc as needed.
#if defined(CR_USE_FALLBACKS_FOR_OLD_EXPERIMENTAL_GLIBCXX) || \
defined(CR_USE_FALLBACKS_FOR_GCC_WITH_LIBCXX)
template <typename T>
struct is_trivially_copyable {
// TODO(danakj): Remove this when android builders are all using a newer version
// of gcc, or the android ndk is updated to a newer libc++ that does this for
// us.
#if _GNUC_VER >= 501
static constexpr bool value = __is_trivially_copyable(T);
#else
static constexpr bool value =
__has_trivial_copy(T) && __has_trivial_destructor(T);
#endif
};
#else
template <class T>
using is_trivially_copyable = std::is_trivially_copyable<T>;
#endif
#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ <= 7
// Workaround for g++7 and earlier family.
// Due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80654, without this
// Optional<std::vector<T>> where T is non-copyable causes a compile error.
// As we know it is not trivially copy constructible, explicitly declare so.
template <typename T>
struct is_trivially_copy_constructible
: std::is_trivially_copy_constructible<T> {};
template <typename... T>
struct is_trivially_copy_constructible<std::vector<T...>> : std::false_type {};
#else
// Otherwise use std::is_trivially_copy_constructible as is.
template <typename T>
using is_trivially_copy_constructible = std::is_trivially_copy_constructible<T>;
#endif
// base::in_place_t is an implementation of std::in_place_t from
// C++17. A tag type used to request in-place construction in template vararg
// constructors.
// Specification:
// https://en.cppreference.com/w/cpp/utility/in_place
struct in_place_t {};
constexpr in_place_t in_place = {};
// base::in_place_type_t is an implementation of std::in_place_type_t from
// C++17. A tag type used for in-place construction when the type to construct
// needs to be specified, such as with base::unique_any, designed to be a
// drop-in replacement.
// Specification:
// http://en.cppreference.com/w/cpp/utility/in_place
template <typename T>
struct in_place_type_t {};
template <typename T>
struct is_in_place_type_t {
static constexpr bool value = false;
};
template <typename... Ts>
struct is_in_place_type_t<in_place_type_t<Ts...>> {
static constexpr bool value = true;
};
// C++14 implementation of C++17's std::bool_constant.
//
// Reference: https://en.cppreference.com/w/cpp/types/integral_constant
// Specification: https://wg21.link/meta.type.synop
template <bool B>
using bool_constant = std::integral_constant<bool, B>;
// C++14 implementation of C++17's std::conjunction.
//
// Reference: https://en.cppreference.com/w/cpp/types/conjunction
// Specification: https://wg21.link/meta.logical#1.itemdecl:1
template <typename...>
struct conjunction : std::true_type {};
template <typename B1>
struct conjunction<B1> : B1 {};
template <typename B1, typename... Bn>
struct conjunction<B1, Bn...>
: std::conditional_t<static_cast<bool>(B1::value), conjunction<Bn...>, B1> {
};
// C++14 implementation of C++17's std::disjunction.
//
// Reference: https://en.cppreference.com/w/cpp/types/disjunction
// Specification: https://wg21.link/meta.logical#itemdecl:2
template <typename...>
struct disjunction : std::false_type {};
template <typename B1>
struct disjunction<B1> : B1 {};
template <typename B1, typename... Bn>
struct disjunction<B1, Bn...>
: std::conditional_t<static_cast<bool>(B1::value), B1, disjunction<Bn...>> {
};
// C++14 implementation of C++17's std::negation.
//
// Reference: https://en.cppreference.com/w/cpp/types/negation
// Specification: https://wg21.link/meta.logical#itemdecl:3
template <typename B>
struct negation : bool_constant<!static_cast<bool>(B::value)> {};
// Implementation of C++17's invoke_result.
//
// This implementation adds references to `Functor` and `Args` to work around
// some quirks of std::result_of. See the #Notes section of [1] for details.
//
// References:
// [1] https://en.cppreference.com/w/cpp/types/result_of
// [2] https://wg21.link/meta.trans.other#lib:invoke_result
#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
template <typename Functor, typename... Args>
using invoke_result = std::invoke_result<Functor, Args...>;
#else
template <typename Functor, typename... Args>
using invoke_result = std::result_of<Functor && (Args && ...)>;
#endif
// Implementation of C++17's std::invoke_result_t.
//
// Reference: https://wg21.link/meta.type.synop#lib:invoke_result_t
template <typename Functor, typename... Args>
using invoke_result_t = typename invoke_result<Functor, Args...>::type;
namespace internal {
// Base case, `InvokeResult` does not have a nested type member. This means `F`
// could not be invoked with `Args...` and thus is not invocable.
template <typename InvokeResult, typename R, typename = void>
struct IsInvocableImpl : std::false_type {};
// Happy case, `InvokeResult` does have a nested type member. Now check whether
// `InvokeResult::type` is convertible to `R`. Short circuit in case
// `std::is_void<R>`.
template <typename InvokeResult, typename R>
struct IsInvocableImpl<InvokeResult, R, void_t<typename InvokeResult::type>>
: disjunction<std::is_void<R>,
std::is_convertible<typename InvokeResult::type, R>> {};
} // namespace internal
// Implementation of C++17's std::is_invocable_r.
//
// Returns whether `F` can be invoked with `Args...` and the result is
// convertible to `R`.
//
// Reference: https://wg21.link/meta.rel#lib:is_invocable_r
template <typename R, typename F, typename... Args>
struct is_invocable_r
: internal::IsInvocableImpl<invoke_result<F, Args...>, R> {};
// Implementation of C++17's std::is_invocable.
//
// Returns whether `F` can be invoked with `Args...`.
//
// Reference: https://wg21.link/meta.rel#lib:is_invocable
template <typename F, typename... Args>
struct is_invocable : is_invocable_r<void, F, Args...> {};
namespace internal {
// The indirection with std::is_enum<T> is required, because instantiating
// std::underlying_type_t<T> when T is not an enum is UB prior to C++20.
template <typename T, bool = std::is_enum<T>::value>
struct IsScopedEnumImpl : std::false_type {};
template <typename T>
struct IsScopedEnumImpl<T, /*std::is_enum<T>::value=*/true>
: negation<std::is_convertible<T, std::underlying_type_t<T>>> {};
} // namespace internal
// Implementation of C++23's std::is_scoped_enum
//
// Reference: https://en.cppreference.com/w/cpp/types/is_scoped_enum
template <typename T>
struct is_scoped_enum : internal::IsScopedEnumImpl<T> {};
// Implementation of C++20's std::remove_cvref.
//
// References:
// - https://en.cppreference.com/w/cpp/types/remove_cvref
// - https://wg21.link/meta.trans.other#lib:remove_cvref
template <typename T>
struct remove_cvref {
using type = std::remove_cv_t<std::remove_reference_t<T>>;
};
// Implementation of C++20's std::remove_cvref_t.
//
// References:
// - https://en.cppreference.com/w/cpp/types/remove_cvref
// - https://wg21.link/meta.type.synop#lib:remove_cvref_t
template <typename T>
using remove_cvref_t = typename remove_cvref<T>::type;
// Simplified implementation of C++20's std::iter_value_t.
// As opposed to std::iter_value_t, this implementation does not restrict
// the type of `Iter` and does not consider specializations of
// `indirectly_readable_traits`.
//
// Reference: https://wg21.link/readable.traits#2
template <typename Iter>
using iter_value_t =
typename std::iterator_traits<remove_cvref_t<Iter>>::value_type;
// Simplified implementation of C++20's std::iter_reference_t.
// As opposed to std::iter_reference_t, this implementation does not restrict
// the type of `Iter`.
//
// Reference: https://wg21.link/iterator.synopsis#:~:text=iter_reference_t
template <typename Iter>
using iter_reference_t = decltype(*std::declval<Iter&>());
// Simplified implementation of C++20's std::indirect_result_t. As opposed to
// std::indirect_result_t, this implementation does not restrict the type of
// `Func` and `Iters`.
//
// Reference: https://wg21.link/iterator.synopsis#:~:text=indirect_result_t
template <typename Func, typename... Iters>
using indirect_result_t = invoke_result_t<Func, iter_reference_t<Iters>...>;
// Simplified implementation of C++20's std::projected. As opposed to
// std::projected, this implementation does not explicitly restrict the type of
// `Iter` and `Proj`, but rather does so implicitly by requiring
// `indirect_result_t<Proj, Iter>` is a valid type. This is required for SFINAE
// friendliness.
//
// Reference: https://wg21.link/projected
template <typename Iter,
typename Proj,
typename IndirectResultT = indirect_result_t<Proj, Iter>>
struct projected {
using value_type = remove_cvref_t<IndirectResultT>;
IndirectResultT operator*() const; // not defined
};
} // namespace base
#undef CR_USE_FALLBACKS_FOR_GCC_WITH_LIBCXX
#undef CR_USE_FALLBACKS_FOR_OLD_EXPERIMENTAL_GLIBCXX
#endif // !USING_CHROMIUM_INCLUDES
#endif // CEF_INCLUDE_BASE_CEF_TEMPLATE_UTIL_H_

View File

@@ -43,10 +43,12 @@
#include "include/base/cef_logging.h"
#include "include/base/internal/cef_thread_checker_impl.h"
// Apart from debug builds, we also enable the thread checker in
// builds with DCHECK_ALWAYS_ON so that trybots and waterfall bots
// with this define will get the same level of thread checking as
// debug bots.
///
/// Apart from debug builds, we also enable the thread checker in
/// builds with DCHECK_ALWAYS_ON so that trybots and waterfall bots
/// with this define will get the same level of thread checking as
/// debug bots.
///
#if DCHECK_IS_ON()
#define ENABLE_THREAD_CHECKER 1
#else
@@ -57,10 +59,12 @@ namespace base {
namespace cef_internal {
// Do nothing implementation, for use in release mode.
//
// Note: You should almost always use the ThreadChecker class to get the
// right version for your build configuration.
///
/// Do nothing implementation, for use in release mode.
///
/// Note: You should almost always use the ThreadChecker class to get the
/// right version for your build configuration.
///
class ThreadCheckerDoNothing {
public:
bool CalledOnValidThread() const { return true; }
@@ -70,37 +74,42 @@ class ThreadCheckerDoNothing {
} // namespace cef_internal
// ThreadChecker is a helper class used to help verify that some methods of a
// class are called from the same thread. It provides identical functionality to
// base::NonThreadSafe, but it is meant to be held as a member variable, rather
// than inherited from base::NonThreadSafe.
//
// While inheriting from base::NonThreadSafe may give a clear indication about
// the thread-safety of a class, it may also lead to violations of the style
// guide with regard to multiple inheritance. The choice between having a
// ThreadChecker member and inheriting from base::NonThreadSafe should be based
// on whether:
// - Derived classes need to know the thread they belong to, as opposed to
// having that functionality fully encapsulated in the base class.
// - Derived classes should be able to reassign the base class to another
// thread, via DetachFromThread.
//
// If neither of these are true, then having a ThreadChecker member and calling
// CalledOnValidThread is the preferable solution.
//
// Example:
// class MyClass {
// public:
// void Foo() {
// DCHECK(thread_checker_.CalledOnValidThread());
// ... (do stuff) ...
// }
//
// private:
// ThreadChecker thread_checker_;
// }
//
// In Release mode, CalledOnValidThread will always return true.
///
/// ThreadChecker is a helper class used to help verify that some methods of a
/// class are called from the same thread. It provides identical functionality
/// to base::NonThreadSafe, but it is meant to be held as a member variable,
/// rather than inherited from base::NonThreadSafe.
///
/// While inheriting from base::NonThreadSafe may give a clear indication about
/// the thread-safety of a class, it may also lead to violations of the style
/// guide with regard to multiple inheritance. The choice between having a
/// ThreadChecker member and inheriting from base::NonThreadSafe should be based
/// on whether:
/// - Derived classes need to know the thread they belong to, as opposed to
/// having that functionality fully encapsulated in the base class.
/// - Derived classes should be able to reassign the base class to another
/// thread, via DetachFromThread.
///
/// If neither of these are true, then having a ThreadChecker member and calling
/// CalledOnValidThread is the preferable solution.
///
/// Example:
///
/// <pre>
/// class MyClass {
/// public:
/// void Foo() {
/// DCHECK(thread_checker_.CalledOnValidThread());
/// ... (do stuff) ...
/// }
///
/// private:
/// ThreadChecker thread_checker_;
/// }
/// </pre>
///
/// In Release mode, CalledOnValidThread will always return true.
///
#if ENABLE_THREAD_CHECKER
class ThreadChecker : public cef_internal::ThreadCheckerImpl {};
#else

View File

@@ -29,111 +29,125 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
///
// Trace events are for tracking application performance and resource usage.
// Macros are provided to track:
// Begin and end of function calls
// Counters
//
// Events are issued against categories. Whereas LOG's categories are statically
// defined, TRACE categories are created implicitly with a string. For example:
// TRACE_EVENT_INSTANT0("MY_SUBSYSTEM", "SomeImportantEvent")
//
// Events can be INSTANT, or can be pairs of BEGIN and END in the same scope:
// TRACE_EVENT_BEGIN0("MY_SUBSYSTEM", "SomethingCostly")
// doSomethingCostly()
// TRACE_EVENT_END0("MY_SUBSYSTEM", "SomethingCostly")
// Note: Our tools can't always determine the correct BEGIN/END pairs unless
// these are used in the same scope. Use ASYNC_BEGIN/ASYNC_END macros if you
// need them to be in separate scopes.
//
// A common use case is to trace entire function scopes. This issues a trace
// BEGIN and END automatically:
// void doSomethingCostly() {
// TRACE_EVENT0("MY_SUBSYSTEM", "doSomethingCostly");
// ...
// }
//
// Additional parameters can be associated with an event:
// void doSomethingCostly2(int howMuch) {
// TRACE_EVENT1("MY_SUBSYSTEM", "doSomethingCostly",
// "howMuch", howMuch);
// ...
// }
//
// The trace system will automatically add to this information the current
// process id, thread id, and a timestamp in microseconds.
//
// To trace an asynchronous procedure such as an IPC send/receive, use
// ASYNC_BEGIN and ASYNC_END:
// [single threaded sender code]
// static int send_count = 0;
// ++send_count;
// TRACE_EVENT_ASYNC_BEGIN0("ipc", "message", send_count);
// Send(new MyMessage(send_count));
// [receive code]
// void OnMyMessage(send_count) {
// TRACE_EVENT_ASYNC_END0("ipc", "message", send_count);
// }
// The third parameter is a unique ID to match ASYNC_BEGIN/ASYNC_END pairs.
// ASYNC_BEGIN and ASYNC_END can occur on any thread of any traced process.
// Pointers can be used for the ID parameter, and they will be mangled
// internally so that the same pointer on two different processes will not
// match. For example:
// class MyTracedClass {
// public:
// MyTracedClass() {
// TRACE_EVENT_ASYNC_BEGIN0("category", "MyTracedClass", this);
// }
// ~MyTracedClass() {
// TRACE_EVENT_ASYNC_END0("category", "MyTracedClass", this);
// }
// }
//
// The trace event also supports counters, which is a way to track a quantity
// as it varies over time. Counters are created with the following macro:
// TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter", g_myCounterValue);
//
// Counters are process-specific. The macro itself can be issued from any
// thread, however.
//
// Sometimes, you want to track two counters at once. You can do this with two
// counter macros:
// TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter0", g_myCounterValue[0]);
// TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter1", g_myCounterValue[1]);
// Or you can do it with a combined macro:
// TRACE_COUNTER2("MY_SUBSYSTEM", "myCounter",
// "bytesPinned", g_myCounterValue[0],
// "bytesAllocated", g_myCounterValue[1]);
// This indicates to the tracing UI that these counters should be displayed
// in a single graph, as a summed area chart.
//
// Since counters are in a global namespace, you may want to disembiguate with a
// unique ID, by using the TRACE_COUNTER_ID* variations.
//
// By default, trace collection is compiled in, but turned off at runtime.
// Collecting trace data is the responsibility of the embedding application. In
// CEF's case, calling BeginTracing will turn on tracing on all active
// processes.
//
//
// Memory scoping note:
// Tracing copies the pointers, not the string content, of the strings passed
// in for category, name, and arg_names. Thus, the following code will cause
// problems:
// char* str = strdup("impprtantName");
// TRACE_EVENT_INSTANT0("SUBSYSTEM", str); // BAD!
// free(str); // Trace system now has dangling pointer
//
// To avoid this issue with the |name| and |arg_name| parameters, use the
// TRACE_EVENT_COPY_XXX overloads of the macros at additional runtime
// overhead.
// Notes: The category must always be in a long-lived char* (i.e. static const).
// The |arg_values|, when used, are always deep copied with the _COPY
// macros.
//
//
// Thread Safety:
// All macros are thread safe and can be used from any process.
/// \file
/// Trace events are for tracking application performance and resource usage.
/// Macros are provided to track:
/// Begin and end of function calls
/// Counters
///
/// Events are issued against categories. Whereas LOG's categories are
/// statically defined, TRACE categories are created implicitly with a string.
/// For example: <pre>
/// TRACE_EVENT_INSTANT0("MY_SUBSYSTEM", "SomeImportantEvent")
/// </pre>
///
/// Events can be INSTANT, or can be pairs of BEGIN and END in the same scope:
/// <pre>
/// TRACE_EVENT_BEGIN0("MY_SUBSYSTEM", "SomethingCostly")
/// doSomethingCostly()
/// TRACE_EVENT_END0("MY_SUBSYSTEM", "SomethingCostly")
/// </pre>
/// Note: Our tools can't always determine the correct BEGIN/END pairs unless
/// these are used in the same scope. Use ASYNC_BEGIN/ASYNC_END macros if you
/// need them to be in separate scopes.
///
/// A common use case is to trace entire function scopes. This issues a trace
/// BEGIN and END automatically:
/// <pre>
/// void doSomethingCostly() {
/// TRACE_EVENT0("MY_SUBSYSTEM", "doSomethingCostly");
/// ...
/// }
/// </pre>
///
/// Additional parameters can be associated with an event:
/// <pre>
/// void doSomethingCostly2(int howMuch) {
/// TRACE_EVENT1("MY_SUBSYSTEM", "doSomethingCostly",
/// "howMuch", howMuch);
/// ...
/// }
/// </pre>
///
/// The trace system will automatically add to this information the current
/// process id, thread id, and a timestamp in microseconds.
///
/// To trace an asynchronous procedure such as an IPC send/receive, use
/// ASYNC_BEGIN and ASYNC_END:
/// <pre>
/// [single threaded sender code]
/// static int send_count = 0;
/// ++send_count;
/// TRACE_EVENT_ASYNC_BEGIN0("ipc", "message", send_count);
/// Send(new MyMessage(send_count));
/// [receive code]
/// void OnMyMessage(send_count) {
/// TRACE_EVENT_ASYNC_END0("ipc", "message", send_count);
/// }
/// </pre>
/// The third parameter is a unique ID to match ASYNC_BEGIN/ASYNC_END pairs.
/// ASYNC_BEGIN and ASYNC_END can occur on any thread of any traced process.
/// Pointers can be used for the ID parameter, and they will be mangled
/// internally so that the same pointer on two different processes will not
/// match. For example:
/// <pre>
/// class MyTracedClass {
/// public:
/// MyTracedClass() {
/// TRACE_EVENT_ASYNC_BEGIN0("category", "MyTracedClass", this);
/// }
/// ~MyTracedClass() {
/// TRACE_EVENT_ASYNC_END0("category", "MyTracedClass", this);
/// }
/// }
/// </pre>
///
/// The trace event also supports counters, which is a way to track a quantity
/// as it varies over time. Counters are created with the following macro:
/// <pre>
/// TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter", g_myCounterValue);
/// </pre>
///
/// Counters are process-specific. The macro itself can be issued from any
/// thread, however.
///
/// Sometimes, you want to track two counters at once. You can do this with two
/// counter macros:
/// <pre>
/// TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter0", g_myCounterValue[0]);
/// TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter1", g_myCounterValue[1]);
/// </pre>
/// Or you can do it with a combined macro:
/// <pre>
/// TRACE_COUNTER2("MY_SUBSYSTEM", "myCounter",
/// "bytesPinned", g_myCounterValue[0],
/// "bytesAllocated", g_myCounterValue[1]);
/// </pre>
/// This indicates to the tracing UI that these counters should be displayed
/// in a single graph, as a summed area chart.
///
/// Since counters are in a global namespace, you may want to disembiguate with
/// a unique ID, by using the TRACE_COUNTER_ID* variations.
///
/// By default, trace collection is compiled in, but turned off at runtime.
/// Collecting trace data is the responsibility of the embedding application. In
/// CEF's case, calling BeginTracing will turn on tracing on all active
/// processes.
///
///
/// Memory scoping note:
/// Tracing copies the pointers, not the string content, of the strings passed
/// in for category, name, and arg_names. Thus, the following code will cause
/// problems:
/// <pre>
/// char* str = strdup("impprtantName");
/// TRACE_EVENT_INSTANT0("SUBSYSTEM", str); // BAD!
/// free(str); // Trace system now has dangling pointer
/// </pre>
///
///
/// Thread Safety:
/// All macros are thread safe and can be used from any process.
///
#ifndef CEF_INCLUDE_BASE_CEF_TRACE_EVENT_H_
@@ -141,7 +155,7 @@
#pragma once
#if defined(USING_CHROMIUM_INCLUDES)
// When building CEF include the Chromium header directly.
/// When building CEF include the Chromium header directly.
#include "base/trace_event/trace_event.h"
#else // !USING_CHROMIUM_INCLUDES
// The following is substantially similar to the Chromium implementation.
@@ -150,20 +164,22 @@
#include "include/internal/cef_trace_event_internal.h"
// Records a pair of begin and end events called "name" for the current
// scope, with 0, 1 or 2 associated arguments. If the category is not
// enabled, then this does nothing.
// - category and name strings must have application lifetime (statics or
// literals). They may not include " chars.
#define TRACE_EVENT0(category, name) \
cef_trace_event_begin(category, name, NULL, 0, NULL, 0, false); \
///
/// Records a pair of begin and end events called "name" for the current
/// scope, with 0, 1 or 2 associated arguments. If the category is not
/// enabled, then this does nothing.
/// - category and name strings must have application lifetime (statics or
/// literals). They may not include " chars.
///
#define TRACE_EVENT0(category, name) \
cef_trace_event_begin(category, name, NULL, 0, NULL, 0); \
CEF_INTERNAL_TRACE_END_ON_SCOPE_CLOSE(category, name)
#define TRACE_EVENT1(category, name, arg1_name, arg1_val) \
cef_trace_event_begin(category, name, arg1_name, arg1_val, NULL, 0, false); \
#define TRACE_EVENT1(category, name, arg1_name, arg1_val) \
cef_trace_event_begin(category, name, arg1_name, arg1_val, NULL, 0); \
CEF_INTERNAL_TRACE_END_ON_SCOPE_CLOSE(category, name)
#define TRACE_EVENT2(category, name, arg1_name, arg1_val, arg2_name, arg2_val) \
cef_trace_event_begin(category, name, arg1_name, arg1_val, arg2_name, \
arg2_val, false); \
arg2_val); \
CEF_INTERNAL_TRACE_END_ON_SCOPE_CLOSE(category, name)
// Implementation detail: trace event macros create temporary variable names.
@@ -179,228 +195,181 @@
cef_trace_event::CefTraceEndOnScopeClose CEF_INTERNAL_TRACE_EVENT_UID( \
profileScope)(category, name)
// Records a single event called "name" immediately, with 0, 1 or 2
// associated arguments. If the category is not enabled, then this
// does nothing.
// - category and name strings must have application lifetime (statics or
// literals). They may not include " chars.
///
/// Records a single event called "name" immediately, with 0, 1 or 2
/// associated arguments. If the category is not enabled, then this
/// does nothing.
/// - category and name strings must have application lifetime (statics or
/// literals). They may not include " chars.
///
#define TRACE_EVENT_INSTANT0(category, name) \
cef_trace_event_instant(category, name, NULL, 0, NULL, 0, false)
cef_trace_event_instant(category, name, NULL, 0, NULL, 0)
#define TRACE_EVENT_INSTANT1(category, name, arg1_name, arg1_val) \
cef_trace_event_instant(category, name, arg1_name, arg1_val, NULL, 0, false)
cef_trace_event_instant(category, name, arg1_name, arg1_val, NULL, 0)
#define TRACE_EVENT_INSTANT2(category, name, arg1_name, arg1_val, arg2_name, \
arg2_val) \
cef_trace_event_instant(category, name, arg1_name, arg1_val, arg2_name, \
arg2_val, false)
#define TRACE_EVENT_COPY_INSTANT0(category, name) \
cef_trace_event_instant(category, name, NULL, 0, NULL, 0, true)
#define TRACE_EVENT_COPY_INSTANT1(category, name, arg1_name, arg1_val) \
cef_trace_event_instant(category, name, arg1_name, arg1_val, NULL, 0, true)
#define TRACE_EVENT_COPY_INSTANT2(category, name, arg1_name, arg1_val, \
arg2_name, arg2_val) \
cef_trace_event_instant(category, name, arg1_name, arg1_val, arg2_name, \
arg2_val, true)
arg2_val)
// Records a single BEGIN event called "name" immediately, with 0, 1 or 2
// associated arguments. If the category is not enabled, then this
// does nothing.
// - category and name strings must have application lifetime (statics or
// literals). They may not include " chars.
///
/// Records a single BEGIN event called "name" immediately, with 0, 1 or 2
/// associated arguments. If the category is not enabled, then this
/// does nothing.
/// - category and name strings must have application lifetime (statics or
/// literals). They may not include " chars.
///
#define TRACE_EVENT_BEGIN0(category, name) \
cef_trace_event_begin(category, name, NULL, 0, NULL, 0, false)
cef_trace_event_begin(category, name, NULL, 0, NULL, 0)
#define TRACE_EVENT_BEGIN1(category, name, arg1_name, arg1_val) \
cef_trace_event_begin(category, name, arg1_name, arg1_val, NULL, 0, false)
cef_trace_event_begin(category, name, arg1_name, arg1_val, NULL, 0)
#define TRACE_EVENT_BEGIN2(category, name, arg1_name, arg1_val, arg2_name, \
arg2_val) \
cef_trace_event_begin(category, name, arg1_name, arg1_val, arg2_name, \
arg2_val, false)
#define TRACE_EVENT_COPY_BEGIN0(category, name) \
cef_trace_event_begin(category, name, NULL, 0, NULL, 0, true)
#define TRACE_EVENT_COPY_BEGIN1(category, name, arg1_name, arg1_val) \
cef_trace_event_begin(category, name, arg1_name, arg1_val, NULL, 0, true)
#define TRACE_EVENT_COPY_BEGIN2(category, name, arg1_name, arg1_val, \
arg2_name, arg2_val) \
cef_trace_event_begin(category, name, arg1_name, arg1_val, arg2_name, \
arg2_val, true)
arg2_val)
// Records a single END event for "name" immediately. If the category
// is not enabled, then this does nothing.
// - category and name strings must have application lifetime (statics or
// literals). They may not include " chars.
///
/// Records a single END event for "name" immediately. If the category
/// is not enabled, then this does nothing.
/// - category and name strings must have application lifetime (statics or
/// literals). They may not include " chars.
///
#define TRACE_EVENT_END0(category, name) \
cef_trace_event_end(category, name, NULL, 0, NULL, 0, false)
cef_trace_event_end(category, name, NULL, 0, NULL, 0)
#define TRACE_EVENT_END1(category, name, arg1_name, arg1_val) \
cef_trace_event_end(category, name, arg1_name, arg1_val, NULL, 0, false)
cef_trace_event_end(category, name, arg1_name, arg1_val, NULL, 0)
#define TRACE_EVENT_END2(category, name, arg1_name, arg1_val, arg2_name, \
arg2_val) \
cef_trace_event_end(category, name, arg1_name, arg1_val, arg2_name, \
arg2_val, false)
#define TRACE_EVENT_COPY_END0(category, name) \
cef_trace_event_end(category, name, NULL, 0, NULL, 0, true)
#define TRACE_EVENT_COPY_END1(category, name, arg1_name, arg1_val) \
cef_trace_event_end(category, name, arg1_name, arg1_val, NULL, 0, true)
#define TRACE_EVENT_COPY_END2(category, name, arg1_name, arg1_val, arg2_name, \
arg2_val) \
cef_trace_event_end(category, name, arg1_name, arg1_val, arg2_name, \
arg2_val, true)
cef_trace_event_end(category, name, arg1_name, arg1_val, arg2_name, arg2_val)
// Records the value of a counter called "name" immediately. Value
// must be representable as a 32 bit integer.
// - category and name strings must have application lifetime (statics or
// literals). They may not include " chars.
///
/// Records the value of a counter called "name" immediately. Value
/// must be representable as a 32 bit integer.
/// - category and name strings must have application lifetime (statics or
/// literals). They may not include " chars.
///
#define TRACE_COUNTER1(category, name, value) \
cef_trace_counter(category, name, NULL, value, NULL, 0, false)
#define TRACE_COPY_COUNTER1(category, name, value) \
cef_trace_counter(category, name, NULL, value, NULL, 0, true)
cef_trace_counter(category, name, NULL, value, NULL, 0)
// Records the values of a multi-parted counter called "name" immediately.
// The UI will treat value1 and value2 as parts of a whole, displaying their
// values as a stacked-bar chart.
// - category and name strings must have application lifetime (statics or
// literals). They may not include " chars.
///
/// Records the values of a multi-parted counter called "name" immediately.
/// The UI will treat value1 and value2 as parts of a whole, displaying their
/// values as a stacked-bar chart.
/// - category and name strings must have application lifetime (statics or
/// literals). They may not include " chars.
///
#define TRACE_COUNTER2(category, name, value1_name, value1_val, value2_name, \
value2_val) \
cef_trace_counter(category, name, value1_name, value1_val, value2_name, \
value2_val, false)
#define TRACE_COPY_COUNTER2(category, name, value1_name, value1_val, \
value2_name, value2_val) \
cef_trace_counter(category, name, value1_name, value1_val, value2_name, \
value2_val, true)
value2_val)
// Records the value of a counter called "name" immediately. Value
// must be representable as a 32 bit integer.
// - category and name strings must have application lifetime (statics or
// literals). They may not include " chars.
// - |id| is used to disambiguate counters with the same name. It must either
// be a pointer or an integer value up to 64 bits. If it's a pointer, the
// bits will be xored with a hash of the process ID so that the same pointer
// on two different processes will not collide.
///
/// Records the value of a counter called "name" immediately. Value
/// must be representable as a 32 bit integer.
/// - category and name strings must have application lifetime (statics or
/// literals). They may not include " chars.
/// - |id| is used to disambiguate counters with the same name. It must either
/// be a pointer or an integer value up to 64 bits. If it's a pointer, the
/// bits will be xored with a hash of the process ID so that the same pointer
/// on two different processes will not collide.
///
#define TRACE_COUNTER_ID1(category, name, id, value) \
cef_trace_counter_id(category, name, id, NULL, value, NULL, 0, false)
#define TRACE_COPY_COUNTER_ID1(category, name, id, value) \
cef_trace_counter_id(category, name, id, NULL, value, NULL, 0, true)
cef_trace_counter_id(category, name, id, NULL, value, NULL, 0)
// Records the values of a multi-parted counter called "name" immediately.
// The UI will treat value1 and value2 as parts of a whole, displaying their
// values as a stacked-bar chart.
// - category and name strings must have application lifetime (statics or
// literals). They may not include " chars.
// - |id| is used to disambiguate counters with the same name. It must either
// be a pointer or an integer value up to 64 bits. If it's a pointer, the
// bits will be xored with a hash of the process ID so that the same pointer
// on two different processes will not collide.
///
/// Records the values of a multi-parted counter called "name" immediately.
/// The UI will treat value1 and value2 as parts of a whole, displaying their
/// values as a stacked-bar chart.
/// - category and name strings must have application lifetime (statics or
/// literals). They may not include " chars.
/// - |id| is used to disambiguate counters with the same name. It must either
/// be a pointer or an integer value up to 64 bits. If it's a pointer, the
/// bits will be xored with a hash of the process ID so that the same pointer
/// on two different processes will not collide.
///
#define TRACE_COUNTER_ID2(category, name, id, value1_name, value1_val, \
value2_name, value2_val) \
cef_trace_counter_id(category, name, id, value1_name, value1_val, \
value2_name, value2_val, false)
#define TRACE_COPY_COUNTER_ID2(category, name, id, value1_name, value1_val, \
value2_name, value2_val) \
cef_trace_counter_id(category, name, id, value1_name, value1_val, \
value2_name, value2_val, true)
value2_name, value2_val)
// Records a single ASYNC_BEGIN event called "name" immediately, with 0, 1 or 2
// associated arguments. If the category is not enabled, then this
// does nothing.
// - category and name strings must have application lifetime (statics or
// literals). They may not include " chars.
// - |id| is used to match the ASYNC_BEGIN event with the ASYNC_END event.
// ASYNC events are considered to match if their category, name and id values
// all match. |id| must either be a pointer or an integer value up to 64
// bits. If it's a pointer, the bits will be xored with a hash of the process
// ID sothat the same pointer on two different processes will not collide.
// An asynchronous operation can consist of multiple phases. The first phase is
// defined by the ASYNC_BEGIN calls. Additional phases can be defined using the
// ASYNC_STEP_BEGIN macros. When the operation completes, call ASYNC_END.
// An async operation can span threads and processes, but all events in that
// operation must use the same |name| and |id|. Each event can have its own
// args.
///
/// Records a single ASYNC_BEGIN event called "name" immediately, with 0, 1 or 2
/// associated arguments. If the category is not enabled, then this
/// does nothing.
/// - category and name strings must have application lifetime (statics or
/// literals). They may not include " chars.
/// - |id| is used to match the ASYNC_BEGIN event with the ASYNC_END event.
/// ASYNC events are considered to match if their category, name and id values
/// all match. |id| must either be a pointer or an integer value up to 64
/// bits. If it's a pointer, the bits will be xored with a hash of the process
/// ID sothat the same pointer on two different processes will not collide.
/// An asynchronous operation can consist of multiple phases. The first phase is
/// defined by the ASYNC_BEGIN calls. Additional phases can be defined using the
/// ASYNC_STEP_BEGIN macros. When the operation completes, call ASYNC_END.
/// An async operation can span threads and processes, but all events in that
/// operation must use the same |name| and |id|. Each event can have its own
/// args.
///
#define TRACE_EVENT_ASYNC_BEGIN0(category, name, id) \
cef_trace_event_async_begin(category, name, id, NULL, 0, NULL, 0, false)
#define TRACE_EVENT_ASYNC_BEGIN1(category, name, id, arg1_name, arg1_val) \
cef_trace_event_async_begin(category, name, id, arg1_name, arg1_val, NULL, \
0, false)
cef_trace_event_async_begin(category, name, id, NULL, 0, NULL, 0)
#define TRACE_EVENT_ASYNC_BEGIN1(category, name, id, arg1_name, arg1_val) \
cef_trace_event_async_begin(category, name, id, arg1_name, arg1_val, NULL, 0)
#define TRACE_EVENT_ASYNC_BEGIN2(category, name, id, arg1_name, arg1_val, \
arg2_name, arg2_val) \
cef_trace_event_async_begin(category, name, id, arg1_name, arg1_val, \
arg2_name, arg2_val, false)
#define TRACE_EVENT_COPY_ASYNC_BEGIN0(category, name, id) \
cef_trace_event_async_begin(category, name, id, NULL, 0, NULL, 0, true)
#define TRACE_EVENT_COPY_ASYNC_BEGIN1(category, name, id, arg1_name, arg1_val) \
cef_trace_event_async_begin(category, name, id, arg1_name, arg1_val, NULL, \
0, true)
#define TRACE_EVENT_COPY_ASYNC_BEGIN2(category, name, id, arg1_name, arg1_val, \
arg2_name, arg2_val) \
cef_trace_event_async_begin(category, name, id, arg1_name, arg1_val, \
arg2_name, arg2_val, true)
arg2_name, arg2_val)
// Records a single ASYNC_STEP_INTO event for |step| immediately. If the
// category is not enabled, then this does nothing. The |name| and |id| must
// match the ASYNC_BEGIN event above. The |step| param identifies this step
// within the async event. This should be called at the beginning of the next
// phase of an asynchronous operation. The ASYNC_BEGIN event must not have any
// ASYNC_STEP_PAST events.
///
/// Records a single ASYNC_STEP_INTO event for |step| immediately. If the
/// category is not enabled, then this does nothing. The |name| and |id| must
/// match the ASYNC_BEGIN event above. The |step| param identifies this step
/// within the async event. This should be called at the beginning of the next
/// phase of an asynchronous operation. The ASYNC_BEGIN event must not have any
/// ASYNC_STEP_PAST events.
///
#define TRACE_EVENT_ASYNC_STEP_INTO0(category, name, id, step) \
cef_trace_event_async_step_into(category, name, id, step, NULL, 0, false)
cef_trace_event_async_step_into(category, name, id, step, NULL, 0)
#define TRACE_EVENT_ASYNC_STEP_INTO1(category, name, id, step, arg1_name, \
arg1_val) \
cef_trace_event_async_step_into(category, name, id, step, arg1_name, \
arg1_val, false)
#define TRACE_EVENT_COPY_ASYNC_STEP_INTO0(category, name, id, step) \
cef_trace_event_async_step_into(category, name, id, step, NULL, 0, true)
#define TRACE_EVENT_COPY_ASYNC_STEP_INTO1(category, name, id, step, arg1_name, \
arg1_val) \
cef_trace_event_async_step_into(category, name, id, step, arg1_name, \
arg1_val, true)
cef_trace_event_async_step_into(category, name, id, step, arg1_name, arg1_val)
// Records a single ASYNC_STEP_PAST event for |step| immediately. If the
// category is not enabled, then this does nothing. The |name| and |id| must
// match the ASYNC_BEGIN event above. The |step| param identifies this step
// within the async event. This should be called at the beginning of the next
// phase of an asynchronous operation. The ASYNC_BEGIN event must not have any
// ASYNC_STEP_INTO events.
///
/// Records a single ASYNC_STEP_PAST event for |step| immediately. If the
/// category is not enabled, then this does nothing. The |name| and |id| must
/// match the ASYNC_BEGIN event above. The |step| param identifies this step
/// within the async event. This should be called at the beginning of the next
/// phase of an asynchronous operation. The ASYNC_BEGIN event must not have any
/// ASYNC_STEP_INTO events.
///
#define TRACE_EVENT_ASYNC_STEP_PAST0(category, name, id, step) \
cef_trace_event_async_step_past(category, name, id, step, NULL, 0, false)
cef_trace_event_async_step_past(category, name, id, step, NULL, 0)
#define TRACE_EVENT_ASYNC_STEP_PAST1(category, name, id, step, arg1_name, \
arg1_val) \
cef_trace_event_async_step_past(category, name, id, step, arg1_name, \
arg1_val, false)
#define TRACE_EVENT_COPY_ASYNC_STEP_PAST0(category, name, id, step) \
cef_trace_event_async_step_past(category, name, id, step, NULL, 0, true)
#define TRACE_EVENT_COPY_ASYNC_STEP_PAST1(category, name, id, step, arg1_name, \
arg1_val) \
cef_trace_event_async_step_past(category, name, id, step, arg1_name, \
arg1_val, true)
cef_trace_event_async_step_past(category, name, id, step, arg1_name, arg1_val)
// Records a single ASYNC_END event for "name" immediately. If the category
// is not enabled, then this does nothing.
///
/// Records a single ASYNC_END event for "name" immediately. If the category
/// is not enabled, then this does nothing.
///
#define TRACE_EVENT_ASYNC_END0(category, name, id) \
cef_trace_event_async_end(category, name, id, NULL, 0, NULL, 0, false)
#define TRACE_EVENT_ASYNC_END1(category, name, id, arg1_name, arg1_val) \
cef_trace_event_async_end(category, name, id, arg1_name, arg1_val, NULL, 0, \
false)
cef_trace_event_async_end(category, name, id, NULL, 0, NULL, 0)
#define TRACE_EVENT_ASYNC_END1(category, name, id, arg1_name, arg1_val) \
cef_trace_event_async_end(category, name, id, arg1_name, arg1_val, NULL, 0)
#define TRACE_EVENT_ASYNC_END2(category, name, id, arg1_name, arg1_val, \
arg2_name, arg2_val) \
cef_trace_event_async_end(category, name, id, arg1_name, arg1_val, \
arg2_name, arg2_val, false)
#define TRACE_EVENT_COPY_ASYNC_END0(category, name, id) \
cef_trace_event_async_end(category, name, id, NULL, 0, NULL, 0, true)
#define TRACE_EVENT_COPY_ASYNC_END1(category, name, id, arg1_name, arg1_val) \
cef_trace_event_async_end(category, name, id, arg1_name, arg1_val, NULL, 0, \
true)
#define TRACE_EVENT_COPY_ASYNC_END2(category, name, id, arg1_name, arg1_val, \
arg2_name, arg2_val) \
cef_trace_event_async_end(category, name, id, arg1_name, arg1_val, \
arg2_name, arg2_val, true)
arg2_name, arg2_val)
namespace cef_trace_event {
// Used by TRACE_EVENTx macro. Do not use directly.
///
/// Used by TRACE_EVENTx macro. Do not use directly.
///
class CefTraceEndOnScopeClose {
public:
CefTraceEndOnScopeClose(const char* category, const char* name)
: category_(category), name_(name) {}
~CefTraceEndOnScopeClose() {
cef_trace_event_end(category_, name_, NULL, 0, NULL, 0, false);
cef_trace_event_end(category_, name_, NULL, 0, NULL, 0);
}
private:
@@ -408,7 +377,7 @@ class CefTraceEndOnScopeClose {
const char* name_;
};
} // cef_trace_event
} // namespace cef_trace_event
#endif // !USING_CHROMIUM_INCLUDES

View File

@@ -28,25 +28,30 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Use std::tuple as tuple type. This file contains helper functions for
// working with std::tuples.
// The functions DispatchToMethod and DispatchToFunction take a function pointer
// or instance and method pointer, and unpack a tuple into arguments to the
// call.
//
// Example usage:
// // These two methods of creating a Tuple are identical.
// std::tuple<int, const char*> tuple_a(1, "wee");
// std::tuple<int, const char*> tuple_b = std::make_tuple(1, "wee");
//
// void SomeFunc(int a, const char* b) { }
// DispatchToFunction(&SomeFunc, tuple_a); // SomeFunc(1, "wee")
// DispatchToFunction(
// &SomeFunc, std::make_tuple(10, "foo")); // SomeFunc(10, "foo")
//
// struct { void SomeMeth(int a, int b, int c) { } } foo;
// DispatchToMethod(&foo, &Foo::SomeMeth, std::make_tuple(1, 2, 3));
// // foo->SomeMeth(1, 2, 3);
///
/// \file
/// Use std::tuple as tuple type. This file contains helper functions for
/// working with std::tuples.
/// The functions DispatchToMethod and DispatchToFunction take a function
/// pointer or instance and method pointer, and unpack a tuple into arguments to
/// the call.
///
/// Example usage:
/// <pre>
/// // These two methods of creating a Tuple are identical.
/// std::tuple<int, const char*> tuple_a(1, "wee");
/// std::tuple<int, const char*> tuple_b = std::make_tuple(1, "wee");
///
/// void SomeFunc(int a, const char* b) { }
/// DispatchToFunction(&SomeFunc, tuple_a); // SomeFunc(1, "wee")
/// DispatchToFunction(
/// &SomeFunc, std::make_tuple(10, "foo")); // SomeFunc(10, "foo")
///
/// struct { void SomeMeth(int a, int b, int c) { } } foo;
/// DispatchToMethod(&foo, &Foo::SomeMeth, std::make_tuple(1, 2, 3));
/// // foo->SomeMeth(1, 2, 3);
/// </pre>
///
#ifndef CEF_INCLUDE_BASE_CEF_TUPLE_H_
#define CEF_INCLUDE_BASE_CEF_TUPLE_H_
@@ -61,6 +66,7 @@
// updated to match.
#include <stddef.h>
#include <tuple>
#include <utility>
@@ -88,9 +94,7 @@ inline void DispatchToMethodImpl(const ObjT& obj,
}
template <typename ObjT, typename Method, typename Tuple>
inline void DispatchToMethod(const ObjT& obj,
Method method,
Tuple&& args) {
inline void DispatchToMethod(const ObjT& obj, Method method, Tuple&& args) {
constexpr size_t size = std::tuple_size<std::decay_t<Tuple>>::value;
DispatchToMethodImpl(obj, method, std::forward<Tuple>(args),
std::make_index_sequence<size>());

View File

@@ -28,69 +28,73 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Weak pointers are pointers to an object that do not affect its lifetime,
// and which may be invalidated (i.e. reset to nullptr) by the object, or its
// owner, at any time, most commonly when the object is about to be deleted.
// Weak pointers are useful when an object needs to be accessed safely by one
// or more objects other than its owner, and those callers can cope with the
// object vanishing and e.g. tasks posted to it being silently dropped.
// Reference-counting such an object would complicate the ownership graph and
// make it harder to reason about the object's lifetime.
// EXAMPLE:
//
// class Controller {
// public:
// void SpawnWorker() { Worker::StartNew(weak_factory_.GetWeakPtr()); }
// void WorkComplete(const Result& result) { ... }
// private:
// // Member variables should appear before the WeakPtrFactory, to ensure
// // that any WeakPtrs to Controller are invalidated before its members
// // variable's destructors are executed, rendering them invalid.
// WeakPtrFactory<Controller> weak_factory_{this};
// };
//
// class Worker {
// public:
// static void StartNew(WeakPtr<Controller> controller) {
// Worker* worker = new Worker(std::move(controller));
// // Kick off asynchronous processing...
// }
// private:
// Worker(WeakPtr<Controller> controller)
// : controller_(std::move(controller)) {}
// void DidCompleteAsynchronousProcessing(const Result& result) {
// if (controller_)
// controller_->WorkComplete(result);
// }
// WeakPtr<Controller> controller_;
// };
//
// With this implementation a caller may use SpawnWorker() to dispatch multiple
// Workers and subsequently delete the Controller, without waiting for all
// Workers to have completed.
// ------------------------- IMPORTANT: Thread-safety -------------------------
// Weak pointers may be passed safely between threads, but must always be
// dereferenced and invalidated on the same ThreaddTaskRunner otherwise
// checking the pointer would be racey.
//
// To ensure correct use, the first time a WeakPtr issued by a WeakPtrFactory
// is dereferenced, the factory and its WeakPtrs become bound to the calling
// thread or current ThreaddWorkerPool token, and cannot be dereferenced or
// invalidated on any other task runner. Bound WeakPtrs can still be handed
// off to other task runners, e.g. to use to post tasks back to object on the
// bound thread.
//
// If all WeakPtr objects are destroyed or invalidated then the factory is
// unbound from the ThreaddTaskRunner/Thread. The WeakPtrFactory may then be
// destroyed, or new WeakPtr objects may be used, from a different thread.
//
// Thus, at least one WeakPtr object must exist and have been dereferenced on
// the correct thread to enforce that other WeakPtr objects will enforce they
// are used on the desired thread.
///
/// \file
/// Weak pointers are pointers to an object that do not affect its lifetime.
/// They may be invalidated (i.e. reset to nullptr) by the object, or its
/// owner, at any time, most commonly when the object is about to be deleted.
///
/// Weak pointers are useful when an object needs to be accessed safely by one
/// or more objects other than its owner, and those callers can cope with the
/// object vanishing and e.g. tasks posted to it being silently dropped.
/// Reference-counting such an object would complicate the ownership graph and
/// make it harder to reason about the object's lifetime.
///
/// EXAMPLE:
///
/// <pre>
/// class Controller {
/// public:
/// void SpawnWorker() { Worker::StartNew(weak_factory_.GetWeakPtr()); }
/// void WorkComplete(const Result& result) { ... }
/// private:
/// // Member variables should appear before the WeakPtrFactory, to ensure
/// // that any WeakPtrs to Controller are invalidated before its members
/// // variable's destructors are executed, rendering them invalid.
/// WeakPtrFactory<Controller> weak_factory_{this};
/// };
///
/// class Worker {
/// public:
/// static void StartNew(WeakPtr<Controller> controller) {
/// Worker* worker = new Worker(std::move(controller));
/// // Kick off asynchronous processing...
/// }
/// private:
/// Worker(WeakPtr<Controller> controller)
/// : controller_(std::move(controller)) {}
/// void DidCompleteAsynchronousProcessing(const Result& result) {
/// if (controller_)
/// controller_->WorkComplete(result);
/// }
/// WeakPtr<Controller> controller_;
/// };
/// </pre>
///
/// With this implementation a caller may use SpawnWorker() to dispatch multiple
/// Workers and subsequently delete the Controller, without waiting for all
/// Workers to have completed.
///
/// <b>IMPORTANT: Thread-safety</b>
///
/// Weak pointers may be passed safely between threads, but must always be
/// dereferenced and invalidated on the same ThreaddTaskRunner otherwise
/// checking the pointer would be racey.
///
/// To ensure correct use, the first time a WeakPtr issued by a WeakPtrFactory
/// is dereferenced, the factory and its WeakPtrs become bound to the calling
/// thread or current ThreaddWorkerPool token, and cannot be dereferenced or
/// invalidated on any other task runner. Bound WeakPtrs can still be handed
/// off to other task runners, e.g. to use to post tasks back to object on the
/// bound thread.
///
/// If all WeakPtr objects are destroyed or invalidated then the factory is
/// unbound from the ThreadedTaskRunner/Thread. The WeakPtrFactory may then be
/// destroyed, or new WeakPtr objects may be used, from a different thread.
///
/// Thus, at least one WeakPtr object must exist and have been dereferenced on
/// the correct thread to enforce that other WeakPtr objects will enforce they
/// are used on the desired thread.
#ifndef CEF_INCLUDE_BASE_CEF_WEAK_PTR_H_
#define CEF_INCLUDE_BASE_CEF_WEAK_PTR_H_
@@ -119,7 +123,7 @@ class SupportsWeakPtr;
template <typename T>
class WeakPtr;
namespace internal {
namespace cef_internal {
// These classes are part of the WeakPtr implementation.
// DO NOT USE THESE CLASSES DIRECTLY YOURSELF.
@@ -193,7 +197,7 @@ class WeakPtrBase {
WeakPtrBase& operator=(WeakPtrBase&& other) noexcept = default;
void reset() {
ref_ = internal::WeakReference();
ref_ = cef_internal::WeakReference();
ptr_ = 0;
}
@@ -221,7 +225,7 @@ class SupportsWeakPtrBase {
template <typename Derived>
static WeakPtr<Derived> StaticAsWeakPtr(Derived* t) {
static_assert(
std::is_base_of<internal::SupportsWeakPtrBase, Derived>::value,
std::is_base_of<cef_internal::SupportsWeakPtrBase, Derived>::value,
"AsWeakPtr argument must inherit from SupportsWeakPtr");
return AsWeakPtrImpl<Derived>(t);
}
@@ -238,32 +242,37 @@ class SupportsWeakPtrBase {
}
};
} // namespace internal
} // namespace cef_internal
template <typename T>
class WeakPtrFactory;
// The WeakPtr class holds a weak reference to |T*|.
//
// This class is designed to be used like a normal pointer. You should always
// null-test an object of this class before using it or invoking a method that
// may result in the underlying object being destroyed.
//
// EXAMPLE:
//
// class Foo { ... };
// WeakPtr<Foo> foo;
// if (foo)
// foo->method();
//
///
/// The WeakPtr class holds a weak reference to |T*|.
///
/// This class is designed to be used like a normal pointer. You should always
/// null-test an object of this class before using it or invoking a method that
/// may result in the underlying object being destroyed.
///
/// EXAMPLE:
///
/// <pre>
/// class Foo { ... };
/// WeakPtr<Foo> foo;
/// if (foo)
/// foo->method();
/// </pre>
///
template <typename T>
class WeakPtr : public internal::WeakPtrBase {
class WeakPtr : public cef_internal::WeakPtrBase {
public:
WeakPtr() = default;
WeakPtr(std::nullptr_t) {}
// Allow conversion from U to T provided U "is a" T. Note that this
// is separate from the (implicit) copy and move constructors.
///
/// Allow conversion from U to T provided U "is a" T. Note that this
/// is separate from the (implicit) copy and move constructors.
///
template <typename U>
WeakPtr(const WeakPtr<U>& other) : WeakPtrBase(other) {
// Need to cast from U* to T* to do pointer adjustment in case of multiple
@@ -292,35 +301,43 @@ class WeakPtr : public internal::WeakPtrBase {
return get();
}
// Allow conditionals to test validity, e.g. if (weak_ptr) {...};
///
/// Allow conditionals to test validity, e.g. `if (weak_ptr) {...}`;
///
explicit operator bool() const { return get() != nullptr; }
// Returns false if the WeakPtr is confirmed to be invalid. This call is safe
// to make from any thread, e.g. to optimize away unnecessary work, but
// operator bool() must always be called, on the correct thread, before
// actually using the pointer.
//
// Warning: as with any object, this call is only thread-safe if the WeakPtr
// instance isn't being re-assigned or reset() racily with this call.
///
/// Returns false if the WeakPtr is confirmed to be invalid. This call is safe
/// to make from any thread, e.g. to optimize away unnecessary work, but
/// operator bool() must always be called, on the correct thread, before
/// actually using the pointer.
///
/// Warning: as with any object, this call is only thread-safe if the WeakPtr
/// instance isn't being re-assigned or reset() racily with this call.
///
bool MaybeValid() const { return ref_.MaybeValid(); }
// Returns whether the object |this| points to has been invalidated. This can
// be used to distinguish a WeakPtr to a destroyed object from one that has
// been explicitly set to null.
///
/// Returns whether the object |this| points to has been invalidated. This can
/// be used to distinguish a WeakPtr to a destroyed object from one that has
/// been explicitly set to null.
///
bool WasInvalidated() const { return ptr_ && !ref_.IsValid(); }
private:
friend class internal::SupportsWeakPtrBase;
friend class cef_internal::SupportsWeakPtrBase;
template <typename U>
friend class WeakPtr;
friend class SupportsWeakPtr<T>;
friend class WeakPtrFactory<T>;
WeakPtr(const internal::WeakReference& ref, T* ptr)
WeakPtr(const cef_internal::WeakReference& ref, T* ptr)
: WeakPtrBase(ref, reinterpret_cast<uintptr_t>(ptr)) {}
};
// Allow callers to compare WeakPtrs against nullptr to test validity.
///
/// Allow callers to compare WeakPtrs against nullptr to test validity.
///
template <class T>
bool operator!=(const WeakPtr<T>& weak_ptr, std::nullptr_t) {
return !(weak_ptr == nullptr);
@@ -338,23 +355,26 @@ bool operator==(std::nullptr_t, const WeakPtr<T>& weak_ptr) {
return weak_ptr == nullptr;
}
namespace internal {
namespace cef_internal {
class WeakPtrFactoryBase {
protected:
WeakPtrFactoryBase(uintptr_t ptr);
~WeakPtrFactoryBase();
internal::WeakReferenceOwner weak_reference_owner_;
cef_internal::WeakReferenceOwner weak_reference_owner_;
uintptr_t ptr_;
};
} // namespace internal
} // namespace cef_internal
// A class may be composed of a WeakPtrFactory and thereby
// control how it exposes weak pointers to itself. This is helpful if you only
// need weak pointers within the implementation of a class. This class is also
// useful when working with primitive types. For example, you could have a
// WeakPtrFactory<bool> that is used to pass around a weak reference to a bool.
///
/// A class may be composed of a WeakPtrFactory and thereby control how it
/// exposes weak pointers to itself. This is helpful if you only need weak
/// pointers within the implementation of a class. This class is also useful
/// when working with primitive types. For example, you could have a
/// WeakPtrFactory<bool> that is used to pass around a weak reference to a
/// bool.
///
template <class T>
class WeakPtrFactory : public internal::WeakPtrFactoryBase {
class WeakPtrFactory : public cef_internal::WeakPtrFactoryBase {
public:
WeakPtrFactory() = delete;
@@ -371,26 +391,32 @@ class WeakPtrFactory : public internal::WeakPtrFactoryBase {
reinterpret_cast<T*>(ptr_));
}
// Call this method to invalidate all existing weak pointers.
///
/// Call this method to invalidate all existing weak pointers.
///
void InvalidateWeakPtrs() {
DCHECK(ptr_);
weak_reference_owner_.Invalidate();
}
// Call this method to determine if any weak pointers exist.
///
/// Call this method to determine if any weak pointers exist.
///
bool HasWeakPtrs() const {
DCHECK(ptr_);
return weak_reference_owner_.HasRefs();
}
};
// A class may extend from SupportsWeakPtr to let others take weak pointers to
// it. This avoids the class itself implementing boilerplate to dispense weak
// pointers. However, since SupportsWeakPtr's destructor won't invalidate
// weak pointers to the class until after the derived class' members have been
// destroyed, its use can lead to subtle use-after-destroy issues.
///
/// A class may extend from SupportsWeakPtr to let others take weak pointers to
/// it. This avoids the class itself implementing boilerplate to dispense weak
/// pointers. However, since SupportsWeakPtr's destructor won't invalidate
/// weak pointers to the class until after the derived class' members have been
/// destroyed, its use can lead to subtle use-after-destroy issues.
///
template <class T>
class SupportsWeakPtr : public internal::SupportsWeakPtrBase {
class SupportsWeakPtr : public cef_internal::SupportsWeakPtrBase {
public:
SupportsWeakPtr() = default;
@@ -405,30 +431,35 @@ class SupportsWeakPtr : public internal::SupportsWeakPtrBase {
~SupportsWeakPtr() = default;
private:
internal::WeakReferenceOwner weak_reference_owner_;
cef_internal::WeakReferenceOwner weak_reference_owner_;
};
// Helper function that uses type deduction to safely return a WeakPtr<Derived>
// when Derived doesn't directly extend SupportsWeakPtr<Derived>, instead it
// extends a Base that extends SupportsWeakPtr<Base>.
//
// EXAMPLE:
// class Base : public base::SupportsWeakPtr<Producer> {};
// class Derived : public Base {};
//
// Derived derived;
// base::WeakPtr<Derived> ptr = base::AsWeakPtr(&derived);
//
// Note that the following doesn't work (invalid type conversion) since
// Derived::AsWeakPtr() is WeakPtr<Base> SupportsWeakPtr<Base>::AsWeakPtr(),
// and there's no way to safely cast WeakPtr<Base> to WeakPtr<Derived> at
// the caller.
//
// base::WeakPtr<Derived> ptr = derived.AsWeakPtr(); // Fails.
///
/// Helper function that uses type deduction to safely return a WeakPtr<Derived>
/// when Derived doesn't directly extend SupportsWeakPtr<Derived>, instead it
/// extends a Base that extends SupportsWeakPtr<Base>.
///
/// EXAMPLE:
/// <pre>
/// class Base : public base::SupportsWeakPtr<Producer> {};
/// class Derived : public Base {};
///
/// Derived derived;
/// base::WeakPtr<Derived> ptr = base::AsWeakPtr(&derived);
/// </pre>
///
/// Note that the following doesn't work (invalid type conversion) since
/// Derived::AsWeakPtr() is WeakPtr<Base> SupportsWeakPtr<Base>::AsWeakPtr(),
/// and there's no way to safely cast WeakPtr<Base> to WeakPtr<Derived> at
/// the caller.
///
/// <pre>
/// base::WeakPtr<Derived> ptr = derived.AsWeakPtr(); // Fails.
/// </pre>
///
template <typename Derived>
WeakPtr<Derived> AsWeakPtr(Derived* t) {
return internal::SupportsWeakPtrBase::StaticAsWeakPtr<Derived>(t);
return cef_internal::SupportsWeakPtrBase::StaticAsWeakPtr<Derived>(t);
}
} // namespace base

View File

@@ -68,7 +68,6 @@
#include "include/base/cef_build.h"
#include "include/base/cef_compiler_specific.h"
#include "include/base/cef_logging.h"
#include "include/base/cef_template_util.h"
#include "include/base/cef_weak_ptr.h"
#include "include/base/internal/cef_callback_internal.h"
#include "include/base/internal/cef_raw_scoped_refptr_mismatch_checker.h"
@@ -97,7 +96,7 @@ struct BindUnwrapTraits;
template <typename Functor, typename BoundArgsTuple, typename SFINAE = void>
struct CallbackCancellationTraits;
namespace internal {
namespace cef_internal {
template <typename Functor, typename SFINAE = void>
struct FunctorTraits;
@@ -356,14 +355,14 @@ template <typename Functor, typename SFINAE = void>
struct IsCallableObject : std::false_type {};
template <typename Callable>
struct IsCallableObject<Callable, void_t<decltype(&Callable::operator())>>
struct IsCallableObject<Callable, std::void_t<decltype(&Callable::operator())>>
: std::true_type {};
// HasRefCountedTypeAsRawPtr inherits from true_type when any of the |Args| is a
// raw pointer to a RefCounted type.
template <typename... Ts>
struct HasRefCountedTypeAsRawPtr
: disjunction<NeedsScopedRefptrButGetsRawPtr<Ts>...> {};
: std::disjunction<NeedsScopedRefptrButGetsRawPtr<Ts>...> {};
// ForceVoidReturn<>
//
@@ -687,8 +686,9 @@ struct InvokeHelper<true, ReturnType> {
static inline void MakeItSo(Functor&& functor,
BoundWeakPtr&& weak_ptr,
RunArgs&&... args) {
if (!weak_ptr)
if (!weak_ptr) {
return;
}
using Traits = MakeFunctorTraits<Functor>;
Traits::Invoke(std::forward<Functor>(functor),
std::forward<BoundWeakPtr>(weak_ptr),
@@ -877,7 +877,7 @@ BanUnconstructedRefCountedReceiver(const Receiver& receiver, Unused&&...) {
// This stores all the state passed into Bind().
template <typename Functor, typename... BoundArgs>
struct BindState final : BindStateBase {
using IsCancellable = bool_constant<
using IsCancellable = std::bool_constant<
CallbackCancellationTraits<Functor,
std::tuple<BoundArgs...>>::is_cancellable>;
template <typename ForwardFunctor, typename... ForwardBoundArgs>
@@ -1189,7 +1189,11 @@ struct AssertBindArgsValidity<std::index_sequence<Ns...>,
TypeList<Args...>,
TypeList<Unwrapped...>,
TypeList<Params...>>
: AssertConstructible<Ns, Args, std::decay_t<Args>, Unwrapped, Params>... {
: AssertConstructible<static_cast<int>(Ns),
Args,
std::decay_t<Args>,
Unwrapped,
Params>... {
static constexpr bool ok = true;
};
@@ -1247,7 +1251,7 @@ decltype(auto) BindImpl(Functor&& functor, Args&&... args) {
// PolymorphicInvoke, to which CallbackType will cast back.
using PolymorphicInvoke = typename CallbackType::PolymorphicInvoke;
PolymorphicInvoke invoke_func =
GetInvokeFunc<Invoker>(bool_constant<kIsOnce>());
GetInvokeFunc<Invoker>(std::bool_constant<kIsOnce>());
using InvokeFuncStorage = BindStateBase::InvokeFuncStorage;
return CallbackType(BindState::Create(
@@ -1255,7 +1259,7 @@ decltype(auto) BindImpl(Functor&& functor, Args&&... args) {
std::forward<Functor>(functor), std::forward<Args>(args)...));
}
} // namespace internal
} // namespace cef_internal
// An injection point to control |this| pointer behavior on a method invocation.
// If IsWeakReceiver<> is true_type for |T| and |T| is used for a receiver of a
@@ -1299,30 +1303,36 @@ struct BindUnwrapTraits {
};
template <typename T>
struct BindUnwrapTraits<internal::UnretainedWrapper<T>> {
static T* Unwrap(const internal::UnretainedWrapper<T>& o) { return o.get(); }
};
template <typename T>
struct BindUnwrapTraits<internal::RetainedRefWrapper<T>> {
static T* Unwrap(const internal::RetainedRefWrapper<T>& o) { return o.get(); }
};
template <typename T, typename Deleter>
struct BindUnwrapTraits<internal::OwnedWrapper<T, Deleter>> {
static T* Unwrap(const internal::OwnedWrapper<T, Deleter>& o) {
struct BindUnwrapTraits<cef_internal::UnretainedWrapper<T>> {
static T* Unwrap(const cef_internal::UnretainedWrapper<T>& o) {
return o.get();
}
};
template <typename T>
struct BindUnwrapTraits<internal::OwnedRefWrapper<T>> {
static T& Unwrap(const internal::OwnedRefWrapper<T>& o) { return o.get(); }
struct BindUnwrapTraits<cef_internal::RetainedRefWrapper<T>> {
static T* Unwrap(const cef_internal::RetainedRefWrapper<T>& o) {
return o.get();
}
};
template <typename T, typename Deleter>
struct BindUnwrapTraits<cef_internal::OwnedWrapper<T, Deleter>> {
static T* Unwrap(const cef_internal::OwnedWrapper<T, Deleter>& o) {
return o.get();
}
};
template <typename T>
struct BindUnwrapTraits<internal::PassedWrapper<T>> {
static T Unwrap(const internal::PassedWrapper<T>& o) { return o.Take(); }
struct BindUnwrapTraits<cef_internal::OwnedRefWrapper<T>> {
static T& Unwrap(const cef_internal::OwnedRefWrapper<T>& o) {
return o.get();
}
};
template <typename T>
struct BindUnwrapTraits<cef_internal::PassedWrapper<T>> {
static T Unwrap(const cef_internal::PassedWrapper<T>& o) { return o.Take(); }
};
#if defined(OS_WIN)
@@ -1346,9 +1356,9 @@ template <typename Functor, typename... BoundArgs>
struct CallbackCancellationTraits<
Functor,
std::tuple<BoundArgs...>,
std::enable_if_t<
internal::IsWeakMethod<internal::FunctorTraits<Functor>::is_method,
BoundArgs...>::value>> {
std::enable_if_t<cef_internal::IsWeakMethod<
cef_internal::FunctorTraits<Functor>::is_method,
BoundArgs...>::value>> {
static constexpr bool is_cancellable = true;
template <typename Receiver, typename... Args>

View File

@@ -43,7 +43,7 @@ namespace base {
struct FakeBindState;
namespace internal {
namespace cef_internal {
class BindStateBase;
class FinallyExecutorCommon;
@@ -269,7 +269,7 @@ struct ThenHelper<OriginalCallback<OriginalR(OriginalArgs...)>,
}
};
} // namespace internal
} // namespace cef_internal
} // namespace base
#endif // CEF_INCLUDE_BASE_INTERNAL_CEF_CALLBACK_INTERNAL_H_

View File

@@ -0,0 +1,50 @@
// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// The following macros are used to declare both the color id enumerations and
// the stringized names of the enumeration elements for use in dump_colors. To
// stringize the element names, define STRINGIZE_COLOR_IDS prior to including
// this file. This file is intended to be included just before and just after
// the enumeration or string array declarations.
#if !defined(COLOR_ID_MACROS_DEFINED)
#define COLOR_ID_MACROS_DEFINED
#if defined(STRINGIZE_COLOR_IDS)
// Convert first token to string, throw away the rest.
#define D1(enum_name) #enum_name
#define D2(enum_name, enum_value) #enum_name
#else // defined(STRINGIZE_COLOR_IDS)
// Declare enum with optional assigned value.
#define D1(enum_name) enum_name
#define D2(enum_name, enum_value) enum_name = enum_value
#endif // defined(STRINGIZE_COLOR_IDS)
// Select which token in the declaration is the assigned value.
// Use first and optional third token, ignore optional second.
#define E1(enum_name) D1(enum_name)
#define E2(enum_name, old_enum_name) D1(enum_name)
#define E3(enum_name, old_enum_name, enum_value) D2(enum_name, enum_value)
#define GET_E(_1, _2, _3, macro_name, ...) macro_name
#if defined(COMPILER_MSVC)
// Workaround for MSVC not properly expanding __VA_ARGS__.
#define EXPAND(x) x
#define E_CPONLY(...) EXPAND(E(__VA_ARGS__))
#define E(...) EXPAND(GET_E(__VA_ARGS__, E3, E2, E1)(__VA_ARGS__)),
#else // !defined(COMPILER_MSVC)
#define E_CPONLY(...) E(__VA_ARGS__)
#define E(...) GET_E(__VA_ARGS__, E3, E2, E1)(__VA_ARGS__),
#endif // !defined(COMPILER_MSVC)
#else // !defined(COLOR_ID_MACROS_DEFINED)
#undef D1
#undef D2
#undef E1
#undef E2
#undef E3
#if defined(COMPILER_MSVC)
#undef EXPAND
#endif
#undef E_CPONLY
#undef GET_E
#undef E
#undef COLOR_ID_MACROS_DEFINED
#endif // !defined(COLOR_ID_MACROS_DEFINED)

View File

@@ -34,8 +34,6 @@
#include <type_traits>
#include "include/base/cef_template_util.h"
// It is dangerous to post a task with a T* argument where T is a subtype of
// RefCounted(Base|ThreadSafeBase), since by the time the parameter is used, the
// object may already have been deleted since it was not held with a
@@ -47,28 +45,28 @@ namespace base {
// This is a base internal implementation file used by task.h and callback.h.
// Not for public consumption, so we wrap it in namespace internal.
namespace internal {
namespace cef_internal {
template <typename T, typename = void>
struct IsRefCountedType : std::false_type {};
template <typename T>
struct IsRefCountedType<T,
void_t<decltype(std::declval<T*>()->AddRef()),
decltype(std::declval<T*>()->Release())>>
std::void_t<decltype(std::declval<T*>()->AddRef()),
decltype(std::declval<T*>()->Release())>>
: std::true_type {};
// Human readable translation: you needed to be a scoped_refptr if you are a raw
// pointer type and are convertible to a RefCounted(Base|ThreadSafeBase) type.
template <typename T>
struct NeedsScopedRefptrButGetsRawPtr
: conjunction<std::is_pointer<T>,
IsRefCountedType<std::remove_pointer_t<T>>> {
: std::conjunction<std::is_pointer<T>,
IsRefCountedType<std::remove_pointer_t<T>>> {
static_assert(!std::is_reference<T>::value,
"NeedsScopedRefptrButGetsRawPtr requires non-reference type.");
};
} // namespace internal
} // namespace cef_internal
} // namespace base

View File

@@ -38,13 +38,14 @@
#include "include/base/cef_scoped_typeref_mac.h"
#if defined(__has_feature) && __has_feature(objc_arc)
#error "Cannot include include/base/internal/cef_scoped_block_mac.h in file built with ARC."
#error \
"Cannot include include/base/internal/cef_scoped_block_mac.h in file built with ARC."
#endif
namespace base {
namespace mac {
namespace internal {
namespace cef_internal {
template <typename B>
struct ScopedBlockTraits {
@@ -53,12 +54,12 @@ struct ScopedBlockTraits {
static void Release(B block) { Block_release(block); }
};
} // namespace internal
} // namespace cef_internal
// ScopedBlock<> is patterned after ScopedCFTypeRef<>, but uses Block_copy() and
// Block_release() instead of CFRetain() and CFRelease().
template <typename B>
using ScopedBlock = ScopedTypeRef<B, internal::ScopedBlockTraits<B>>;
using ScopedBlock = ScopedTypeRef<B, cef_internal::ScopedBlockTraits<B>>;
} // namespace mac
} // namespace base

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=306e44d49ab6198a0fa1bcea50e8a25ee18672be$
// $hash=6ea5d772fb4961ae4a658b4b730aa608fa93309f$
//
#ifndef CEF_INCLUDE_CAPI_CEF_ACCESSIBILITY_HANDLER_CAPI_H_
@@ -47,27 +47,27 @@ extern "C" {
#endif
///
// Implement this structure to receive accessibility notification when
// accessibility events have been registered. The functions of this structure
// will be called on the UI thread.
/// Implement this structure to receive accessibility notification when
/// accessibility events have been registered. The functions of this structure
/// will be called on the UI thread.
///
typedef struct _cef_accessibility_handler_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Called after renderer process sends accessibility tree changes to the
// browser process.
/// Called after renderer process sends accessibility tree changes to the
/// browser process.
///
void(CEF_CALLBACK* on_accessibility_tree_change)(
struct _cef_accessibility_handler_t* self,
struct _cef_value_t* value);
///
// Called after renderer process sends accessibility location changes to the
// browser process.
/// Called after renderer process sends accessibility location changes to the
/// browser process.
///
void(CEF_CALLBACK* on_accessibility_location_change)(
struct _cef_accessibility_handler_t* self,

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=665709ecf3ebad59e85285d319eae72197b9766f$
// $hash=608f4520d7901b6e18bf9164c9460f1b75bad8f4$
//
#ifndef CEF_INCLUDE_CAPI_CEF_APP_CAPI_H_
@@ -54,25 +54,26 @@ extern "C" {
struct _cef_app_t;
///
// Implement this structure to provide handler implementations. Methods will be
// called by the process and/or thread indicated.
/// Implement this structure to provide handler implementations. Methods will be
/// called by the process and/or thread indicated.
///
typedef struct _cef_app_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Provides an opportunity to view and/or modify command-line arguments before
// processing by CEF and Chromium. The |process_type| value will be NULL for
// the browser process. Do not keep a reference to the cef_command_line_t
// object passed to this function. The CefSettings.command_line_args_disabled
// value can be used to start with an NULL command-line object. Any values
// specified in CefSettings that equate to command-line arguments will be set
// before this function is called. Be cautious when using this function to
// modify command-line arguments for non-browser processes as this may result
// in undefined behavior including crashes.
/// Provides an opportunity to view and/or modify command-line arguments
/// before processing by CEF and Chromium. The |process_type| value will be
/// NULL for the browser process. Do not keep a reference to the
/// cef_command_line_t object passed to this function. The
/// cef_settings_t.command_line_args_disabled value can be used to start with
/// an NULL command-line object. Any values specified in CefSettings that
/// equate to command-line arguments will be set before this function is
/// called. Be cautious when using this function to modify command-line
/// arguments for non-browser processes as this may result in undefined
/// behavior including crashes.
///
void(CEF_CALLBACK* on_before_command_line_processing)(
struct _cef_app_t* self,
@@ -80,120 +81,121 @@ typedef struct _cef_app_t {
struct _cef_command_line_t* command_line);
///
// Provides an opportunity to register custom schemes. Do not keep a reference
// to the |registrar| object. This function is called on the main thread for
// each process and the registered schemes should be the same across all
// processes.
/// Provides an opportunity to register custom schemes. Do not keep a
/// reference to the |registrar| object. This function is called on the main
/// thread for each process and the registered schemes should be the same
/// across all processes.
///
void(CEF_CALLBACK* on_register_custom_schemes)(
struct _cef_app_t* self,
struct _cef_scheme_registrar_t* registrar);
///
// Return the handler for resource bundle events. If
// CefSettings.pack_loading_disabled is true (1) a handler must be returned.
// If no handler is returned resources will be loaded from pack files. This
// function is called by the browser and render processes on multiple threads.
/// Return the handler for resource bundle events. If no handler is returned
/// resources will be loaded from pack files. This function is called by the
/// browser and render processes on multiple threads.
///
struct _cef_resource_bundle_handler_t*(
CEF_CALLBACK* get_resource_bundle_handler)(struct _cef_app_t* self);
///
// Return the handler for functionality specific to the browser process. This
// function is called on multiple threads in the browser process.
/// Return the handler for functionality specific to the browser process. This
/// function is called on multiple threads in the browser process.
///
struct _cef_browser_process_handler_t*(
CEF_CALLBACK* get_browser_process_handler)(struct _cef_app_t* self);
///
// Return the handler for functionality specific to the render process. This
// function is called on the render process main thread.
/// Return the handler for functionality specific to the render process. This
/// function is called on the render process main thread.
///
struct _cef_render_process_handler_t*(
CEF_CALLBACK* get_render_process_handler)(struct _cef_app_t* self);
} cef_app_t;
///
// This function should be called from the application entry point function to
// execute a secondary process. It can be used to run secondary processes from
// the browser client executable (default behavior) or from a separate
// executable specified by the CefSettings.browser_subprocess_path value. If
// called for the browser process (identified by no "type" command-line value)
// it will return immediately with a value of -1. If called for a recognized
// secondary process it will block until the process should exit and then return
// the process exit code. The |application| parameter may be NULL. The
// |windows_sandbox_info| parameter is only used on Windows and may be NULL (see
// cef_sandbox_win.h for details).
/// This function should be called from the application entry point function to
/// execute a secondary process. It can be used to run secondary processes from
/// the browser client executable (default behavior) or from a separate
/// executable specified by the cef_settings_t.browser_subprocess_path value. If
/// called for the browser process (identified by no "type" command-line value)
/// it will return immediately with a value of -1. If called for a recognized
/// secondary process it will block until the process should exit and then
/// return the process exit code. The |application| parameter may be NULL. The
/// |windows_sandbox_info| parameter is only used on Windows and may be NULL
/// (see cef_sandbox_win.h for details).
///
CEF_EXPORT int cef_execute_process(const struct _cef_main_args_t* args,
CEF_EXPORT int cef_execute_process(const cef_main_args_t* args,
cef_app_t* application,
void* windows_sandbox_info);
///
// This function should be called on the main application thread to initialize
// the CEF browser process. The |application| parameter may be NULL. A return
// value of true (1) indicates that it succeeded and false (0) indicates that it
// failed. The |windows_sandbox_info| parameter is only used on Windows and may
// be NULL (see cef_sandbox_win.h for details).
/// This function should be called on the main application thread to initialize
/// the CEF browser process. The |application| parameter may be NULL. Returns
/// true (1) if initialization succeeds. Returns false (0) if initialization
/// fails or if early exit is desired (for example, due to process singleton
/// relaunch behavior). If this function returns false (0) then the application
/// should exit immediately without calling any other CEF functions except,
/// optionally, CefGetErrorCode. The |windows_sandbox_info| parameter is only
/// used on Windows and may be NULL (see cef_sandbox_win.h for details).
///
CEF_EXPORT int cef_initialize(const struct _cef_main_args_t* args,
CEF_EXPORT int cef_initialize(const cef_main_args_t* args,
const struct _cef_settings_t* settings,
cef_app_t* application,
void* windows_sandbox_info);
///
// This function should be called on the main application thread to shut down
// the CEF browser process before the application exits.
/// This function can optionally be called on the main application thread after
/// CefInitialize to retrieve the initialization exit code. When CefInitialize
/// returns true (1) the exit code will be 0 (CEF_RESULT_CODE_NORMAL_EXIT).
/// Otherwise, see cef_resultcode_t for possible exit code values including
/// browser process initialization errors and normal early exit conditions (such
/// as CEF_RESULT_CODE_NORMAL_EXIT_PROCESS_NOTIFIED for process singleton
/// relaunch behavior).
///
CEF_EXPORT int cef_get_exit_code(void);
///
/// This function should be called on the main application thread to shut down
/// the CEF browser process before the application exits. Do not call any other
/// CEF functions after calling this function.
///
CEF_EXPORT void cef_shutdown(void);
///
// Perform a single iteration of CEF message loop processing. This function is
// provided for cases where the CEF message loop must be integrated into an
// existing application message loop. Use of this function is not recommended
// for most users; use either the cef_run_message_loop() function or
// CefSettings.multi_threaded_message_loop if possible. When using this function
// care must be taken to balance performance against excessive CPU usage. It is
// recommended to enable the CefSettings.external_message_pump option when using
// this function so that
// cef_browser_process_handler_t::on_schedule_message_pump_work() callbacks can
// facilitate the scheduling process. This function should only be called on the
// main application thread and only if cef_initialize() is called with a
// CefSettings.multi_threaded_message_loop value of false (0). This function
// will not block.
/// Perform a single iteration of CEF message loop processing. This function is
/// provided for cases where the CEF message loop must be integrated into an
/// existing application message loop. Use of this function is not recommended
/// for most users; use either the cef_run_message_loop() function or
/// cef_settings_t.multi_threaded_message_loop if possible. When using this
/// function care must be taken to balance performance against excessive CPU
/// usage. It is recommended to enable the cef_settings_t.external_message_pump
/// option when using this function so that
/// cef_browser_process_handler_t::on_schedule_message_pump_work() callbacks can
/// facilitate the scheduling process. This function should only be called on
/// the main application thread and only if cef_initialize() is called with a
/// cef_settings_t.multi_threaded_message_loop value of false (0). This function
/// will not block.
///
CEF_EXPORT void cef_do_message_loop_work(void);
///
// Run the CEF message loop. Use this function instead of an application-
// provided message loop to get the best balance between performance and CPU
// usage. This function should only be called on the main application thread and
// only if cef_initialize() is called with a
// CefSettings.multi_threaded_message_loop value of false (0). This function
// will block until a quit message is received by the system.
/// Run the CEF message loop. Use this function instead of an application-
/// provided message loop to get the best balance between performance and CPU
/// usage. This function should only be called on the main application thread
/// and only if cef_initialize() is called with a
/// cef_settings_t.multi_threaded_message_loop value of false (0). This function
/// will block until a quit message is received by the system.
///
CEF_EXPORT void cef_run_message_loop(void);
///
// Quit the CEF message loop that was started by calling cef_run_message_loop().
// This function should only be called on the main application thread and only
// if cef_run_message_loop() was used.
/// Quit the CEF message loop that was started by calling
/// cef_run_message_loop(). This function should only be called on the main
/// application thread and only if cef_run_message_loop() was used.
///
CEF_EXPORT void cef_quit_message_loop(void);
///
// Set to true (1) before calling Windows APIs like TrackPopupMenu that enter a
// modal message loop. Set to false (0) after exiting the modal message loop.
///
CEF_EXPORT void cef_set_osmodal_loop(int osModalLoop);
///
// Call during process startup to enable High-DPI support on Windows 7 or newer.
// Older versions of Windows should be left DPI-unaware because they do not
// support DirectWrite and GDI fonts are kerned very badly.
///
CEF_EXPORT void cef_enable_highdpi_support(void);
#ifdef __cplusplus
}
#endif

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=fd8d34089842ee8f8490ef1828c3091d12052e28$
// $hash=d98482eba93dcd8b6a6f69b2732162733c73203d$
//
#ifndef CEF_INCLUDE_CAPI_CEF_AUDIO_HANDLER_CAPI_H_
@@ -48,30 +48,30 @@ extern "C" {
#endif
///
// Implement this structure to handle audio events.
/// Implement this structure to handle audio events.
///
typedef struct _cef_audio_handler_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Called on the UI thread to allow configuration of audio stream parameters.
// Return true (1) to proceed with audio stream capture, or false (0) to
// cancel it. All members of |params| can optionally be configured here, but
// they are also pre-filled with some sensible defaults.
/// Called on the UI thread to allow configuration of audio stream parameters.
/// Return true (1) to proceed with audio stream capture, or false (0) to
/// cancel it. All members of |params| can optionally be configured here, but
/// they are also pre-filled with some sensible defaults.
///
int(CEF_CALLBACK* get_audio_parameters)(struct _cef_audio_handler_t* self,
struct _cef_browser_t* browser,
cef_audio_parameters_t* params);
///
// Called on a browser audio capture thread when the browser starts streaming
// audio. OnAudioSteamStopped will always be called after
// OnAudioStreamStarted; both functions may be called multiple times for the
// same browser. |params| contains the audio parameters like sample rate and
// channel layout. |channels| is the number of channels.
/// Called on a browser audio capture thread when the browser starts streaming
/// audio. OnAudioStreamStopped will always be called after
/// OnAudioStreamStarted; both functions may be called multiple times for the
/// same browser. |params| contains the audio parameters like sample rate and
/// channel layout. |channels| is the number of channels.
///
void(CEF_CALLBACK* on_audio_stream_started)(
struct _cef_audio_handler_t* self,
@@ -80,34 +80,34 @@ typedef struct _cef_audio_handler_t {
int channels);
///
// Called on the audio stream thread when a PCM packet is received for the
// stream. |data| is an array representing the raw PCM data as a floating
// point type, i.e. 4-byte value(s). |frames| is the number of frames in the
// PCM packet. |pts| is the presentation timestamp (in milliseconds since the
// Unix Epoch) and represents the time at which the decompressed packet should
// be presented to the user. Based on |frames| and the |channel_layout| value
// passed to OnAudioStreamStarted you can calculate the size of the |data|
// array in bytes.
/// Called on the audio stream thread when a PCM packet is received for the
/// stream. |data| is an array representing the raw PCM data as a floating
/// point type, i.e. 4-byte value(s). |frames| is the number of frames in the
/// PCM packet. |pts| is the presentation timestamp (in milliseconds since the
/// Unix Epoch) and represents the time at which the decompressed packet
/// should be presented to the user. Based on |frames| and the
/// |channel_layout| value passed to OnAudioStreamStarted you can calculate
/// the size of the |data| array in bytes.
///
void(CEF_CALLBACK* on_audio_stream_packet)(struct _cef_audio_handler_t* self,
struct _cef_browser_t* browser,
const float** data,
int frames,
int64 pts);
int64_t pts);
///
// Called on the UI thread when the stream has stopped. OnAudioSteamStopped
// will always be called after OnAudioStreamStarted; both functions may be
// called multiple times for the same stream.
/// Called on the UI thread when the stream has stopped. OnAudioSteamStopped
/// will always be called after OnAudioStreamStarted; both functions may be
/// called multiple times for the same stream.
///
void(CEF_CALLBACK* on_audio_stream_stopped)(struct _cef_audio_handler_t* self,
struct _cef_browser_t* browser);
///
// Called on the UI or audio stream thread when an error occurred. During the
// stream creation phase this callback will be called on the UI thread while
// in the capturing phase it will be called on the audio stream thread. The
// stream will be stopped immediately.
/// Called on the UI or audio stream thread when an error occurred. During the
/// stream creation phase this callback will be called on the UI thread while
/// in the capturing phase it will be called on the audio stream thread. The
/// stream will be stopped immediately.
///
void(CEF_CALLBACK* on_audio_stream_error)(struct _cef_audio_handler_t* self,
struct _cef_browser_t* browser,

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=01a33de48ac9780f78d606d8aee2429ddb0c81a2$
// $hash=b63947918eca8c31790cae16b2e8a0be7e9464dd$
//
#ifndef CEF_INCLUDE_CAPI_CEF_AUTH_CALLBACK_CAPI_H_
@@ -47,24 +47,24 @@ extern "C" {
#endif
///
// Callback structure used for asynchronous continuation of authentication
// requests.
/// Callback structure used for asynchronous continuation of authentication
/// requests.
///
typedef struct _cef_auth_callback_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Continue the authentication request.
/// Continue the authentication request.
///
void(CEF_CALLBACK* cont)(struct _cef_auth_callback_t* self,
const cef_string_t* username,
const cef_string_t* password);
///
// Cancel the authentication request.
/// Cancel the authentication request.
///
void(CEF_CALLBACK* cancel)(struct _cef_auth_callback_t* self);
} cef_auth_callback_t;

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=ad0a78715daff99c1ec987800b7e5d62196e7100$
// $hash=56ad161a75ca5083812e11959053abbcafbb9a5d$
//
#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_PROCESS_HANDLER_CAPI_H_
@@ -43,6 +43,8 @@
#include "include/capi/cef_base_capi.h"
#include "include/capi/cef_client_capi.h"
#include "include/capi/cef_command_line_capi.h"
#include "include/capi/cef_preference_capi.h"
#include "include/capi/cef_request_context_handler_capi.h"
#include "include/capi/cef_values_capi.h"
#ifdef __cplusplus
@@ -50,60 +52,121 @@ extern "C" {
#endif
///
// Structure used to implement browser process callbacks. The functions of this
// structure will be called on the browser process main thread unless otherwise
// indicated.
/// Structure used to implement browser process callbacks. The functions of this
/// structure will be called on the browser process main thread unless otherwise
/// indicated.
///
typedef struct _cef_browser_process_handler_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Called on the browser process UI thread immediately after the CEF context
// has been initialized.
/// Provides an opportunity to register custom preferences prior to global and
/// request context initialization.
///
/// If |type| is CEF_PREFERENCES_TYPE_GLOBAL the registered preferences can be
/// accessed via cef_preference_manager_t::GetGlobalPreferences after
/// OnContextInitialized is called. Global preferences are registered a single
/// time at application startup. See related cef_settings_t.cache_path
/// configuration.
///
/// If |type| is CEF_PREFERENCES_TYPE_REQUEST_CONTEXT the preferences can be
/// accessed via the cef_request_context_t after
/// cef_request_context_handler_t::OnRequestContextInitialized is called.
/// Request context preferences are registered each time a new
/// cef_request_context_t is created. It is intended but not required that all
/// request contexts have the same registered preferences. See related
/// cef_request_context_settings_t.cache_path configuration.
///
/// Do not keep a reference to the |registrar| object. This function is called
/// on the browser process UI thread.
///
void(CEF_CALLBACK* on_register_custom_preferences)(
struct _cef_browser_process_handler_t* self,
cef_preferences_type_t type,
struct _cef_preference_registrar_t* registrar);
///
/// Called on the browser process UI thread immediately after the CEF context
/// has been initialized.
///
void(CEF_CALLBACK* on_context_initialized)(
struct _cef_browser_process_handler_t* self);
///
// Called before a child process is launched. Will be called on the browser
// process UI thread when launching a render process and on the browser
// process IO thread when launching a GPU process. Provides an opportunity to
// modify the child process command line. Do not keep a reference to
// |command_line| outside of this function.
/// Called before a child process is launched. Will be called on the browser
/// process UI thread when launching a render process and on the browser
/// process IO thread when launching a GPU process. Provides an opportunity to
/// modify the child process command line. Do not keep a reference to
/// |command_line| outside of this function.
///
void(CEF_CALLBACK* on_before_child_process_launch)(
struct _cef_browser_process_handler_t* self,
struct _cef_command_line_t* command_line);
///
// Called from any thread when work has been scheduled for the browser process
// main (UI) thread. This callback is used in combination with CefSettings.
// external_message_pump and cef_do_message_loop_work() in cases where the CEF
// message loop must be integrated into an existing application message loop
// (see additional comments and warnings on CefDoMessageLoopWork). This
// callback should schedule a cef_do_message_loop_work() call to happen on the
// main (UI) thread. |delay_ms| is the requested delay in milliseconds. If
// |delay_ms| is <= 0 then the call should happen reasonably soon. If
// |delay_ms| is > 0 then the call should be scheduled to happen after the
// specified delay and any currently pending scheduled call should be
// cancelled.
/// Implement this function to provide app-specific behavior when an already
/// running app is relaunched with the same CefSettings.root_cache_path value.
/// For example, activate an existing app window or create a new app window.
/// |command_line| will be read-only. Do not keep a reference to
/// |command_line| outside of this function. Return true (1) if the relaunch
/// is handled or false (0) for default relaunch behavior. Default behavior
/// will create a new default styled Chrome window.
///
/// To avoid cache corruption only a single app instance is allowed to run for
/// a given CefSettings.root_cache_path value. On relaunch the app checks a
/// process singleton lock and then forwards the new launch arguments to the
/// already running app process before exiting early. Client apps should
/// therefore check the cef_initialize() return value for early exit before
/// proceeding.
///
/// This function will be called on the browser process UI thread.
///
int(CEF_CALLBACK* on_already_running_app_relaunch)(
struct _cef_browser_process_handler_t* self,
struct _cef_command_line_t* command_line,
const cef_string_t* current_directory);
///
/// Called from any thread when work has been scheduled for the browser
/// process main (UI) thread. This callback is used in combination with
/// cef_settings_t.external_message_pump and cef_do_message_loop_work() in
/// cases where the CEF message loop must be integrated into an existing
/// application message loop (see additional comments and warnings on
/// CefDoMessageLoopWork). This callback should schedule a
/// cef_do_message_loop_work() call to happen on the main (UI) thread.
/// |delay_ms| is the requested delay in milliseconds. If |delay_ms| is <= 0
/// then the call should happen reasonably soon. If |delay_ms| is > 0 then the
/// call should be scheduled to happen after the specified delay and any
/// currently pending scheduled call should be cancelled.
///
void(CEF_CALLBACK* on_schedule_message_pump_work)(
struct _cef_browser_process_handler_t* self,
int64 delay_ms);
int64_t delay_ms);
///
// Return the default client for use with a newly created browser window. If
// null is returned the browser will be unmanaged (no callbacks will be
// executed for that browser) and application shutdown will be blocked until
// the browser window is closed manually. This function is currently only used
// with the chrome runtime.
/// Return the default client for use with a newly created browser window
/// (cef_browser_t object). If null is returned the cef_browser_t will be
/// unmanaged (no callbacks will be executed for that cef_browser_t) and
/// application shutdown will be blocked until the browser window is closed
/// manually. This function is currently only used with Chrome style when
/// creating new browser windows via Chrome UI.
///
struct _cef_client_t*(CEF_CALLBACK* get_default_client)(
struct _cef_browser_process_handler_t* self);
///
/// Return the default handler for use with a new user or incognito profile
/// (cef_request_context_t object). If null is returned the
/// cef_request_context_t will be unmanaged (no callbacks will be executed for
/// that cef_request_context_t). This function is currently only used with
/// Chrome style when creating new browser windows via Chrome UI.
///
struct _cef_request_context_handler_t*(
CEF_CALLBACK* get_default_request_context_handler)(
struct _cef_browser_process_handler_t* self);
} cef_browser_process_handler_t;
#ifdef __cplusplus

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=10ef5088ce2a5c6ffb38f8864d3aad6e5ac88b40$
// $hash=46bc048bec64590735298a95633167d66e445844$
//
#ifndef CEF_INCLUDE_CAPI_CEF_CALLBACK_CAPI_H_
@@ -47,36 +47,36 @@ extern "C" {
#endif
///
// Generic callback structure used for asynchronous continuation.
/// Generic callback structure used for asynchronous continuation.
///
typedef struct _cef_callback_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Continue processing.
/// Continue processing.
///
void(CEF_CALLBACK* cont)(struct _cef_callback_t* self);
///
// Cancel processing.
/// Cancel processing.
///
void(CEF_CALLBACK* cancel)(struct _cef_callback_t* self);
} cef_callback_t;
///
// Generic callback structure used for asynchronous completion.
/// Generic callback structure used for asynchronous completion.
///
typedef struct _cef_completion_callback_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Method that will be called once the task is complete.
/// Method that will be called once the task is complete.
///
void(CEF_CALLBACK* on_complete)(struct _cef_completion_callback_t* self);
} cef_completion_callback_t;

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=8b099ca3b9cfbd41840cdf64586a0b884abaffae$
// $hash=09bd4140605645c9dfbd81e7e22d029d0bb50129$
//
#ifndef CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_
@@ -42,6 +42,7 @@
#include "include/capi/cef_audio_handler_capi.h"
#include "include/capi/cef_base_capi.h"
#include "include/capi/cef_command_handler_capi.h"
#include "include/capi/cef_context_menu_handler_capi.h"
#include "include/capi/cef_dialog_handler_capi.h"
#include "include/capi/cef_display_handler_capi.h"
@@ -54,6 +55,7 @@
#include "include/capi/cef_keyboard_handler_capi.h"
#include "include/capi/cef_life_span_handler_capi.h"
#include "include/capi/cef_load_handler_capi.h"
#include "include/capi/cef_permission_handler_capi.h"
#include "include/capi/cef_print_handler_capi.h"
#include "include/capi/cef_process_message_capi.h"
#include "include/capi/cef_render_handler_capi.h"
@@ -64,121 +66,134 @@ extern "C" {
#endif
///
// Implement this structure to provide handler implementations.
/// Implement this structure to provide handler implementations.
///
typedef struct _cef_client_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Return the handler for audio rendering events.
/// Return the handler for audio rendering events.
///
struct _cef_audio_handler_t*(CEF_CALLBACK* get_audio_handler)(
struct _cef_client_t* self);
///
// Return the handler for context menus. If no handler is provided the default
// implementation will be used.
/// Return the handler for commands. If no handler is provided the default
/// implementation will be used.
///
struct _cef_command_handler_t*(CEF_CALLBACK* get_command_handler)(
struct _cef_client_t* self);
///
/// Return the handler for context menus. If no handler is provided the
/// default implementation will be used.
///
struct _cef_context_menu_handler_t*(CEF_CALLBACK* get_context_menu_handler)(
struct _cef_client_t* self);
///
// Return the handler for dialogs. If no handler is provided the default
// implementation will be used.
/// Return the handler for dialogs. If no handler is provided the default
/// implementation will be used.
///
struct _cef_dialog_handler_t*(CEF_CALLBACK* get_dialog_handler)(
struct _cef_client_t* self);
///
// Return the handler for browser display state events.
/// Return the handler for browser display state events.
///
struct _cef_display_handler_t*(CEF_CALLBACK* get_display_handler)(
struct _cef_client_t* self);
///
// Return the handler for download events. If no handler is returned downloads
// will not be allowed.
/// Return the handler for download events. If no handler is returned
/// downloads will not be allowed.
///
struct _cef_download_handler_t*(CEF_CALLBACK* get_download_handler)(
struct _cef_client_t* self);
///
// Return the handler for drag events.
/// Return the handler for drag events.
///
struct _cef_drag_handler_t*(CEF_CALLBACK* get_drag_handler)(
struct _cef_client_t* self);
///
// Return the handler for find result events.
/// Return the handler for find result events.
///
struct _cef_find_handler_t*(CEF_CALLBACK* get_find_handler)(
struct _cef_client_t* self);
///
// Return the handler for focus events.
/// Return the handler for focus events.
///
struct _cef_focus_handler_t*(CEF_CALLBACK* get_focus_handler)(
struct _cef_client_t* self);
///
// Return the handler for events related to cef_frame_t lifespan. This
// function will be called once during cef_browser_t creation and the result
// will be cached for performance reasons.
/// Return the handler for events related to cef_frame_t lifespan. This
/// function will be called once during cef_browser_t creation and the result
/// will be cached for performance reasons.
///
struct _cef_frame_handler_t*(CEF_CALLBACK* get_frame_handler)(
struct _cef_client_t* self);
///
// Return the handler for JavaScript dialogs. If no handler is provided the
// default implementation will be used.
/// Return the handler for permission requests.
///
struct _cef_permission_handler_t*(CEF_CALLBACK* get_permission_handler)(
struct _cef_client_t* self);
///
/// Return the handler for JavaScript dialogs. If no handler is provided the
/// default implementation will be used.
///
struct _cef_jsdialog_handler_t*(CEF_CALLBACK* get_jsdialog_handler)(
struct _cef_client_t* self);
///
// Return the handler for keyboard events.
/// Return the handler for keyboard events.
///
struct _cef_keyboard_handler_t*(CEF_CALLBACK* get_keyboard_handler)(
struct _cef_client_t* self);
///
// Return the handler for browser life span events.
/// Return the handler for browser life span events.
///
struct _cef_life_span_handler_t*(CEF_CALLBACK* get_life_span_handler)(
struct _cef_client_t* self);
///
// Return the handler for browser load status events.
/// Return the handler for browser load status events.
///
struct _cef_load_handler_t*(CEF_CALLBACK* get_load_handler)(
struct _cef_client_t* self);
///
// Return the handler for printing on Linux. If a print handler is not
// provided then printing will not be supported on the Linux platform.
/// Return the handler for printing on Linux. If a print handler is not
/// provided then printing will not be supported on the Linux platform.
///
struct _cef_print_handler_t*(CEF_CALLBACK* get_print_handler)(
struct _cef_client_t* self);
///
// Return the handler for off-screen rendering events.
/// Return the handler for off-screen rendering events.
///
struct _cef_render_handler_t*(CEF_CALLBACK* get_render_handler)(
struct _cef_client_t* self);
///
// Return the handler for browser request events.
/// Return the handler for browser request events.
///
struct _cef_request_handler_t*(CEF_CALLBACK* get_request_handler)(
struct _cef_client_t* self);
///
// Called when a new message is received from a different process. Return true
// (1) if the message was handled or false (0) otherwise. It is safe to keep
// a reference to |message| outside of this callback.
/// Called when a new message is received from a different process. Return
/// true (1) if the message was handled or false (0) otherwise. It is safe to
/// keep a reference to |message| outside of this callback.
///
int(CEF_CALLBACK* on_process_message_received)(
struct _cef_client_t* self,

View File

@@ -0,0 +1,118 @@
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=9c7d613d1256bd6353f5102ece5a04e572f20627$
//
#ifndef CEF_INCLUDE_CAPI_CEF_COMMAND_HANDLER_CAPI_H_
#define CEF_INCLUDE_CAPI_CEF_COMMAND_HANDLER_CAPI_H_
#pragma once
#include "include/capi/cef_base_capi.h"
#include "include/capi/cef_browser_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
///
/// Implement this structure to handle events related to commands. The functions
/// of this structure will be called on the UI thread.
///
typedef struct _cef_command_handler_t {
///
/// Base structure.
///
cef_base_ref_counted_t base;
///
/// Called to execute a Chrome command triggered via menu selection or
/// keyboard shortcut. Values for |command_id| can be found in the
/// cef_command_ids.h file. |disposition| provides information about the
/// intended command target. Return true (1) if the command was handled or
/// false (0) for the default implementation. For context menu commands this
/// will be called after cef_context_menu_handler_t::OnContextMenuCommand.
/// Only used with Chrome style.
///
int(CEF_CALLBACK* on_chrome_command)(
struct _cef_command_handler_t* self,
struct _cef_browser_t* browser,
int command_id,
cef_window_open_disposition_t disposition);
///
/// Called to check if a Chrome app menu item should be visible. Values for
/// |command_id| can be found in the cef_command_ids.h file. Only called for
/// menu items that would be visible by default. Only used with Chrome style.
///
int(CEF_CALLBACK* is_chrome_app_menu_item_visible)(
struct _cef_command_handler_t* self,
struct _cef_browser_t* browser,
int command_id);
///
/// Called to check if a Chrome app menu item should be enabled. Values for
/// |command_id| can be found in the cef_command_ids.h file. Only called for
/// menu items that would be enabled by default. Only used with Chrome style.
///
int(CEF_CALLBACK* is_chrome_app_menu_item_enabled)(
struct _cef_command_handler_t* self,
struct _cef_browser_t* browser,
int command_id);
///
/// Called during browser creation to check if a Chrome page action icon
/// should be visible. Only called for icons that would be visible by default.
/// Only used with Chrome style.
///
int(CEF_CALLBACK* is_chrome_page_action_icon_visible)(
struct _cef_command_handler_t* self,
cef_chrome_page_action_icon_type_t icon_type);
///
/// Called during browser creation to check if a Chrome toolbar button should
/// be visible. Only called for buttons that would be visible by default. Only
/// used with Chrome style.
///
int(CEF_CALLBACK* is_chrome_toolbar_button_visible)(
struct _cef_command_handler_t* self,
cef_chrome_toolbar_button_type_t button_type);
} cef_command_handler_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_CEF_COMMAND_HANDLER_CAPI_H_

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=3049c9960a95d32d61cc57ae998c0eba12820673$
// $hash=fce786b3f054d6581438e2906b77e573c797372a$
//
#ifndef CEF_INCLUDE_CAPI_CEF_COMMAND_LINE_CAPI_H_
@@ -47,104 +47,104 @@ extern "C" {
#endif
///
// Structure used to create and/or parse command line arguments. Arguments with
// '--', '-' and, on Windows, '/' prefixes are considered switches. Switches
// will always precede any arguments without switch prefixes. Switches can
// optionally have a value specified using the '=' delimiter (e.g.
// "-switch=value"). An argument of "--" will terminate switch parsing with all
// subsequent tokens, regardless of prefix, being interpreted as non-switch
// arguments. Switch names should be lowercase ASCII and will be converted to
// such if necessary. Switch values will retain the original case and UTF8
// encoding. This structure can be used before cef_initialize() is called.
/// Structure used to create and/or parse command line arguments. Arguments with
/// "--", "-" and, on Windows, "/" prefixes are considered switches. Switches
/// will always precede any arguments without switch prefixes. Switches can
/// optionally have a value specified using the "=" delimiter (e.g.
/// "-switch=value"). An argument of "--" will terminate switch parsing with all
/// subsequent tokens, regardless of prefix, being interpreted as non-switch
/// arguments. Switch names should be lowercase ASCII and will be converted to
/// such if necessary. Switch values will retain the original case and UTF8
/// encoding. This structure can be used before cef_initialize() is called.
///
typedef struct _cef_command_line_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Returns true (1) if this object is valid. Do not call any other functions
// if this function returns false (0).
/// Returns true (1) if this object is valid. Do not call any other functions
/// if this function returns false (0).
///
int(CEF_CALLBACK* is_valid)(struct _cef_command_line_t* self);
///
// Returns true (1) if the values of this object are read-only. Some APIs may
// expose read-only objects.
/// Returns true (1) if the values of this object are read-only. Some APIs may
/// expose read-only objects.
///
int(CEF_CALLBACK* is_read_only)(struct _cef_command_line_t* self);
///
// Returns a writable copy of this object.
/// Returns a writable copy of this object.
///
struct _cef_command_line_t*(CEF_CALLBACK* copy)(
struct _cef_command_line_t* self);
///
// Initialize the command line with the specified |argc| and |argv| values.
// The first argument must be the name of the program. This function is only
// supported on non-Windows platforms.
/// Initialize the command line with the specified |argc| and |argv| values.
/// The first argument must be the name of the program. This function is only
/// supported on non-Windows platforms.
///
void(CEF_CALLBACK* init_from_argv)(struct _cef_command_line_t* self,
int argc,
const char* const* argv);
///
// Initialize the command line with the string returned by calling
// GetCommandLineW(). This function is only supported on Windows.
/// Initialize the command line with the string returned by calling
/// GetCommandLineW(). This function is only supported on Windows.
///
void(CEF_CALLBACK* init_from_string)(struct _cef_command_line_t* self,
const cef_string_t* command_line);
///
// Reset the command-line switches and arguments but leave the program
// component unchanged.
/// Reset the command-line switches and arguments but leave the program
/// component unchanged.
///
void(CEF_CALLBACK* reset)(struct _cef_command_line_t* self);
///
// Retrieve the original command line string as a vector of strings. The argv
// array: { program, [(--|-|/)switch[=value]]*, [--], [argument]* }
/// Retrieve the original command line string as a vector of strings. The argv
/// array: `{ program, [(--|-|/)switch[=value]]*, [--], [argument]* }`
///
void(CEF_CALLBACK* get_argv)(struct _cef_command_line_t* self,
cef_string_list_t argv);
///
// Constructs and returns the represented command line string. Use this
// function cautiously because quoting behavior is unclear.
/// Constructs and returns the represented command line string. Use this
/// function cautiously because quoting behavior is unclear.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_command_line_string)(
struct _cef_command_line_t* self);
///
// Get the program part of the command line string (the first item).
/// Get the program part of the command line string (the first item).
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_program)(
struct _cef_command_line_t* self);
///
// Set the program part of the command line string (the first item).
/// Set the program part of the command line string (the first item).
///
void(CEF_CALLBACK* set_program)(struct _cef_command_line_t* self,
const cef_string_t* program);
///
// Returns true (1) if the command line has switches.
/// Returns true (1) if the command line has switches.
///
int(CEF_CALLBACK* has_switches)(struct _cef_command_line_t* self);
///
// Returns true (1) if the command line contains the given switch.
/// Returns true (1) if the command line contains the given switch.
///
int(CEF_CALLBACK* has_switch)(struct _cef_command_line_t* self,
const cef_string_t* name);
///
// Returns the value associated with the given switch. If the switch has no
// value or isn't present this function returns the NULL string.
/// Returns the value associated with the given switch. If the switch has no
/// value or isn't present this function returns the NULL string.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_switch_value)(
@@ -152,59 +152,59 @@ typedef struct _cef_command_line_t {
const cef_string_t* name);
///
// Returns the map of switch names and values. If a switch has no value an
// NULL string is returned.
/// Returns the map of switch names and values. If a switch has no value an
/// NULL string is returned.
///
void(CEF_CALLBACK* get_switches)(struct _cef_command_line_t* self,
cef_string_map_t switches);
///
// Add a switch to the end of the command line. If the switch has no value
// pass an NULL value string.
/// Add a switch to the end of the command line.
///
void(CEF_CALLBACK* append_switch)(struct _cef_command_line_t* self,
const cef_string_t* name);
///
// Add a switch with the specified value to the end of the command line.
/// Add a switch with the specified value to the end of the command line. If
/// the switch has no value pass an NULL value string.
///
void(CEF_CALLBACK* append_switch_with_value)(struct _cef_command_line_t* self,
const cef_string_t* name,
const cef_string_t* value);
///
// True if there are remaining command line arguments.
/// True if there are remaining command line arguments.
///
int(CEF_CALLBACK* has_arguments)(struct _cef_command_line_t* self);
///
// Get the remaining command line arguments.
/// Get the remaining command line arguments.
///
void(CEF_CALLBACK* get_arguments)(struct _cef_command_line_t* self,
cef_string_list_t arguments);
///
// Add an argument to the end of the command line.
/// Add an argument to the end of the command line.
///
void(CEF_CALLBACK* append_argument)(struct _cef_command_line_t* self,
const cef_string_t* argument);
///
// Insert a command before the current command. Common for debuggers, like
// "valgrind" or "gdb --args".
/// Insert a command before the current command. Common for debuggers, like
/// "valgrind" or "gdb --args".
///
void(CEF_CALLBACK* prepend_wrapper)(struct _cef_command_line_t* self,
const cef_string_t* wrapper);
} cef_command_line_t;
///
// Create a new cef_command_line_t instance.
/// Create a new cef_command_line_t instance.
///
CEF_EXPORT cef_command_line_t* cef_command_line_create(void);
///
// Returns the singleton global cef_command_line_t object. The returned object
// will be read-only.
/// Returns the singleton global cef_command_line_t object. The returned object
/// will be read-only.
///
CEF_EXPORT cef_command_line_t* cef_command_line_get_global(void);

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=d007b3dc26f3f049bf67623da8fae59dc75a193b$
// $hash=3ae7dbb24ec7a95a2f4d4e390c9b6622221c2f42$
//
#ifndef CEF_INCLUDE_CAPI_CEF_CONTEXT_MENU_HANDLER_CAPI_H_
@@ -52,44 +52,67 @@ extern "C" {
struct _cef_context_menu_params_t;
///
// Callback structure used for continuation of custom context menu display.
/// Callback structure used for continuation of custom context menu display.
///
typedef struct _cef_run_context_menu_callback_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Complete context menu display by selecting the specified |command_id| and
// |event_flags|.
/// Complete context menu display by selecting the specified |command_id| and
/// |event_flags|.
///
void(CEF_CALLBACK* cont)(struct _cef_run_context_menu_callback_t* self,
int command_id,
cef_event_flags_t event_flags);
///
// Cancel context menu display.
/// Cancel context menu display.
///
void(CEF_CALLBACK* cancel)(struct _cef_run_context_menu_callback_t* self);
} cef_run_context_menu_callback_t;
///
// Implement this structure to handle context menu events. The functions of this
// structure will be called on the UI thread.
/// Callback structure used for continuation of custom quick menu display.
///
typedef struct _cef_context_menu_handler_t {
typedef struct _cef_run_quick_menu_callback_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Called before a context menu is displayed. |params| provides information
// about the context menu state. |model| initially contains the default
// context menu. The |model| can be cleared to show no context menu or
// modified to show a custom menu. Do not keep references to |params| or
// |model| outside of this callback.
/// Complete quick menu display by selecting the specified |command_id| and
/// |event_flags|.
///
void(CEF_CALLBACK* cont)(struct _cef_run_quick_menu_callback_t* self,
int command_id,
cef_event_flags_t event_flags);
///
/// Cancel quick menu display.
///
void(CEF_CALLBACK* cancel)(struct _cef_run_quick_menu_callback_t* self);
} cef_run_quick_menu_callback_t;
///
/// Implement this structure to handle context menu events. The functions of
/// this structure will be called on the UI thread.
///
typedef struct _cef_context_menu_handler_t {
///
/// Base structure.
///
cef_base_ref_counted_t base;
///
/// Called before a context menu is displayed. |params| provides information
/// about the context menu state. |model| initially contains the default
/// context menu. The |model| can be cleared to show no context menu or
/// modified to show a custom menu. Do not keep references to |params| or
/// |model| outside of this callback.
///
void(CEF_CALLBACK* on_before_context_menu)(
struct _cef_context_menu_handler_t* self,
@@ -99,12 +122,12 @@ typedef struct _cef_context_menu_handler_t {
struct _cef_menu_model_t* model);
///
// Called to allow custom display of the context menu. |params| provides
// information about the context menu state. |model| contains the context menu
// model resulting from OnBeforeContextMenu. For custom display return true
// (1) and execute |callback| either synchronously or asynchronously with the
// selected command ID. For default display return false (0). Do not keep
// references to |params| or |model| outside of this callback.
/// Called to allow custom display of the context menu. |params| provides
/// information about the context menu state. |model| contains the context
/// menu model resulting from OnBeforeContextMenu. For custom display return
/// true (1) and execute |callback| either synchronously or asynchronously
/// with the selected command ID. For default display return false (0). Do not
/// keep references to |params| or |model| outside of this callback.
///
int(CEF_CALLBACK* run_context_menu)(
struct _cef_context_menu_handler_t* self,
@@ -115,13 +138,13 @@ typedef struct _cef_context_menu_handler_t {
struct _cef_run_context_menu_callback_t* callback);
///
// Called to execute a command selected from the context menu. Return true (1)
// if the command was handled or false (0) for the default implementation. See
// cef_menu_id_t for the command ids that have default implementations. All
// user-defined command ids should be between MENU_ID_USER_FIRST and
// MENU_ID_USER_LAST. |params| will have the same values as what was passed to
// on_before_context_menu(). Do not keep a reference to |params| outside of
// this callback.
/// Called to execute a command selected from the context menu. Return true
/// (1) if the command was handled or false (0) for the default
/// implementation. See cef_menu_id_t for the command ids that have default
/// implementations. All user-defined command ids should be between
/// MENU_ID_USER_FIRST and MENU_ID_USER_LAST. |params| will have the same
/// values as what was passed to on_before_context_menu(). Do not keep a
/// reference to |params| outside of this callback.
///
int(CEF_CALLBACK* on_context_menu_command)(
struct _cef_context_menu_handler_t* self,
@@ -132,165 +155,207 @@ typedef struct _cef_context_menu_handler_t {
cef_event_flags_t event_flags);
///
// Called when the context menu is dismissed irregardless of whether the menu
// was NULL or a command was selected.
/// Called when the context menu is dismissed irregardless of whether the menu
/// was canceled or a command was selected.
///
void(CEF_CALLBACK* on_context_menu_dismissed)(
struct _cef_context_menu_handler_t* self,
struct _cef_browser_t* browser,
struct _cef_frame_t* frame);
///
/// Called to allow custom display of the quick menu for a windowless browser.
/// |location| is the top left corner of the selected region. |size| is the
/// size of the selected region. |edit_state_flags| is a combination of flags
/// that represent the state of the quick menu. Return true (1) if the menu
/// will be handled and execute |callback| either synchronously or
/// asynchronously with the selected command ID. Return false (0) to cancel
/// the menu.
///
int(CEF_CALLBACK* run_quick_menu)(
struct _cef_context_menu_handler_t* self,
struct _cef_browser_t* browser,
struct _cef_frame_t* frame,
const cef_point_t* location,
const cef_size_t* size,
cef_quick_menu_edit_state_flags_t edit_state_flags,
struct _cef_run_quick_menu_callback_t* callback);
///
/// Called to execute a command selected from the quick menu for a windowless
/// browser. Return true (1) if the command was handled or false (0) for the
/// default implementation. See cef_menu_id_t for command IDs that have
/// default implementations.
///
int(CEF_CALLBACK* on_quick_menu_command)(
struct _cef_context_menu_handler_t* self,
struct _cef_browser_t* browser,
struct _cef_frame_t* frame,
int command_id,
cef_event_flags_t event_flags);
///
/// Called when the quick menu for a windowless browser is dismissed
/// irregardless of whether the menu was canceled or a command was selected.
///
void(CEF_CALLBACK* on_quick_menu_dismissed)(
struct _cef_context_menu_handler_t* self,
struct _cef_browser_t* browser,
struct _cef_frame_t* frame);
} cef_context_menu_handler_t;
///
// Provides information about the context menu state. The ethods of this
// structure can only be accessed on browser process the UI thread.
/// Provides information about the context menu state. The functions of this
/// structure can only be accessed on browser process the UI thread.
///
typedef struct _cef_context_menu_params_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Returns the X coordinate of the mouse where the context menu was invoked.
// Coords are relative to the associated RenderView's origin.
/// Returns the X coordinate of the mouse where the context menu was invoked.
/// Coords are relative to the associated RenderView's origin.
///
int(CEF_CALLBACK* get_xcoord)(struct _cef_context_menu_params_t* self);
///
// Returns the Y coordinate of the mouse where the context menu was invoked.
// Coords are relative to the associated RenderView's origin.
/// Returns the Y coordinate of the mouse where the context menu was invoked.
/// Coords are relative to the associated RenderView's origin.
///
int(CEF_CALLBACK* get_ycoord)(struct _cef_context_menu_params_t* self);
///
// Returns flags representing the type of node that the context menu was
// invoked on.
/// Returns flags representing the type of node that the context menu was
/// invoked on.
///
cef_context_menu_type_flags_t(CEF_CALLBACK* get_type_flags)(
struct _cef_context_menu_params_t* self);
///
// Returns the URL of the link, if any, that encloses the node that the
// context menu was invoked on.
/// Returns the URL of the link, if any, that encloses the node that the
/// context menu was invoked on.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_link_url)(
struct _cef_context_menu_params_t* self);
///
// Returns the link URL, if any, to be used ONLY for "copy link address". We
// don't validate this field in the frontend process.
/// Returns the link URL, if any, to be used ONLY for "copy link address". We
/// don't validate this field in the frontend process.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_unfiltered_link_url)(
struct _cef_context_menu_params_t* self);
///
// Returns the source URL, if any, for the element that the context menu was
// invoked on. Example of elements with source URLs are img, audio, and video.
/// Returns the source URL, if any, for the element that the context menu was
/// invoked on. Example of elements with source URLs are img, audio, and
/// video.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_source_url)(
struct _cef_context_menu_params_t* self);
///
// Returns true (1) if the context menu was invoked on an image which has non-
// NULL contents.
/// Returns true (1) if the context menu was invoked on an image which has
/// non-NULL contents.
///
int(CEF_CALLBACK* has_image_contents)(
struct _cef_context_menu_params_t* self);
///
// Returns the title text or the alt text if the context menu was invoked on
// an image.
/// Returns the title text or the alt text if the context menu was invoked on
/// an image.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_title_text)(
struct _cef_context_menu_params_t* self);
///
// Returns the URL of the top level page that the context menu was invoked on.
/// Returns the URL of the top level page that the context menu was invoked
/// on.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_page_url)(
struct _cef_context_menu_params_t* self);
///
// Returns the URL of the subframe that the context menu was invoked on.
/// Returns the URL of the subframe that the context menu was invoked on.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_frame_url)(
struct _cef_context_menu_params_t* self);
///
// Returns the character encoding of the subframe that the context menu was
// invoked on.
/// Returns the character encoding of the subframe that the context menu was
/// invoked on.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_frame_charset)(
struct _cef_context_menu_params_t* self);
///
// Returns the type of context node that the context menu was invoked on.
/// Returns the type of context node that the context menu was invoked on.
///
cef_context_menu_media_type_t(CEF_CALLBACK* get_media_type)(
struct _cef_context_menu_params_t* self);
///
// Returns flags representing the actions supported by the media element, if
// any, that the context menu was invoked on.
/// Returns flags representing the actions supported by the media element, if
/// any, that the context menu was invoked on.
///
cef_context_menu_media_state_flags_t(CEF_CALLBACK* get_media_state_flags)(
struct _cef_context_menu_params_t* self);
///
// Returns the text of the selection, if any, that the context menu was
// invoked on.
/// Returns the text of the selection, if any, that the context menu was
/// invoked on.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_selection_text)(
struct _cef_context_menu_params_t* self);
///
// Returns the text of the misspelled word, if any, that the context menu was
// invoked on.
/// Returns the text of the misspelled word, if any, that the context menu was
/// invoked on.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_misspelled_word)(
struct _cef_context_menu_params_t* self);
///
// Returns true (1) if suggestions exist, false (0) otherwise. Fills in
// |suggestions| from the spell check service for the misspelled word if there
// is one.
/// Returns true (1) if suggestions exist, false (0) otherwise. Fills in
/// |suggestions| from the spell check service for the misspelled word if
/// there is one.
///
int(CEF_CALLBACK* get_dictionary_suggestions)(
struct _cef_context_menu_params_t* self,
cef_string_list_t suggestions);
///
// Returns true (1) if the context menu was invoked on an editable node.
/// Returns true (1) if the context menu was invoked on an editable node.
///
int(CEF_CALLBACK* is_editable)(struct _cef_context_menu_params_t* self);
///
// Returns true (1) if the context menu was invoked on an editable node where
// spell-check is enabled.
/// Returns true (1) if the context menu was invoked on an editable node where
/// spell-check is enabled.
///
int(CEF_CALLBACK* is_spell_check_enabled)(
struct _cef_context_menu_params_t* self);
///
// Returns flags representing the actions supported by the editable node, if
// any, that the context menu was invoked on.
/// Returns flags representing the actions supported by the editable node, if
/// any, that the context menu was invoked on.
///
cef_context_menu_edit_state_flags_t(CEF_CALLBACK* get_edit_state_flags)(
struct _cef_context_menu_params_t* self);
///
// Returns true (1) if the context menu contains items specified by the
// renderer process.
/// Returns true (1) if the context menu contains items specified by the
/// renderer process.
///
int(CEF_CALLBACK* is_custom_menu)(struct _cef_context_menu_params_t* self);
} cef_context_menu_params_t;

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=d9790a35d74621e985b917935a4fca74ba7db1e0$
// $hash=76ba2e59636aa71c8c6286093198a1e64d012c62$
//
#ifndef CEF_INCLUDE_CAPI_CEF_COOKIE_CAPI_H_
@@ -52,29 +52,29 @@ struct _cef_delete_cookies_callback_t;
struct _cef_set_cookie_callback_t;
///
// Structure used for managing cookies. The functions of this structure may be
// called on any thread unless otherwise indicated.
/// Structure used for managing cookies. The functions of this structure may be
/// called on any thread unless otherwise indicated.
///
typedef struct _cef_cookie_manager_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Visit all cookies on the UI thread. The returned cookies are ordered by
// longest path, then by earliest creation date. Returns false (0) if cookies
// cannot be accessed.
/// Visit all cookies on the UI thread. The returned cookies are ordered by
/// longest path, then by earliest creation date. Returns false (0) if cookies
/// cannot be accessed.
///
int(CEF_CALLBACK* visit_all_cookies)(struct _cef_cookie_manager_t* self,
struct _cef_cookie_visitor_t* visitor);
///
// Visit a subset of cookies on the UI thread. The results are filtered by the
// given url scheme, host, domain and path. If |includeHttpOnly| is true (1)
// HTTP-only cookies will also be included in the results. The returned
// cookies are ordered by longest path, then by earliest creation date.
// Returns false (0) if cookies cannot be accessed.
/// Visit a subset of cookies on the UI thread. The results are filtered by
/// the given url scheme, host, domain and path. If |includeHttpOnly| is true
/// (1) HTTP-only cookies will also be included in the results. The returned
/// cookies are ordered by longest path, then by earliest creation date.
/// Returns false (0) if cookies cannot be accessed.
///
int(CEF_CALLBACK* visit_url_cookies)(struct _cef_cookie_manager_t* self,
const cef_string_t* url,
@@ -82,13 +82,13 @@ typedef struct _cef_cookie_manager_t {
struct _cef_cookie_visitor_t* visitor);
///
// Sets a cookie given a valid URL and explicit user-provided cookie
// attributes. This function expects each attribute to be well-formed. It will
// check for disallowed characters (e.g. the ';' character is disallowed
// within the cookie value attribute) and fail without setting the cookie if
// such characters are found. If |callback| is non-NULL it will be executed
// asnychronously on the UI thread after the cookie has been set. Returns
// false (0) if an invalid URL is specified or if cookies cannot be accessed.
/// Sets a cookie given a valid URL and explicit user-provided cookie
/// attributes. This function expects each attribute to be well-formed. It
/// will check for disallowed characters (e.g. the ';' character is disallowed
/// within the cookie value attribute) and fail without setting the cookie if
/// such characters are found. If |callback| is non-NULL it will be executed
/// asnychronously on the UI thread after the cookie has been set. Returns
/// false (0) if an invalid URL is specified or if cookies cannot be accessed.
///
int(CEF_CALLBACK* set_cookie)(struct _cef_cookie_manager_t* self,
const cef_string_t* url,
@@ -96,15 +96,15 @@ typedef struct _cef_cookie_manager_t {
struct _cef_set_cookie_callback_t* callback);
///
// Delete all cookies that match the specified parameters. If both |url| and
// |cookie_name| values are specified all host and domain cookies matching
// both will be deleted. If only |url| is specified all host cookies (but not
// domain cookies) irrespective of path will be deleted. If |url| is NULL all
// cookies for all hosts and domains will be deleted. If |callback| is non-
// NULL it will be executed asnychronously on the UI thread after the cookies
// have been deleted. Returns false (0) if a non-NULL invalid URL is specified
// or if cookies cannot be accessed. Cookies can alternately be deleted using
// the Visit*Cookies() functions.
/// Delete all cookies that match the specified parameters. If both |url| and
/// |cookie_name| values are specified all host and domain cookies matching
/// both will be deleted. If only |url| is specified all host cookies (but not
/// domain cookies) irrespective of path will be deleted. If |url| is NULL all
/// cookies for all hosts and domains will be deleted. If |callback| is non-
/// NULL it will be executed asnychronously on the UI thread after the cookies
/// have been deleted. Returns false (0) if a non-NULL invalid URL is
/// specified or if cookies cannot be accessed. Cookies can alternately be
/// deleted using the Visit*Cookies() functions.
///
int(CEF_CALLBACK* delete_cookies)(
struct _cef_cookie_manager_t* self,
@@ -113,41 +113,41 @@ typedef struct _cef_cookie_manager_t {
struct _cef_delete_cookies_callback_t* callback);
///
// Flush the backing store (if any) to disk. If |callback| is non-NULL it will
// be executed asnychronously on the UI thread after the flush is complete.
// Returns false (0) if cookies cannot be accessed.
/// Flush the backing store (if any) to disk. If |callback| is non-NULL it
/// will be executed asnychronously on the UI thread after the flush is
/// complete. Returns false (0) if cookies cannot be accessed.
///
int(CEF_CALLBACK* flush_store)(struct _cef_cookie_manager_t* self,
struct _cef_completion_callback_t* callback);
} cef_cookie_manager_t;
///
// Returns the global cookie manager. By default data will be stored at
// CefSettings.cache_path if specified or in memory otherwise. If |callback| is
// non-NULL it will be executed asnychronously on the UI thread after the
// manager's storage has been initialized. Using this function is equivalent to
// calling cef_request_context_t::cef_request_context_get_global_context()->GetD
// efaultCookieManager().
/// Returns the global cookie manager. By default data will be stored at
/// cef_settings_t.cache_path if specified or in memory otherwise. If |callback|
/// is non-NULL it will be executed asnychronously on the UI thread after the
/// manager's storage has been initialized. Using this function is equivalent to
/// calling cef_request_context_t::cef_request_context_get_global_context()-
/// >GetDefaultCookieManager().
///
CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_get_global_manager(
struct _cef_completion_callback_t* callback);
///
// Structure to implement for visiting cookie values. The functions of this
// structure will always be called on the UI thread.
/// Structure to implement for visiting cookie values. The functions of this
/// structure will always be called on the UI thread.
///
typedef struct _cef_cookie_visitor_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Method that will be called once for each cookie. |count| is the 0-based
// index for the current cookie. |total| is the total number of cookies. Set
// |deleteCookie| to true (1) to delete the cookie currently being visited.
// Return false (0) to stop visiting cookies. This function may never be
// called if no cookies are found.
/// Method that will be called once for each cookie. |count| is the 0-based
/// index for the current cookie. |total| is the total number of cookies. Set
/// |deleteCookie| to true (1) to delete the cookie currently being visited.
/// Return false (0) to stop visiting cookies. This function may never be
/// called if no cookies are found.
///
int(CEF_CALLBACK* visit)(struct _cef_cookie_visitor_t* self,
const struct _cef_cookie_t* cookie,
@@ -157,36 +157,36 @@ typedef struct _cef_cookie_visitor_t {
} cef_cookie_visitor_t;
///
// Structure to implement to be notified of asynchronous completion via
// cef_cookie_manager_t::set_cookie().
/// Structure to implement to be notified of asynchronous completion via
/// cef_cookie_manager_t::set_cookie().
///
typedef struct _cef_set_cookie_callback_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Method that will be called upon completion. |success| will be true (1) if
// the cookie was set successfully.
/// Method that will be called upon completion. |success| will be true (1) if
/// the cookie was set successfully.
///
void(CEF_CALLBACK* on_complete)(struct _cef_set_cookie_callback_t* self,
int success);
} cef_set_cookie_callback_t;
///
// Structure to implement to be notified of asynchronous completion via
// cef_cookie_manager_t::delete_cookies().
/// Structure to implement to be notified of asynchronous completion via
/// cef_cookie_manager_t::delete_cookies().
///
typedef struct _cef_delete_cookies_callback_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Method that will be called upon completion. |num_deleted| will be the
// number of cookies that were deleted.
/// Method that will be called upon completion. |num_deleted| will be the
/// number of cookies that were deleted.
///
void(CEF_CALLBACK* on_complete)(struct _cef_delete_cookies_callback_t* self,
int num_deleted);

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=5d111a67218403f78737f2c4dc92d2fd96dc125d$
// $hash=46a6432f66cce88d8597c3d070681b09a712dc54$
//
#ifndef CEF_INCLUDE_CAPI_CEF_CRASH_UTIL_CAPI_H_
@@ -47,99 +47,102 @@ extern "C" {
#endif
///
// Crash reporting is configured using an INI-style config file named
// "crash_reporter.cfg". On Windows and Linux this file must be placed next to
// the main application executable. On macOS this file must be placed in the
// top-level app bundle Resources directory (e.g.
// "<appname>.app/Contents/Resources"). File contents are as follows:
//
// # Comments start with a hash character and must be on their own line.
//
// [Config]
// ProductName=<Value of the "prod" crash key; defaults to "cef">
// ProductVersion=<Value of the "ver" crash key; defaults to the CEF version>
// AppName=<Windows only; App-specific folder name component for storing crash
// information; default to "CEF">
// ExternalHandler=<Windows only; Name of the external handler exe to use
// instead of re-launching the main exe; default to empty>
// BrowserCrashForwardingEnabled=<macOS only; True if browser process crashes
// should be forwarded to the system crash
// reporter; default to false>
// ServerURL=<crash server URL; default to empty>
// RateLimitEnabled=<True if uploads should be rate limited; default to true>
// MaxUploadsPerDay=<Max uploads per 24 hours, used if rate limit is enabled;
// default to 5>
// MaxDatabaseSizeInMb=<Total crash report disk usage greater than this value
// will cause older reports to be deleted; default to 20>
// MaxDatabaseAgeInDays=<Crash reports older than this value will be deleted;
// default to 5>
//
// [CrashKeys]
// my_key1=<small|medium|large>
// my_key2=<small|medium|large>
//
// Config section:
//
// If "ProductName" and/or "ProductVersion" are set then the specified values
// will be included in the crash dump metadata. On macOS if these values are set
// to NULL then they will be retrieved from the Info.plist file using the
// "CFBundleName" and "CFBundleShortVersionString" keys respectively.
//
// If "AppName" is set on Windows then crash report information (metrics,
// database and dumps) will be stored locally on disk under the
// "C:\Users\[CurrentUser]\AppData\Local\[AppName]\User Data" folder. On other
// platforms the CefSettings.user_data_path value will be used.
//
// If "ExternalHandler" is set on Windows then the specified exe will be
// launched as the crashpad-handler instead of re-launching the main process
// exe. The value can be an absolute path or a path relative to the main exe
// directory. On Linux the CefSettings.browser_subprocess_path value will be
// used. On macOS the existing subprocess app bundle will be used.
//
// If "BrowserCrashForwardingEnabled" is set to true (1) on macOS then browser
// process crashes will be forwarded to the system crash reporter. This results
// in the crash UI dialog being displayed to the user and crash reports being
// logged under "~/Library/Logs/DiagnosticReports". Forwarding of crash reports
// from non-browser processes and Debug builds is always disabled.
//
// If "ServerURL" is set then crashes will be uploaded as a multi-part POST
// request to the specified URL. Otherwise, reports will only be stored locally
// on disk.
//
// If "RateLimitEnabled" is set to true (1) then crash report uploads will be
// rate limited as follows:
// 1. If "MaxUploadsPerDay" is set to a positive value then at most the
// specified number of crashes will be uploaded in each 24 hour period.
// 2. If crash upload fails due to a network or server error then an
// incremental backoff delay up to a maximum of 24 hours will be applied for
// retries.
// 3. If a backoff delay is applied and "MaxUploadsPerDay" is > 1 then the
// "MaxUploadsPerDay" value will be reduced to 1 until the client is
// restarted. This helps to avoid an upload flood when the network or
// server error is resolved.
// Rate limiting is not supported on Linux.
//
// If "MaxDatabaseSizeInMb" is set to a positive value then crash report storage
// on disk will be limited to that size in megabytes. For example, on Windows
// each dump is about 600KB so a "MaxDatabaseSizeInMb" value of 20 equates to
// about 34 crash reports stored on disk. Not supported on Linux.
//
// If "MaxDatabaseAgeInDays" is set to a positive value then crash reports older
// than the specified age in days will be deleted. Not supported on Linux.
//
// CrashKeys section:
//
// A maximum of 26 crash keys of each size can be specified for use by the
// application. Crash key values will be truncated based on the specified size
// (small = 64 bytes, medium = 256 bytes, large = 1024 bytes). The value of
// crash keys can be set from any thread or process using the
// CefSetCrashKeyValue function. These key/value pairs will be sent to the crash
// server along with the crash dump file.
/// Crash reporting is configured using an INI-style config file named
/// "crash_reporter.cfg". On Windows and Linux this file must be placed next to
/// the main application executable. On macOS this file must be placed in the
/// top-level app bundle Resources directory (e.g.
/// "<appname>.app/Contents/Resources"). File contents are as follows:
///
/// <pre>
/// # Comments start with a hash character and must be on their own line.
///
/// [Config]
/// ProductName=<Value of the "prod" crash key; defaults to "cef">
/// ProductVersion=<Value of the "ver" crash key; defaults to the CEF version>
/// AppName=<Windows only; App-specific folder name component for storing crash
/// information; default to "CEF">
/// ExternalHandler=<Windows only; Name of the external handler exe to use
/// instead of re-launching the main exe; default to empty>
/// BrowserCrashForwardingEnabled=<macOS only; True if browser process crashes
/// should be forwarded to the system crash
/// reporter; default to false>
/// ServerURL=<crash server URL; default to empty>
/// RateLimitEnabled=<True if uploads should be rate limited; default to true>
/// MaxUploadsPerDay=<Max uploads per 24 hours, used if rate limit is enabled;
/// default to 5>
/// MaxDatabaseSizeInMb=<Total crash report disk usage greater than this value
/// will cause older reports to be deleted; default to 20>
/// MaxDatabaseAgeInDays=<Crash reports older than this value will be deleted;
/// default to 5>
///
/// [CrashKeys]
/// my_key1=<small|medium|large>
/// my_key2=<small|medium|large>
/// </pre>
///
/// <b>Config section:</b>
///
/// If "ProductName" and/or "ProductVersion" are set then the specified values
/// will be included in the crash dump metadata. On macOS if these values are
/// set to NULL then they will be retrieved from the Info.plist file using the
/// "CFBundleName" and "CFBundleShortVersionString" keys respectively.
///
/// If "AppName" is set on Windows then crash report information (metrics,
/// database and dumps) will be stored locally on disk under the
/// "C:\Users\[CurrentUser]\AppData\Local\[AppName]\User Data" folder. On other
/// platforms the cef_settings_t.root_cache_path value will be used.
///
/// If "ExternalHandler" is set on Windows then the specified exe will be
/// launched as the crashpad-handler instead of re-launching the main process
/// exe. The value can be an absolute path or a path relative to the main exe
/// directory. On Linux the cef_settings_t.browser_subprocess_path value will be
/// used. On macOS the existing subprocess app bundle will be used.
///
/// If "BrowserCrashForwardingEnabled" is set to true (1) on macOS then browser
/// process crashes will be forwarded to the system crash reporter. This results
/// in the crash UI dialog being displayed to the user and crash reports being
/// logged under "~/Library/Logs/DiagnosticReports". Forwarding of crash reports
/// from non-browser processes and Debug builds is always disabled.
///
/// If "ServerURL" is set then crashes will be uploaded as a multi-part POST
/// request to the specified URL. Otherwise, reports will only be stored locally
/// on disk.
///
/// If "RateLimitEnabled" is set to true (1) then crash report uploads will be
/// rate limited as follows:
/// 1. If "MaxUploadsPerDay" is set to a positive value then at most the
/// specified number of crashes will be uploaded in each 24 hour period.
/// 2. If crash upload fails due to a network or server error then an
/// incremental backoff delay up to a maximum of 24 hours will be applied
/// for retries.
/// 3. If a backoff delay is applied and "MaxUploadsPerDay" is > 1 then the
/// "MaxUploadsPerDay" value will be reduced to 1 until the client is
/// restarted. This helps to avoid an upload flood when the network or
/// server error is resolved.
/// Rate limiting is not supported on Linux.
///
/// If "MaxDatabaseSizeInMb" is set to a positive value then crash report
/// storage on disk will be limited to that size in megabytes. For example, on
/// Windows each dump is about 600KB so a "MaxDatabaseSizeInMb" value of 20
/// equates to about 34 crash reports stored on disk. Not supported on Linux.
///
/// If "MaxDatabaseAgeInDays" is set to a positive value then crash reports
/// older than the specified age in days will be deleted. Not supported on
/// Linux.
///
/// <b>CrashKeys section:</b>
///
/// A maximum of 26 crash keys of each size can be specified for use by the
/// application. Crash key values will be truncated based on the specified size
/// (small = 64 bytes, medium = 256 bytes, large = 1024 bytes). The value of
/// crash keys can be set from any thread or process using the
/// CefSetCrashKeyValue function. These key/value pairs will be sent to the
/// crash server along with the crash dump file.
///
CEF_EXPORT int cef_crash_reporting_enabled(void);
///
// Sets or clears a specific key-value pair from the crash metadata.
/// Sets or clears a specific key-value pair from the crash metadata.
///
CEF_EXPORT void cef_set_crash_key_value(const cef_string_t* key,
const cef_string_t* value);

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=ec62239c2b24ff512b64ca758be825ff57fb3b6b$
// $hash=dd94c50619e92bf5bed4fe61479813ee559f779d$
//
#ifndef CEF_INCLUDE_CAPI_CEF_DEVTOOLS_MESSAGE_OBSERVER_CAPI_H_
@@ -49,35 +49,36 @@ extern "C" {
struct _cef_browser_t;
///
// Callback structure for cef_browser_host_t::AddDevToolsMessageObserver. The
// functions of this structure will be called on the browser process UI thread.
/// Callback structure for cef_browser_host_t::AddDevToolsMessageObserver. The
/// functions of this structure will be called on the browser process UI thread.
///
typedef struct _cef_dev_tools_message_observer_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Method that will be called on receipt of a DevTools protocol message.
// |browser| is the originating browser instance. |message| is a UTF8-encoded
// JSON dictionary representing either a function result or an event.
// |message| is only valid for the scope of this callback and should be copied
// if necessary. Return true (1) if the message was handled or false (0) if
// the message should be further processed and passed to the
// OnDevToolsMethodResult or OnDevToolsEvent functions as appropriate.
//
// Method result dictionaries include an "id" (int) value that identifies the
// orginating function call sent from cef_browser_host_t::SendDevToolsMessage,
// and optionally either a "result" (dictionary) or "error" (dictionary)
// value. The "error" dictionary will contain "code" (int) and "message"
// (string) values. Event dictionaries include a "function" (string) value and
// optionally a "params" (dictionary) value. See the DevTools protocol
// documentation at https://chromedevtools.github.io/devtools-protocol/ for
// details of supported function calls and the expected "result" or "params"
// dictionary contents. JSON dictionaries can be parsed using the CefParseJSON
// function if desired, however be aware of performance considerations when
// parsing large messages (some of which may exceed 1MB in size).
/// Method that will be called on receipt of a DevTools protocol message.
/// |browser| is the originating browser instance. |message| is a UTF8-encoded
/// JSON dictionary representing either a function result or an event.
/// |message| is only valid for the scope of this callback and should be
/// copied if necessary. Return true (1) if the message was handled or false
/// (0) if the message should be further processed and passed to the
/// OnDevToolsMethodResult or OnDevToolsEvent functions as appropriate.
///
/// Method result dictionaries include an "id" (int) value that identifies the
/// orginating function call sent from
/// cef_browser_host_t::SendDevToolsMessage, and optionally either a "result"
/// (dictionary) or "error" (dictionary) value. The "error" dictionary will
/// contain "code" (int) and "message" (string) values. Event dictionaries
/// include a "function" (string) value and optionally a "params" (dictionary)
/// value. See the DevTools protocol documentation at
/// https://chromedevtools.github.io/devtools-protocol/ for details of
/// supported function calls and the expected "result" or "params" dictionary
/// contents. JSON dictionaries can be parsed using the CefParseJSON function
/// if desired, however be aware of performance considerations when parsing
/// large messages (some of which may exceed 1MB in size).
///
int(CEF_CALLBACK* on_dev_tools_message)(
struct _cef_dev_tools_message_observer_t* self,
@@ -86,16 +87,16 @@ typedef struct _cef_dev_tools_message_observer_t {
size_t message_size);
///
// Method that will be called after attempted execution of a DevTools protocol
// function. |browser| is the originating browser instance. |message_id| is
// the "id" value that identifies the originating function call message. If
// the function succeeded |success| will be true (1) and |result| will be the
// UTF8-encoded JSON "result" dictionary value (which may be NULL). If the
// function failed |success| will be false (0) and |result| will be the
// UTF8-encoded JSON "error" dictionary value. |result| is only valid for the
// scope of this callback and should be copied if necessary. See the
// OnDevToolsMessage documentation for additional details on |result|
// contents.
/// Method that will be called after attempted execution of a DevTools
/// protocol function. |browser| is the originating browser instance.
/// |message_id| is the "id" value that identifies the originating function
/// call message. If the function succeeded |success| will be true (1) and
/// |result| will be the UTF8-encoded JSON "result" dictionary value (which
/// may be NULL). If the function failed |success| will be false (0) and
/// |result| will be the UTF8-encoded JSON "error" dictionary value. |result|
/// is only valid for the scope of this callback and should be copied if
/// necessary. See the OnDevToolsMessage documentation for additional details
/// on |result| contents.
///
void(CEF_CALLBACK* on_dev_tools_method_result)(
struct _cef_dev_tools_message_observer_t* self,
@@ -106,12 +107,12 @@ typedef struct _cef_dev_tools_message_observer_t {
size_t result_size);
///
// Method that will be called on receipt of a DevTools protocol event.
// |browser| is the originating browser instance. |function| is the "function"
// value. |params| is the UTF8-encoded JSON "params" dictionary value (which
// may be NULL). |params| is only valid for the scope of this callback and
// should be copied if necessary. See the OnDevToolsMessage documentation for
// additional details on |params| contents.
/// Method that will be called on receipt of a DevTools protocol event.
/// |browser| is the originating browser instance. |function| is the
/// "function" value. |params| is the UTF8-encoded JSON "params" dictionary
/// value (which may be NULL). |params| is only valid for the scope of this
/// callback and should be copied if necessary. See the OnDevToolsMessage
/// documentation for additional details on |params| contents.
///
void(CEF_CALLBACK* on_dev_tools_event)(
struct _cef_dev_tools_message_observer_t* self,
@@ -121,19 +122,19 @@ typedef struct _cef_dev_tools_message_observer_t {
size_t params_size);
///
// Method that will be called when the DevTools agent has attached. |browser|
// is the originating browser instance. This will generally occur in response
// to the first message sent while the agent is detached.
/// Method that will be called when the DevTools agent has attached. |browser|
/// is the originating browser instance. This will generally occur in response
/// to the first message sent while the agent is detached.
///
void(CEF_CALLBACK* on_dev_tools_agent_attached)(
struct _cef_dev_tools_message_observer_t* self,
struct _cef_browser_t* browser);
///
// Method that will be called when the DevTools agent has detached. |browser|
// is the originating browser instance. Any function results that were pending
// before the agent became detached will not be delivered, and any active
// event subscriptions will be canceled.
/// Method that will be called when the DevTools agent has detached. |browser|
/// is the originating browser instance. Any function results that were
/// pending before the agent became detached will not be delivered, and any
/// active event subscriptions will be canceled.
///
void(CEF_CALLBACK* on_dev_tools_agent_detached)(
struct _cef_dev_tools_message_observer_t* self,

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=0f56154217707d141912dc8a298279df8df04311$
// $hash=bf7208a86ee17f63fd7163cef8c3a13373a1f1c8$
//
#ifndef CEF_INCLUDE_CAPI_CEF_DIALOG_HANDLER_CAPI_H_
@@ -48,55 +48,58 @@ extern "C" {
#endif
///
// Callback structure for asynchronous continuation of file dialog requests.
/// Callback structure for asynchronous continuation of file dialog requests.
///
typedef struct _cef_file_dialog_callback_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Continue the file selection. |selected_accept_filter| should be the 0-based
// index of the value selected from the accept filters array passed to
// cef_dialog_handler_t::OnFileDialog. |file_paths| should be a single value
// or a list of values depending on the dialog mode. An NULL |file_paths|
// value is treated the same as calling cancel().
/// Continue the file selection. |file_paths| should be a single value or a
/// list of values depending on the dialog mode. An NULL |file_paths| value is
/// treated the same as calling cancel().
///
void(CEF_CALLBACK* cont)(struct _cef_file_dialog_callback_t* self,
int selected_accept_filter,
cef_string_list_t file_paths);
///
// Cancel the file selection.
/// Cancel the file selection.
///
void(CEF_CALLBACK* cancel)(struct _cef_file_dialog_callback_t* self);
} cef_file_dialog_callback_t;
///
// Implement this structure to handle dialog events. The functions of this
// structure will be called on the browser process UI thread.
/// Implement this structure to handle dialog events. The functions of this
/// structure will be called on the browser process UI thread.
///
typedef struct _cef_dialog_handler_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Called to run a file chooser dialog. |mode| represents the type of dialog
// to display. |title| to the title to be used for the dialog and may be NULL
// to show the default title ("Open" or "Save" depending on the mode).
// |default_file_path| is the path with optional directory and/or file name
// component that should be initially selected in the dialog. |accept_filters|
// are used to restrict the selectable file types and may any combination of
// (a) valid lower-cased MIME types (e.g. "text/*" or "image/*"), (b)
// individual file extensions (e.g. ".txt" or ".png"), or (c) combined
// description and file extension delimited using "|" and ";" (e.g. "Image
// Types|.png;.gif;.jpg"). |selected_accept_filter| is the 0-based index of
// the filter that should be selected by default. To display a custom dialog
// return true (1) and execute |callback| either inline or at a later time. To
// display the default dialog return false (0).
/// Called to run a file chooser dialog. |mode| represents the type of dialog
/// to display. |title| to the title to be used for the dialog and may be NULL
/// to show the default title ("Open" or "Save" depending on the mode).
/// |default_file_path| is the path with optional directory and/or file name
/// component that should be initially selected in the dialog.
/// |accept_filters| are used to restrict the selectable file types and may be
/// any combination of valid lower-cased MIME types (e.g. "text/*" or
/// "image/*") and individual file extensions (e.g. ".txt" or ".png").
/// |accept_extensions| provides the semicolon-delimited expansion of MIME
/// types to file extensions (if known, or NULL string otherwise).
/// |accept_descriptions| provides the descriptions for MIME types (if known,
/// or NULL string otherwise). For example, the "image/*" mime type might have
/// extensions ".png;.jpg;.bmp;..." and description "Image Files".
/// |accept_filters|, |accept_extensions| and |accept_descriptions| will all
/// be the same size. To display a custom dialog return true (1) and execute
/// |callback| either inline or at a later time. To display the default dialog
/// return false (0). If this function returns false (0) it may be called an
/// additional time for the same dialog (both before and after MIME type
/// expansion).
///
int(CEF_CALLBACK* on_file_dialog)(
struct _cef_dialog_handler_t* self,
@@ -105,7 +108,8 @@ typedef struct _cef_dialog_handler_t {
const cef_string_t* title,
const cef_string_t* default_file_path,
cef_string_list_t accept_filters,
int selected_accept_filter,
cef_string_list_t accept_extensions,
cef_string_list_t accept_descriptions,
struct _cef_file_dialog_callback_t* callback);
} cef_dialog_handler_t;

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=142637539a094a03adc71d2f3f5b711ba64918b1$
// $hash=b42d9e5a03f6ef5444e8037b8dc4de08ee6b0834$
//
#ifndef CEF_INCLUDE_CAPI_CEF_DISPLAY_HANDLER_CAPI_H_
@@ -49,17 +49,17 @@ extern "C" {
#endif
///
// Implement this structure to handle events related to browser display state.
// The functions of this structure will be called on the UI thread.
/// Implement this structure to handle events related to browser display state.
/// The functions of this structure will be called on the UI thread.
///
typedef struct _cef_display_handler_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Called when a frame's address has changed.
/// Called when a frame's address has changed.
///
void(CEF_CALLBACK* on_address_change)(struct _cef_display_handler_t* self,
struct _cef_browser_t* browser,
@@ -67,25 +67,29 @@ typedef struct _cef_display_handler_t {
const cef_string_t* url);
///
// Called when the page title changes.
/// Called when the page title changes.
///
void(CEF_CALLBACK* on_title_change)(struct _cef_display_handler_t* self,
struct _cef_browser_t* browser,
const cef_string_t* title);
///
// Called when the page icon changes.
/// Called when the page icon changes.
///
void(CEF_CALLBACK* on_favicon_urlchange)(struct _cef_display_handler_t* self,
struct _cef_browser_t* browser,
cef_string_list_t icon_urls);
///
// Called when web content in the page has toggled fullscreen mode. If
// |fullscreen| is true (1) the content will automatically be sized to fill
// the browser content area. If |fullscreen| is false (0) the content will
// automatically return to its original size and position. The client is
// responsible for resizing the browser if desired.
/// Called when web content in the page has toggled fullscreen mode. If
/// |fullscreen| is true (1) the content will automatically be sized to fill
/// the browser content area. If |fullscreen| is false (0) the content will
/// automatically return to its original size and position. With Alloy style
/// the client is responsible for triggering the fullscreen transition (for
/// example, by calling cef_window_t::SetFullscreen when using Views). With
/// Chrome style the fullscreen transition will be triggered automatically.
/// The cef_window_delegate_t::OnWindowFullscreenTransition function will be
/// called during the fullscreen transition for notification purposes.
///
void(CEF_CALLBACK* on_fullscreen_mode_change)(
struct _cef_display_handler_t* self,
@@ -93,28 +97,28 @@ typedef struct _cef_display_handler_t {
int fullscreen);
///
// Called when the browser is about to display a tooltip. |text| contains the
// text that will be displayed in the tooltip. To handle the display of the
// tooltip yourself return true (1). Otherwise, you can optionally modify
// |text| and then return false (0) to allow the browser to display the
// tooltip. When window rendering is disabled the application is responsible
// for drawing tooltips and the return value is ignored.
/// Called when the browser is about to display a tooltip. |text| contains the
/// text that will be displayed in the tooltip. To handle the display of the
/// tooltip yourself return true (1). Otherwise, you can optionally modify
/// |text| and then return false (0) to allow the browser to display the
/// tooltip. When window rendering is disabled the application is responsible
/// for drawing tooltips and the return value is ignored.
///
int(CEF_CALLBACK* on_tooltip)(struct _cef_display_handler_t* self,
struct _cef_browser_t* browser,
cef_string_t* text);
///
// Called when the browser receives a status message. |value| contains the
// text that will be displayed in the status message.
/// Called when the browser receives a status message. |value| contains the
/// text that will be displayed in the status message.
///
void(CEF_CALLBACK* on_status_message)(struct _cef_display_handler_t* self,
struct _cef_browser_t* browser,
const cef_string_t* value);
///
// Called to display a console message. Return true (1) to stop the message
// from being output to the console.
/// Called to display a console message. Return true (1) to stop the message
/// from being output to the console.
///
int(CEF_CALLBACK* on_console_message)(struct _cef_display_handler_t* self,
struct _cef_browser_t* browser,
@@ -124,18 +128,18 @@ typedef struct _cef_display_handler_t {
int line);
///
// Called when auto-resize is enabled via
// cef_browser_host_t::SetAutoResizeEnabled and the contents have auto-
// resized. |new_size| will be the desired size in view coordinates. Return
// true (1) if the resize was handled or false (0) for default handling.
/// Called when auto-resize is enabled via
/// cef_browser_host_t::SetAutoResizeEnabled and the contents have auto-
/// resized. |new_size| will be the desired size in view coordinates. Return
/// true (1) if the resize was handled or false (0) for default handling.
///
int(CEF_CALLBACK* on_auto_resize)(struct _cef_display_handler_t* self,
struct _cef_browser_t* browser,
const cef_size_t* new_size);
///
// Called when the overall page loading progress has changed. |progress|
// ranges from 0.0 to 1.0.
/// Called when the overall page loading progress has changed. |progress|
/// ranges from 0.0 to 1.0.
///
void(CEF_CALLBACK* on_loading_progress_change)(
struct _cef_display_handler_t* self,
@@ -143,17 +147,27 @@ typedef struct _cef_display_handler_t {
double progress);
///
// Called when the browser's cursor has changed. If |type| is CT_CUSTOM then
// |custom_cursor_info| will be populated with the custom cursor information.
// Return true (1) if the cursor change was handled or false (0) for default
// handling.
/// Called when the browser's cursor has changed. If |type| is CT_CUSTOM then
/// |custom_cursor_info| will be populated with the custom cursor information.
/// Return true (1) if the cursor change was handled or false (0) for default
/// handling.
///
int(CEF_CALLBACK* on_cursor_change)(
struct _cef_display_handler_t* self,
struct _cef_browser_t* browser,
cef_cursor_handle_t cursor,
cef_cursor_type_t type,
const struct _cef_cursor_info_t* custom_cursor_info);
const cef_cursor_info_t* custom_cursor_info);
///
/// Called when the browser's access to an audio and/or video source has
/// changed.
///
void(CEF_CALLBACK* on_media_access_change)(
struct _cef_display_handler_t* self,
struct _cef_browser_t* browser,
int has_video_access,
int has_audio_access);
} cef_display_handler_t;
#ifdef __cplusplus

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=c6de3fb4d64a2b2ad06a4b9c5e9d7625d40b5bb6$
// $hash=a4d2f79163205ed4367916546240a6aedc2165f9$
//
#ifndef CEF_INCLUDE_CAPI_CEF_DOM_CAPI_H_
@@ -50,120 +50,120 @@ struct _cef_domdocument_t;
struct _cef_domnode_t;
///
// Structure to implement for visiting the DOM. The functions of this structure
// will be called on the render process main thread.
/// Structure to implement for visiting the DOM. The functions of this structure
/// will be called on the render process main thread.
///
typedef struct _cef_domvisitor_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Method executed for visiting the DOM. The document object passed to this
// function represents a snapshot of the DOM at the time this function is
// executed. DOM objects are only valid for the scope of this function. Do not
// keep references to or attempt to access any DOM objects outside the scope
// of this function.
/// Method executed for visiting the DOM. The document object passed to this
/// function represents a snapshot of the DOM at the time this function is
/// executed. DOM objects are only valid for the scope of this function. Do
/// not keep references to or attempt to access any DOM objects outside the
/// scope of this function.
///
void(CEF_CALLBACK* visit)(struct _cef_domvisitor_t* self,
struct _cef_domdocument_t* document);
} cef_domvisitor_t;
///
// Structure used to represent a DOM document. The functions of this structure
// should only be called on the render process main thread thread.
/// Structure used to represent a DOM document. The functions of this structure
/// should only be called on the render process main thread thread.
///
typedef struct _cef_domdocument_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Returns the document type.
/// Returns the document type.
///
cef_dom_document_type_t(CEF_CALLBACK* get_type)(
struct _cef_domdocument_t* self);
///
// Returns the root document node.
/// Returns the root document node.
///
struct _cef_domnode_t*(CEF_CALLBACK* get_document)(
struct _cef_domdocument_t* self);
///
// Returns the BODY node of an HTML document.
/// Returns the BODY node of an HTML document.
///
struct _cef_domnode_t*(CEF_CALLBACK* get_body)(
struct _cef_domdocument_t* self);
///
// Returns the HEAD node of an HTML document.
/// Returns the HEAD node of an HTML document.
///
struct _cef_domnode_t*(CEF_CALLBACK* get_head)(
struct _cef_domdocument_t* self);
///
// Returns the title of an HTML document.
/// Returns the title of an HTML document.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_title)(
struct _cef_domdocument_t* self);
///
// Returns the document element with the specified ID value.
/// Returns the document element with the specified ID value.
///
struct _cef_domnode_t*(CEF_CALLBACK* get_element_by_id)(
struct _cef_domdocument_t* self,
const cef_string_t* id);
///
// Returns the node that currently has keyboard focus.
/// Returns the node that currently has keyboard focus.
///
struct _cef_domnode_t*(CEF_CALLBACK* get_focused_node)(
struct _cef_domdocument_t* self);
///
// Returns true (1) if a portion of the document is selected.
/// Returns true (1) if a portion of the document is selected.
///
int(CEF_CALLBACK* has_selection)(struct _cef_domdocument_t* self);
///
// Returns the selection offset within the start node.
/// Returns the selection offset within the start node.
///
int(CEF_CALLBACK* get_selection_start_offset)(
struct _cef_domdocument_t* self);
///
// Returns the selection offset within the end node.
/// Returns the selection offset within the end node.
///
int(CEF_CALLBACK* get_selection_end_offset)(struct _cef_domdocument_t* self);
///
// Returns the contents of this selection as markup.
/// Returns the contents of this selection as markup.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_selection_as_markup)(
struct _cef_domdocument_t* self);
///
// Returns the contents of this selection as text.
/// Returns the contents of this selection as text.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_selection_as_text)(
struct _cef_domdocument_t* self);
///
// Returns the base URL for the document.
/// Returns the base URL for the document.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_base_url)(
struct _cef_domdocument_t* self);
///
// Returns a complete URL based on the document base URL and the specified
// partial URL.
/// Returns a complete URL based on the document base URL and the specified
/// partial URL.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_complete_url)(
@@ -172,141 +172,138 @@ typedef struct _cef_domdocument_t {
} cef_domdocument_t;
///
// Structure used to represent a DOM node. The functions of this structure
// should only be called on the render process main thread.
/// Structure used to represent a DOM node. The functions of this structure
/// should only be called on the render process main thread.
///
typedef struct _cef_domnode_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Returns the type for this node.
/// Returns the type for this node.
///
cef_dom_node_type_t(CEF_CALLBACK* get_type)(struct _cef_domnode_t* self);
///
// Returns true (1) if this is a text node.
/// Returns true (1) if this is a text node.
///
int(CEF_CALLBACK* is_text)(struct _cef_domnode_t* self);
///
// Returns true (1) if this is an element node.
/// Returns true (1) if this is an element node.
///
int(CEF_CALLBACK* is_element)(struct _cef_domnode_t* self);
///
// Returns true (1) if this is an editable node.
/// Returns true (1) if this is an editable node.
///
int(CEF_CALLBACK* is_editable)(struct _cef_domnode_t* self);
///
// Returns true (1) if this is a form control element node.
/// Returns true (1) if this is a form control element node.
///
int(CEF_CALLBACK* is_form_control_element)(struct _cef_domnode_t* self);
///
// Returns the type of this form control element node.
/// Returns the type of this form control element node.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_form_control_element_type)(
cef_dom_form_control_type_t(CEF_CALLBACK* get_form_control_element_type)(
struct _cef_domnode_t* self);
///
// Returns true (1) if this object is pointing to the same handle as |that|
// object.
/// Returns true (1) if this object is pointing to the same handle as |that|
/// object.
///
int(CEF_CALLBACK* is_same)(struct _cef_domnode_t* self,
struct _cef_domnode_t* that);
///
// Returns the name of this node.
/// Returns the name of this node.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_name)(struct _cef_domnode_t* self);
///
// Returns the value of this node.
/// Returns the value of this node.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_value)(struct _cef_domnode_t* self);
///
// Set the value of this node. Returns true (1) on success.
/// Set the value of this node. Returns true (1) on success.
///
int(CEF_CALLBACK* set_value)(struct _cef_domnode_t* self,
const cef_string_t* value);
///
// Returns the contents of this node as markup.
/// Returns the contents of this node as markup.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_as_markup)(
struct _cef_domnode_t* self);
///
// Returns the document associated with this node.
/// Returns the document associated with this node.
///
struct _cef_domdocument_t*(CEF_CALLBACK* get_document)(
struct _cef_domnode_t* self);
///
// Returns the parent node.
/// Returns the parent node.
///
struct _cef_domnode_t*(CEF_CALLBACK* get_parent)(struct _cef_domnode_t* self);
///
// Returns the previous sibling node.
/// Returns the previous sibling node.
///
struct _cef_domnode_t*(CEF_CALLBACK* get_previous_sibling)(
struct _cef_domnode_t* self);
///
// Returns the next sibling node.
/// Returns the next sibling node.
///
struct _cef_domnode_t*(CEF_CALLBACK* get_next_sibling)(
struct _cef_domnode_t* self);
///
// Returns true (1) if this node has child nodes.
/// Returns true (1) if this node has child nodes.
///
int(CEF_CALLBACK* has_children)(struct _cef_domnode_t* self);
///
// Return the first child node.
/// Return the first child node.
///
struct _cef_domnode_t*(CEF_CALLBACK* get_first_child)(
struct _cef_domnode_t* self);
///
// Returns the last child node.
/// Returns the last child node.
///
struct _cef_domnode_t*(CEF_CALLBACK* get_last_child)(
struct _cef_domnode_t* self);
// The following functions are valid only for element nodes.
///
// Returns the tag name of this element.
/// Returns the tag name of this element.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_element_tag_name)(
struct _cef_domnode_t* self);
///
// Returns true (1) if this element has attributes.
/// Returns true (1) if this element has attributes.
///
int(CEF_CALLBACK* has_element_attributes)(struct _cef_domnode_t* self);
///
// Returns true (1) if this element has an attribute named |attrName|.
/// Returns true (1) if this element has an attribute named |attrName|.
///
int(CEF_CALLBACK* has_element_attribute)(struct _cef_domnode_t* self,
const cef_string_t* attrName);
///
// Returns the element attribute named |attrName|.
/// Returns the element attribute named |attrName|.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_element_attribute)(
@@ -314,28 +311,29 @@ typedef struct _cef_domnode_t {
const cef_string_t* attrName);
///
// Returns a map of all element attributes.
/// Returns a map of all element attributes.
///
void(CEF_CALLBACK* get_element_attributes)(struct _cef_domnode_t* self,
cef_string_map_t attrMap);
///
// Set the value for the element attribute named |attrName|. Returns true (1)
// on success.
/// Set the value for the element attribute named |attrName|. Returns true (1)
/// on success.
///
int(CEF_CALLBACK* set_element_attribute)(struct _cef_domnode_t* self,
const cef_string_t* attrName,
const cef_string_t* value);
///
// Returns the inner text of the element.
/// Returns the inner text of the element.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_element_inner_text)(
struct _cef_domnode_t* self);
///
// Returns the bounds of the element.
/// Returns the bounds of the element in device pixels. Use
/// "window.devicePixelRatio" to convert to/from CSS pixels.
///
cef_rect_t(CEF_CALLBACK* get_element_bounds)(struct _cef_domnode_t* self);
} cef_domnode_t;

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=ec13ec3e2819e4ac49792c3a1c57bc60b45fb95b$
// $hash=7ecfb07a95315ff81937e9f68d419122fc88f1b7$
//
#ifndef CEF_INCLUDE_CAPI_CEF_DOWNLOAD_HANDLER_CAPI_H_
@@ -49,19 +49,19 @@ extern "C" {
#endif
///
// Callback structure used to asynchronously continue a download.
/// Callback structure used to asynchronously continue a download.
///
typedef struct _cef_before_download_callback_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Call to continue the download. Set |download_path| to the full file path
// for the download including the file name or leave blank to use the
// suggested name and the default temp directory. Set |show_dialog| to true
// (1) if you do wish to show the default "Save As" dialog.
/// Call to continue the download. Set |download_path| to the full file path
/// for the download including the file name or leave blank to use the
/// suggested name and the default temp directory. Set |show_dialog| to true
/// (1) if you do wish to show the default "Save As" dialog.
///
void(CEF_CALLBACK* cont)(struct _cef_before_download_callback_t* self,
const cef_string_t* download_path,
@@ -69,48 +69,61 @@ typedef struct _cef_before_download_callback_t {
} cef_before_download_callback_t;
///
// Callback structure used to asynchronously cancel a download.
/// Callback structure used to asynchronously cancel a download.
///
typedef struct _cef_download_item_callback_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Call to cancel the download.
/// Call to cancel the download.
///
void(CEF_CALLBACK* cancel)(struct _cef_download_item_callback_t* self);
///
// Call to pause the download.
/// Call to pause the download.
///
void(CEF_CALLBACK* pause)(struct _cef_download_item_callback_t* self);
///
// Call to resume the download.
/// Call to resume the download.
///
void(CEF_CALLBACK* resume)(struct _cef_download_item_callback_t* self);
} cef_download_item_callback_t;
///
// Structure used to handle file downloads. The functions of this structure will
// called on the browser process UI thread.
/// Structure used to handle file downloads. The functions of this structure
/// will called on the browser process UI thread.
///
typedef struct _cef_download_handler_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Called before a download begins. |suggested_name| is the suggested name for
// the download file. By default the download will be canceled. Execute
// |callback| either asynchronously or in this function to continue the
// download if desired. Do not keep a reference to |download_item| outside of
// this function.
/// Called before a download begins in response to a user-initiated action
/// (e.g. alt + link click or link click that returns a `Content-Disposition:
/// attachment` response from the server). |url| is the target download URL
/// and |request_function| is the target function (GET, POST, etc). Return
/// true (1) to proceed with the download or false (0) to cancel the download.
///
void(CEF_CALLBACK* on_before_download)(
int(CEF_CALLBACK* can_download)(struct _cef_download_handler_t* self,
struct _cef_browser_t* browser,
const cef_string_t* url,
const cef_string_t* request_method);
///
/// Called before a download begins. |suggested_name| is the suggested name
/// for the download file. Return true (1) and execute |callback| either
/// asynchronously or in this function to continue or cancel the download.
/// Return false (0) to proceed with default handling (cancel with Alloy
/// style, download shelf with Chrome style). Do not keep a reference to
/// |download_item| outside of this function.
///
int(CEF_CALLBACK* on_before_download)(
struct _cef_download_handler_t* self,
struct _cef_browser_t* browser,
struct _cef_download_item_t* download_item,
@@ -118,11 +131,11 @@ typedef struct _cef_download_handler_t {
struct _cef_before_download_callback_t* callback);
///
// Called when a download's status or progress information has been updated.
// This may be called multiple times before and after on_before_download().
// Execute |callback| either asynchronously or in this function to cancel the
// download if desired. Do not keep a reference to |download_item| outside of
// this function.
/// Called when a download's status or progress information has been updated.
/// This may be called multiple times before and after on_before_download().
/// Execute |callback| either asynchronously or in this function to cancel the
/// download if desired. Do not keep a reference to |download_item| outside of
/// this function.
///
void(CEF_CALLBACK* on_download_updated)(
struct _cef_download_handler_t* self,

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=b9f0d91dd2fdb3625365ff8b332b08e1f0ea1187$
// $hash=9af8ade3addfd112db41792c4e80682a8143e8c4$
//
#ifndef CEF_INCLUDE_CAPI_CEF_DOWNLOAD_ITEM_CAPI_H_
@@ -47,108 +47,120 @@ extern "C" {
#endif
///
// Structure used to represent a download item.
/// Structure used to represent a download item.
///
typedef struct _cef_download_item_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Returns true (1) if this object is valid. Do not call any other functions
// if this function returns false (0).
/// Returns true (1) if this object is valid. Do not call any other functions
/// if this function returns false (0).
///
int(CEF_CALLBACK* is_valid)(struct _cef_download_item_t* self);
///
// Returns true (1) if the download is in progress.
/// Returns true (1) if the download is in progress.
///
int(CEF_CALLBACK* is_in_progress)(struct _cef_download_item_t* self);
///
// Returns true (1) if the download is complete.
/// Returns true (1) if the download is complete.
///
int(CEF_CALLBACK* is_complete)(struct _cef_download_item_t* self);
///
// Returns true (1) if the download has been canceled or interrupted.
/// Returns true (1) if the download has been canceled.
///
int(CEF_CALLBACK* is_canceled)(struct _cef_download_item_t* self);
///
// Returns a simple speed estimate in bytes/s.
/// Returns true (1) if the download has been interrupted.
///
int64(CEF_CALLBACK* get_current_speed)(struct _cef_download_item_t* self);
int(CEF_CALLBACK* is_interrupted)(struct _cef_download_item_t* self);
///
// Returns the rough percent complete or -1 if the receive total size is
// unknown.
/// Returns the most recent interrupt reason.
///
cef_download_interrupt_reason_t(CEF_CALLBACK* get_interrupt_reason)(
struct _cef_download_item_t* self);
///
/// Returns a simple speed estimate in bytes/s.
///
int64_t(CEF_CALLBACK* get_current_speed)(struct _cef_download_item_t* self);
///
/// Returns the rough percent complete or -1 if the receive total size is
/// unknown.
///
int(CEF_CALLBACK* get_percent_complete)(struct _cef_download_item_t* self);
///
// Returns the total number of bytes.
/// Returns the total number of bytes.
///
int64(CEF_CALLBACK* get_total_bytes)(struct _cef_download_item_t* self);
int64_t(CEF_CALLBACK* get_total_bytes)(struct _cef_download_item_t* self);
///
// Returns the number of received bytes.
/// Returns the number of received bytes.
///
int64(CEF_CALLBACK* get_received_bytes)(struct _cef_download_item_t* self);
int64_t(CEF_CALLBACK* get_received_bytes)(struct _cef_download_item_t* self);
///
// Returns the time that the download started.
/// Returns the time that the download started.
///
cef_time_t(CEF_CALLBACK* get_start_time)(struct _cef_download_item_t* self);
cef_basetime_t(CEF_CALLBACK* get_start_time)(
struct _cef_download_item_t* self);
///
// Returns the time that the download ended.
/// Returns the time that the download ended.
///
cef_time_t(CEF_CALLBACK* get_end_time)(struct _cef_download_item_t* self);
cef_basetime_t(CEF_CALLBACK* get_end_time)(struct _cef_download_item_t* self);
///
// Returns the full path to the downloaded or downloading file.
/// Returns the full path to the downloaded or downloading file.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_full_path)(
struct _cef_download_item_t* self);
///
// Returns the unique identifier for this download.
/// Returns the unique identifier for this download.
///
uint32(CEF_CALLBACK* get_id)(struct _cef_download_item_t* self);
uint32_t(CEF_CALLBACK* get_id)(struct _cef_download_item_t* self);
///
// Returns the URL.
/// Returns the URL.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_url)(
struct _cef_download_item_t* self);
///
// Returns the original URL before any redirections.
/// Returns the original URL before any redirections.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_original_url)(
struct _cef_download_item_t* self);
///
// Returns the suggested file name.
/// Returns the suggested file name.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_suggested_file_name)(
struct _cef_download_item_t* self);
///
// Returns the content disposition.
/// Returns the content disposition.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_content_disposition)(
struct _cef_download_item_t* self);
///
// Returns the mime type.
/// Returns the mime type.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_mime_type)(

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=221973f3d5728478eeb0f8f5f55ca5e68b3afd8a$
// $hash=a096775255ddc4d7616095e48e7370bd87bf4bb5$
//
#ifndef CEF_INCLUDE_CAPI_CEF_DRAG_DATA_CAPI_H_
@@ -49,175 +49,187 @@ extern "C" {
#endif
///
// Structure used to represent drag data. The functions of this structure may be
// called on any thread.
/// Structure used to represent drag data. The functions of this structure may
/// be called on any thread.
///
typedef struct _cef_drag_data_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Returns a copy of the current object.
/// Returns a copy of the current object.
///
struct _cef_drag_data_t*(CEF_CALLBACK* clone)(struct _cef_drag_data_t* self);
///
// Returns true (1) if this object is read-only.
/// Returns true (1) if this object is read-only.
///
int(CEF_CALLBACK* is_read_only)(struct _cef_drag_data_t* self);
///
// Returns true (1) if the drag data is a link.
/// Returns true (1) if the drag data is a link.
///
int(CEF_CALLBACK* is_link)(struct _cef_drag_data_t* self);
///
// Returns true (1) if the drag data is a text or html fragment.
/// Returns true (1) if the drag data is a text or html fragment.
///
int(CEF_CALLBACK* is_fragment)(struct _cef_drag_data_t* self);
///
// Returns true (1) if the drag data is a file.
/// Returns true (1) if the drag data is a file.
///
int(CEF_CALLBACK* is_file)(struct _cef_drag_data_t* self);
///
// Return the link URL that is being dragged.
/// Return the link URL that is being dragged.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_link_url)(
struct _cef_drag_data_t* self);
///
// Return the title associated with the link being dragged.
/// Return the title associated with the link being dragged.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_link_title)(
struct _cef_drag_data_t* self);
///
// Return the metadata, if any, associated with the link being dragged.
/// Return the metadata, if any, associated with the link being dragged.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_link_metadata)(
struct _cef_drag_data_t* self);
///
// Return the plain text fragment that is being dragged.
/// Return the plain text fragment that is being dragged.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_fragment_text)(
struct _cef_drag_data_t* self);
///
// Return the text/html fragment that is being dragged.
/// Return the text/html fragment that is being dragged.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_fragment_html)(
struct _cef_drag_data_t* self);
///
// Return the base URL that the fragment came from. This value is used for
// resolving relative URLs and may be NULL.
/// Return the base URL that the fragment came from. This value is used for
/// resolving relative URLs and may be NULL.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_fragment_base_url)(
struct _cef_drag_data_t* self);
///
// Return the name of the file being dragged out of the browser window.
/// Return the name of the file being dragged out of the browser window.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_file_name)(
struct _cef_drag_data_t* self);
///
// Write the contents of the file being dragged out of the web view into
// |writer|. Returns the number of bytes sent to |writer|. If |writer| is NULL
// this function will return the size of the file contents in bytes. Call
// get_file_name() to get a suggested name for the file.
/// Write the contents of the file being dragged out of the web view into
/// |writer|. Returns the number of bytes sent to |writer|. If |writer| is
/// NULL this function will return the size of the file contents in bytes.
/// Call get_file_name() to get a suggested name for the file.
///
size_t(CEF_CALLBACK* get_file_contents)(struct _cef_drag_data_t* self,
struct _cef_stream_writer_t* writer);
///
// Retrieve the list of file names that are being dragged into the browser
// window.
/// Retrieve the list of file names that are being dragged into the browser
/// window.
///
int(CEF_CALLBACK* get_file_names)(struct _cef_drag_data_t* self,
cef_string_list_t names);
///
// Set the link URL that is being dragged.
/// Retrieve the list of file paths that are being dragged into the browser
/// window.
///
int(CEF_CALLBACK* get_file_paths)(struct _cef_drag_data_t* self,
cef_string_list_t paths);
///
/// Set the link URL that is being dragged.
///
void(CEF_CALLBACK* set_link_url)(struct _cef_drag_data_t* self,
const cef_string_t* url);
///
// Set the title associated with the link being dragged.
/// Set the title associated with the link being dragged.
///
void(CEF_CALLBACK* set_link_title)(struct _cef_drag_data_t* self,
const cef_string_t* title);
///
// Set the metadata associated with the link being dragged.
/// Set the metadata associated with the link being dragged.
///
void(CEF_CALLBACK* set_link_metadata)(struct _cef_drag_data_t* self,
const cef_string_t* data);
///
// Set the plain text fragment that is being dragged.
/// Set the plain text fragment that is being dragged.
///
void(CEF_CALLBACK* set_fragment_text)(struct _cef_drag_data_t* self,
const cef_string_t* text);
///
// Set the text/html fragment that is being dragged.
/// Set the text/html fragment that is being dragged.
///
void(CEF_CALLBACK* set_fragment_html)(struct _cef_drag_data_t* self,
const cef_string_t* html);
///
// Set the base URL that the fragment came from.
/// Set the base URL that the fragment came from.
///
void(CEF_CALLBACK* set_fragment_base_url)(struct _cef_drag_data_t* self,
const cef_string_t* base_url);
///
// Reset the file contents. You should do this before calling
// cef_browser_host_t::DragTargetDragEnter as the web view does not allow us
// to drag in this kind of data.
/// Reset the file contents. You should do this before calling
/// cef_browser_host_t::DragTargetDragEnter as the web view does not allow us
/// to drag in this kind of data.
///
void(CEF_CALLBACK* reset_file_contents)(struct _cef_drag_data_t* self);
///
// Add a file that is being dragged into the webview.
/// Add a file that is being dragged into the webview.
///
void(CEF_CALLBACK* add_file)(struct _cef_drag_data_t* self,
const cef_string_t* path,
const cef_string_t* display_name);
///
// Get the image representation of drag data. May return NULL if no image
// representation is available.
/// Clear list of filenames.
///
void(CEF_CALLBACK* clear_filenames)(struct _cef_drag_data_t* self);
///
/// Get the image representation of drag data. May return NULL if no image
/// representation is available.
///
struct _cef_image_t*(CEF_CALLBACK* get_image)(struct _cef_drag_data_t* self);
///
// Get the image hotspot (drag start location relative to image dimensions).
/// Get the image hotspot (drag start location relative to image dimensions).
///
cef_point_t(CEF_CALLBACK* get_image_hotspot)(struct _cef_drag_data_t* self);
///
// Returns true (1) if an image representation of drag data is available.
/// Returns true (1) if an image representation of drag data is available.
///
int(CEF_CALLBACK* has_image)(struct _cef_drag_data_t* self);
} cef_drag_data_t;
///
// Create a new cef_drag_data_t object.
/// Create a new cef_drag_data_t object.
///
CEF_EXPORT cef_drag_data_t* cef_drag_data_create(void);

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=5b2051c42c1d4c41b85ca823d34b26bfa5de6777$
// $hash=0723a2a59d46e465ac94f198351dc871f0b35b96$
//
#ifndef CEF_INCLUDE_CAPI_CEF_DRAG_HANDLER_CAPI_H_
@@ -50,20 +50,20 @@ extern "C" {
#endif
///
// Implement this structure to handle events related to dragging. The functions
// of this structure will be called on the UI thread.
/// Implement this structure to handle events related to dragging. The functions
/// of this structure will be called on the UI thread.
///
typedef struct _cef_drag_handler_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Called when an external drag event enters the browser window. |dragData|
// contains the drag event data and |mask| represents the type of drag
// operation. Return false (0) for default drag handling behavior or true (1)
// to cancel the drag event.
/// Called when an external drag event enters the browser window. |dragData|
/// contains the drag event data and |mask| represents the type of drag
/// operation. Return false (0) for default drag handling behavior or true (1)
/// to cancel the drag event.
///
int(CEF_CALLBACK* on_drag_enter)(struct _cef_drag_handler_t* self,
struct _cef_browser_t* browser,
@@ -71,11 +71,11 @@ typedef struct _cef_drag_handler_t {
cef_drag_operations_mask_t mask);
///
// Called whenever draggable regions for the browser window change. These can
// be specified using the '-webkit-app-region: drag/no-drag' CSS-property. If
// draggable regions are never defined in a document this function will also
// never be called. If the last draggable region is removed from a document
// this function will be called with an NULL vector.
/// Called whenever draggable regions for the browser window change. These can
/// be specified using the '-webkit-app-region: drag/no-drag' CSS-property. If
/// draggable regions are never defined in a document this function will also
/// never be called. If the last draggable region is removed from a document
/// this function will be called with an NULL vector.
///
void(CEF_CALLBACK* on_draggable_regions_changed)(
struct _cef_drag_handler_t* self,

View File

@@ -1,130 +0,0 @@
// Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=fcfe34c1517ebdb3f00c1f737b91361e771b820d$
//
#ifndef CEF_INCLUDE_CAPI_CEF_EXTENSION_CAPI_H_
#define CEF_INCLUDE_CAPI_CEF_EXTENSION_CAPI_H_
#pragma once
#include "include/capi/cef_base_capi.h"
#include "include/capi/cef_values_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
struct _cef_extension_handler_t;
struct _cef_request_context_t;
///
// Object representing an extension. Methods may be called on any thread unless
// otherwise indicated.
///
typedef struct _cef_extension_t {
///
// Base structure.
///
cef_base_ref_counted_t base;
///
// Returns the unique extension identifier. This is calculated based on the
// extension public key, if available, or on the extension path. See
// https://developer.chrome.com/extensions/manifest/key for details.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_identifier)(
struct _cef_extension_t* self);
///
// Returns the absolute path to the extension directory on disk. This value
// will be prefixed with PK_DIR_RESOURCES if a relative path was passed to
// cef_request_context_t::LoadExtension.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_path)(struct _cef_extension_t* self);
///
// Returns the extension manifest contents as a cef_dictionary_value_t object.
// See https://developer.chrome.com/extensions/manifest for details.
///
struct _cef_dictionary_value_t*(CEF_CALLBACK* get_manifest)(
struct _cef_extension_t* self);
///
// Returns true (1) if this object is the same extension as |that| object.
// Extensions are considered the same if identifier, path and loader context
// match.
///
int(CEF_CALLBACK* is_same)(struct _cef_extension_t* self,
struct _cef_extension_t* that);
///
// Returns the handler for this extension. Will return NULL for internal
// extensions or if no handler was passed to
// cef_request_context_t::LoadExtension.
///
struct _cef_extension_handler_t*(CEF_CALLBACK* get_handler)(
struct _cef_extension_t* self);
///
// Returns the request context that loaded this extension. Will return NULL
// for internal extensions or if the extension has been unloaded. See the
// cef_request_context_t::LoadExtension documentation for more information
// about loader contexts. Must be called on the browser process UI thread.
///
struct _cef_request_context_t*(CEF_CALLBACK* get_loader_context)(
struct _cef_extension_t* self);
///
// Returns true (1) if this extension is currently loaded. Must be called on
// the browser process UI thread.
///
int(CEF_CALLBACK* is_loaded)(struct _cef_extension_t* self);
///
// Unload this extension if it is not an internal extension and is currently
// loaded. Will result in a call to
// cef_extension_handler_t::OnExtensionUnloaded on success.
///
void(CEF_CALLBACK* unload)(struct _cef_extension_t* self);
} cef_extension_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_CEF_EXTENSION_CAPI_H_

View File

@@ -1,210 +0,0 @@
// Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=768e2436e54cceb2675ddd03ebdc61b5c0785bdc$
//
#ifndef CEF_INCLUDE_CAPI_CEF_EXTENSION_HANDLER_CAPI_H_
#define CEF_INCLUDE_CAPI_CEF_EXTENSION_HANDLER_CAPI_H_
#pragma once
#include "include/capi/cef_base_capi.h"
#include "include/capi/cef_browser_capi.h"
#include "include/capi/cef_extension_capi.h"
#include "include/capi/cef_stream_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
struct _cef_client_t;
///
// Callback structure used for asynchronous continuation of
// cef_extension_handler_t::GetExtensionResource.
///
typedef struct _cef_get_extension_resource_callback_t {
///
// Base structure.
///
cef_base_ref_counted_t base;
///
// Continue the request. Read the resource contents from |stream|.
///
void(CEF_CALLBACK* cont)(struct _cef_get_extension_resource_callback_t* self,
struct _cef_stream_reader_t* stream);
///
// Cancel the request.
///
void(CEF_CALLBACK* cancel)(
struct _cef_get_extension_resource_callback_t* self);
} cef_get_extension_resource_callback_t;
///
// Implement this structure to handle events related to browser extensions. The
// functions of this structure will be called on the UI thread. See
// cef_request_context_t::LoadExtension for information about extension loading.
///
typedef struct _cef_extension_handler_t {
///
// Base structure.
///
cef_base_ref_counted_t base;
///
// Called if the cef_request_context_t::LoadExtension request fails. |result|
// will be the error code.
///
void(CEF_CALLBACK* on_extension_load_failed)(
struct _cef_extension_handler_t* self,
cef_errorcode_t result);
///
// Called if the cef_request_context_t::LoadExtension request succeeds.
// |extension| is the loaded extension.
///
void(CEF_CALLBACK* on_extension_loaded)(struct _cef_extension_handler_t* self,
struct _cef_extension_t* extension);
///
// Called after the cef_extension_t::Unload request has completed.
///
void(CEF_CALLBACK* on_extension_unloaded)(
struct _cef_extension_handler_t* self,
struct _cef_extension_t* extension);
///
// Called when an extension needs a browser to host a background script
// specified via the "background" manifest key. The browser will have no
// visible window and cannot be displayed. |extension| is the extension that
// is loading the background script. |url| is an internally generated
// reference to an HTML page that will be used to load the background script
// via a <script> src attribute. To allow creation of the browser optionally
// modify |client| and |settings| and return false (0). To cancel creation of
// the browser (and consequently cancel load of the background script) return
// true (1). Successful creation will be indicated by a call to
// cef_life_span_handler_t::OnAfterCreated, and
// cef_browser_host_t::IsBackgroundHost will return true (1) for the resulting
// browser. See https://developer.chrome.com/extensions/event_pages for more
// information about extension background script usage.
///
int(CEF_CALLBACK* on_before_background_browser)(
struct _cef_extension_handler_t* self,
struct _cef_extension_t* extension,
const cef_string_t* url,
struct _cef_client_t** client,
struct _cef_browser_settings_t* settings);
///
// Called when an extension API (e.g. chrome.tabs.create) requests creation of
// a new browser. |extension| and |browser| are the source of the API call.
// |active_browser| may optionally be specified via the windowId property or
// returned via the get_active_browser() callback and provides the default
// |client| and |settings| values for the new browser. |index| is the position
// value optionally specified via the index property. |url| is the URL that
// will be loaded in the browser. |active| is true (1) if the new browser
// should be active when opened. To allow creation of the browser optionally
// modify |windowInfo|, |client| and |settings| and return false (0). To
// cancel creation of the browser return true (1). Successful creation will be
// indicated by a call to cef_life_span_handler_t::OnAfterCreated. Any
// modifications to |windowInfo| will be ignored if |active_browser| is
// wrapped in a cef_browser_view_t.
///
int(CEF_CALLBACK* on_before_browser)(
struct _cef_extension_handler_t* self,
struct _cef_extension_t* extension,
struct _cef_browser_t* browser,
struct _cef_browser_t* active_browser,
int index,
const cef_string_t* url,
int active,
struct _cef_window_info_t* windowInfo,
struct _cef_client_t** client,
struct _cef_browser_settings_t* settings);
///
// Called when no tabId is specified to an extension API call that accepts a
// tabId parameter (e.g. chrome.tabs.*). |extension| and |browser| are the
// source of the API call. Return the browser that will be acted on by the API
// call or return NULL to act on |browser|. The returned browser must share
// the same cef_request_context_t as |browser|. Incognito browsers should not
// be considered unless the source extension has incognito access enabled, in
// which case |include_incognito| will be true (1).
///
struct _cef_browser_t*(CEF_CALLBACK* get_active_browser)(
struct _cef_extension_handler_t* self,
struct _cef_extension_t* extension,
struct _cef_browser_t* browser,
int include_incognito);
///
// Called when the tabId associated with |target_browser| is specified to an
// extension API call that accepts a tabId parameter (e.g. chrome.tabs.*).
// |extension| and |browser| are the source of the API call. Return true (1)
// to allow access of false (0) to deny access. Access to incognito browsers
// should not be allowed unless the source extension has incognito access
// enabled, in which case |include_incognito| will be true (1).
///
int(CEF_CALLBACK* can_access_browser)(struct _cef_extension_handler_t* self,
struct _cef_extension_t* extension,
struct _cef_browser_t* browser,
int include_incognito,
struct _cef_browser_t* target_browser);
///
// Called to retrieve an extension resource that would normally be loaded from
// disk (e.g. if a file parameter is specified to chrome.tabs.executeScript).
// |extension| and |browser| are the source of the resource request. |file| is
// the requested relative file path. To handle the resource request return
// true (1) and execute |callback| either synchronously or asynchronously. For
// the default behavior which reads the resource from the extension directory
// on disk return false (0). Localization substitutions will not be applied to
// resources handled via this function.
///
int(CEF_CALLBACK* get_extension_resource)(
struct _cef_extension_handler_t* self,
struct _cef_extension_t* extension,
struct _cef_browser_t* browser,
const cef_string_t* file,
struct _cef_get_extension_resource_callback_t* callback);
} cef_extension_handler_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_CEF_EXTENSION_HANDLER_CAPI_H_

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=e76fa23e9682bf0865319d93e4009752ac8f854f$
// $hash=e10581d1f6aeb104646ae106aaa5fb36016643dd$
//
#ifndef CEF_INCLUDE_CAPI_CEF_FILE_UTIL_CAPI_H_
@@ -47,40 +47,40 @@ extern "C" {
#endif
///
// Creates a directory and all parent directories if they don't already exist.
// Returns true (1) on successful creation or if the directory already exists.
// The directory is only readable by the current user. Calling this function on
// the browser process UI or IO threads is not allowed.
/// Creates a directory and all parent directories if they don't already exist.
/// Returns true (1) on successful creation or if the directory already exists.
/// The directory is only readable by the current user. Calling this function on
/// the browser process UI or IO threads is not allowed.
///
CEF_EXPORT int cef_create_directory(const cef_string_t* full_path);
///
// Get the temporary directory provided by the system.
//
// WARNING: In general, you should use the temp directory variants below instead
// of this function. Those variants will ensure that the proper permissions are
// set so that other users on the system can't edit them while they're open
// (which could lead to security issues).
/// Get the temporary directory provided by the system.
///
/// WARNING: In general, you should use the temp directory variants below
/// instead of this function. Those variants will ensure that the proper
/// permissions are set so that other users on the system can't edit them while
/// they're open (which could lead to security issues).
///
CEF_EXPORT int cef_get_temp_directory(cef_string_t* temp_dir);
///
// Creates a new directory. On Windows if |prefix| is provided the new directory
// name is in the format of "prefixyyyy". Returns true (1) on success and sets
// |new_temp_path| to the full path of the directory that was created. The
// directory is only readable by the current user. Calling this function on the
// browser process UI or IO threads is not allowed.
/// Creates a new directory. On Windows if |prefix| is provided the new
/// directory name is in the format of "prefixyyyy". Returns true (1) on success
/// and sets |new_temp_path| to the full path of the directory that was created.
/// The directory is only readable by the current user. Calling this function on
/// the browser process UI or IO threads is not allowed.
///
CEF_EXPORT int cef_create_new_temp_directory(const cef_string_t* prefix,
cef_string_t* new_temp_path);
///
// Creates a directory within another directory. Extra characters will be
// appended to |prefix| to ensure that the new directory does not have the same
// name as an existing directory. Returns true (1) on success and sets |new_dir|
// to the full path of the directory that was created. The directory is only
// readable by the current user. Calling this function on the browser process UI
// or IO threads is not allowed.
/// Creates a directory within another directory. Extra characters will be
/// appended to |prefix| to ensure that the new directory does not have the same
/// name as an existing directory. Returns true (1) on success and sets
/// |new_dir| to the full path of the directory that was created. The directory
/// is only readable by the current user. Calling this function on the browser
/// process UI or IO threads is not allowed.
///
CEF_EXPORT int cef_create_temp_directory_in_directory(
const cef_string_t* base_dir,
@@ -88,39 +88,40 @@ CEF_EXPORT int cef_create_temp_directory_in_directory(
cef_string_t* new_dir);
///
// Returns true (1) if the given path exists and is a directory. Calling this
// function on the browser process UI or IO threads is not allowed.
/// Returns true (1) if the given path exists and is a directory. Calling this
/// function on the browser process UI or IO threads is not allowed.
///
CEF_EXPORT int cef_directory_exists(const cef_string_t* path);
///
// Deletes the given path whether it's a file or a directory. If |path| is a
// directory all contents will be deleted. If |recursive| is true (1) any sub-
// directories and their contents will also be deleted (equivalent to executing
// "rm -rf", so use with caution). On POSIX environments if |path| is a symbolic
// link then only the symlink will be deleted. Returns true (1) on successful
// deletion or if |path| does not exist. Calling this function on the browser
// process UI or IO threads is not allowed.
/// Deletes the given path whether it's a file or a directory. If |path| is a
/// directory all contents will be deleted. If |recursive| is true (1) any sub-
/// directories and their contents will also be deleted (equivalent to executing
/// "rm -rf", so use with caution). On POSIX environments if |path| is a
/// symbolic link then only the symlink will be deleted. Returns true (1) on
/// successful deletion or if |path| does not exist. Calling this function on
/// the browser process UI or IO threads is not allowed.
///
CEF_EXPORT int cef_delete_file(const cef_string_t* path, int recursive);
///
// Writes the contents of |src_dir| into a zip archive at |dest_file|. If
// |include_hidden_files| is true (1) files starting with "." will be included.
// Returns true (1) on success. Calling this function on the browser process UI
// or IO threads is not allowed.
/// Writes the contents of |src_dir| into a zip archive at |dest_file|. If
/// |include_hidden_files| is true (1) files starting with "." will be included.
/// Returns true (1) on success. Calling this function on the browser process
/// UI or IO threads is not allowed.
///
CEF_EXPORT int cef_zip_directory(const cef_string_t* src_dir,
const cef_string_t* dest_file,
int include_hidden_files);
///
// Loads the existing "Certificate Revocation Lists" file that is managed by
// Google Chrome. This file can generally be found in Chrome's User Data
// directory (e.g. "C:\Users\[User]\AppData\Local\Google\Chrome\User Data\" on
// Windows) and is updated periodically by Chrome's component updater service.
// Must be called in the browser process after the context has been initialized.
// See https://dev.chromium.org/Home/chromium-security/crlsets for background.
/// Loads the existing "Certificate Revocation Lists" file that is managed by
/// Google Chrome. This file can generally be found in Chrome's User Data
/// directory (e.g. "C:\Users\[User]\AppData\Local\Google\Chrome\User Data\" on
/// Windows) and is updated periodically by Chrome's component updater service.
/// Must be called in the browser process after the context has been
/// initialized. See https://dev.chromium.org/Home/chromium-security/crlsets for
/// background.
///
CEF_EXPORT void cef_load_crlsets_file(const cef_string_t* path);

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=f2e80b8637b07f19adea666e554269de4627e399$
// $hash=da0a9242b309fbd70d19949fb1c5b4ec4475ef94$
//
#ifndef CEF_INCLUDE_CAPI_CEF_FIND_HANDLER_CAPI_H_
@@ -48,23 +48,23 @@ extern "C" {
#endif
///
// Implement this structure to handle events related to find results. The
// functions of this structure will be called on the UI thread.
/// Implement this structure to handle events related to find results. The
/// functions of this structure will be called on the UI thread.
///
typedef struct _cef_find_handler_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Called to report find results returned by cef_browser_host_t::find().
// |identifer| is a unique incremental identifier for the currently active
// search, |count| is the number of matches currently identified,
// |selectionRect| is the location of where the match was found (in window
// coordinates), |activeMatchOrdinal| is the current position in the search
// results, and |finalUpdate| is true (1) if this is the last find
// notification.
/// Called to report find results returned by cef_browser_host_t::find().
/// |identifer| is a unique incremental identifier for the currently active
/// search, |count| is the number of matches currently identified,
/// |selectionRect| is the location of where the match was found (in window
/// coordinates), |activeMatchOrdinal| is the current position in the search
/// results, and |finalUpdate| is true (1) if this is the last find
/// notification.
///
void(CEF_CALLBACK* on_find_result)(struct _cef_find_handler_t* self,
struct _cef_browser_t* browser,

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=a136a2679c8af339b21a89e8ae3090a9dbb8daa7$
// $hash=6eefc2c650908461fb7536dd3314c77a3f89dceb$
//
#ifndef CEF_INCLUDE_CAPI_CEF_FOCUS_HANDLER_CAPI_H_
@@ -50,36 +50,37 @@ extern "C" {
#endif
///
// Implement this structure to handle events related to focus. The functions of
// this structure will be called on the UI thread.
/// Implement this structure to handle events related to focus. The functions of
/// this structure will be called on the UI thread.
///
typedef struct _cef_focus_handler_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Called when the browser component is about to loose focus. For instance, if
// focus was on the last HTML element and the user pressed the TAB key. |next|
// will be true (1) if the browser is giving focus to the next component and
// false (0) if the browser is giving focus to the previous component.
/// Called when the browser component is about to loose focus. For instance,
/// if focus was on the last HTML element and the user pressed the TAB key.
/// |next| will be true (1) if the browser is giving focus to the next
/// component and false (0) if the browser is giving focus to the previous
/// component.
///
void(CEF_CALLBACK* on_take_focus)(struct _cef_focus_handler_t* self,
struct _cef_browser_t* browser,
int next);
///
// Called when the browser component is requesting focus. |source| indicates
// where the focus request is originating from. Return false (0) to allow the
// focus to be set or true (1) to cancel setting the focus.
/// Called when the browser component is requesting focus. |source| indicates
/// where the focus request is originating from. Return false (0) to allow the
/// focus to be set or true (1) to cancel setting the focus.
///
int(CEF_CALLBACK* on_set_focus)(struct _cef_focus_handler_t* self,
struct _cef_browser_t* browser,
cef_focus_source_t source);
///
// Called when the browser component has received focus.
/// Called when the browser component has received focus.
///
void(CEF_CALLBACK* on_got_focus)(struct _cef_focus_handler_t* self,
struct _cef_browser_t* browser);

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=8527ceea6b8778d6fabc1b4ef82e4faa06ba777a$
// $hash=8f347a95168778ec0e686cdef93be3bc517e2f68$
//
#ifndef CEF_INCLUDE_CAPI_CEF_FRAME_CAPI_H_
@@ -57,100 +57,100 @@ struct _cef_urlrequest_t;
struct _cef_v8context_t;
///
// Structure used to represent a frame in the browser window. When used in the
// browser process the functions of this structure may be called on any thread
// unless otherwise indicated in the comments. When used in the render process
// the functions of this structure may only be called on the main thread.
/// Structure used to represent a frame in the browser window. When used in the
/// browser process the functions of this structure may be called on any thread
/// unless otherwise indicated in the comments. When used in the render process
/// the functions of this structure may only be called on the main thread.
///
typedef struct _cef_frame_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// True if this object is currently attached to a valid frame.
/// True if this object is currently attached to a valid frame.
///
int(CEF_CALLBACK* is_valid)(struct _cef_frame_t* self);
///
// Execute undo in this frame.
/// Execute undo in this frame.
///
void(CEF_CALLBACK* undo)(struct _cef_frame_t* self);
///
// Execute redo in this frame.
/// Execute redo in this frame.
///
void(CEF_CALLBACK* redo)(struct _cef_frame_t* self);
///
// Execute cut in this frame.
/// Execute cut in this frame.
///
void(CEF_CALLBACK* cut)(struct _cef_frame_t* self);
///
// Execute copy in this frame.
/// Execute copy in this frame.
///
void(CEF_CALLBACK* copy)(struct _cef_frame_t* self);
///
// Execute paste in this frame.
/// Execute paste in this frame.
///
void(CEF_CALLBACK* paste)(struct _cef_frame_t* self);
///
// Execute delete in this frame.
/// Execute delete in this frame.
///
void(CEF_CALLBACK* del)(struct _cef_frame_t* self);
///
// Execute select all in this frame.
/// Execute select all in this frame.
///
void(CEF_CALLBACK* select_all)(struct _cef_frame_t* self);
///
// Save this frame's HTML source to a temporary file and open it in the
// default text viewing application. This function can only be called from the
// browser process.
/// Save this frame's HTML source to a temporary file and open it in the
/// default text viewing application. This function can only be called from
/// the browser process.
///
void(CEF_CALLBACK* view_source)(struct _cef_frame_t* self);
///
// Retrieve this frame's HTML source as a string sent to the specified
// visitor.
/// Retrieve this frame's HTML source as a string sent to the specified
/// visitor.
///
void(CEF_CALLBACK* get_source)(struct _cef_frame_t* self,
struct _cef_string_visitor_t* visitor);
///
// Retrieve this frame's display text as a string sent to the specified
// visitor.
/// Retrieve this frame's display text as a string sent to the specified
/// visitor.
///
void(CEF_CALLBACK* get_text)(struct _cef_frame_t* self,
struct _cef_string_visitor_t* visitor);
///
// Load the request represented by the |request| object.
//
// WARNING: This function will fail with "bad IPC message" reason
// INVALID_INITIATOR_ORIGIN (213) unless you first navigate to the request
// origin using some other mechanism (LoadURL, link click, etc).
/// Load the request represented by the |request| object.
///
/// WARNING: This function will fail with "bad IPC message" reason
/// INVALID_INITIATOR_ORIGIN (213) unless you first navigate to the request
/// origin using some other mechanism (LoadURL, link click, etc).
///
void(CEF_CALLBACK* load_request)(struct _cef_frame_t* self,
struct _cef_request_t* request);
///
// Load the specified |url|.
/// Load the specified |url|.
///
void(CEF_CALLBACK* load_url)(struct _cef_frame_t* self,
const cef_string_t* url);
///
// Execute a string of JavaScript code in this frame. The |script_url|
// parameter is the URL where the script in question can be found, if any. The
// renderer may request this URL to show the developer the source of the
// error. The |start_line| parameter is the base line number to use for error
// reporting.
/// Execute a string of JavaScript code in this frame. The |script_url|
/// parameter is the URL where the script in question can be found, if any.
/// The renderer may request this URL to show the developer the source of the
/// error. The |start_line| parameter is the base line number to use for
/// error reporting.
///
void(CEF_CALLBACK* execute_java_script)(struct _cef_frame_t* self,
const cef_string_t* code,
@@ -158,83 +158,78 @@ typedef struct _cef_frame_t {
int start_line);
///
// Returns true (1) if this is the main (top-level) frame.
/// Returns true (1) if this is the main (top-level) frame.
///
int(CEF_CALLBACK* is_main)(struct _cef_frame_t* self);
///
// Returns true (1) if this is the focused frame.
/// Returns true (1) if this is the focused frame.
///
int(CEF_CALLBACK* is_focused)(struct _cef_frame_t* self);
///
// Returns the name for this frame. If the frame has an assigned name (for
// example, set via the iframe "name" attribute) then that value will be
// returned. Otherwise a unique name will be constructed based on the frame
// parent hierarchy. The main (top-level) frame will always have an NULL name
// value.
/// Returns the name for this frame. If the frame has an assigned name (for
/// example, set via the iframe "name" attribute) then that value will be
/// returned. Otherwise a unique name will be constructed based on the frame
/// parent hierarchy. The main (top-level) frame will always have an NULL name
/// value.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_name)(struct _cef_frame_t* self);
///
// Returns the globally unique identifier for this frame or < 0 if the
// underlying frame does not yet exist.
/// Returns the globally unique identifier for this frame or NULL if the
/// underlying frame does not yet exist.
///
int64(CEF_CALLBACK* get_identifier)(struct _cef_frame_t* self);
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_identifier)(
struct _cef_frame_t* self);
///
// Returns the parent of this frame or NULL if this is the main (top-level)
// frame.
/// Returns the parent of this frame or NULL if this is the main (top-level)
/// frame.
///
struct _cef_frame_t*(CEF_CALLBACK* get_parent)(struct _cef_frame_t* self);
///
// Returns the URL currently loaded in this frame.
/// Returns the URL currently loaded in this frame.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_url)(struct _cef_frame_t* self);
///
// Returns the browser that this frame belongs to.
/// Returns the browser that this frame belongs to.
///
struct _cef_browser_t*(CEF_CALLBACK* get_browser)(struct _cef_frame_t* self);
///
// Get the V8 context associated with the frame. This function can only be
// called from the render process.
/// Get the V8 context associated with the frame. This function can only be
/// called from the render process.
///
struct _cef_v8context_t*(CEF_CALLBACK* get_v8context)(
struct _cef_frame_t* self);
///
// Visit the DOM document. This function can only be called from the render
// process.
/// Visit the DOM document. This function can only be called from the render
/// process.
///
void(CEF_CALLBACK* visit_dom)(struct _cef_frame_t* self,
struct _cef_domvisitor_t* visitor);
///
// Create a new URL request that will be treated as originating from this
// frame and the associated browser. This request may be intercepted by the
// client via cef_resource_request_handler_t or cef_scheme_handler_factory_t.
// Use cef_urlrequest_t::Create instead if you do not want the request to have
// this association, in which case it may be handled differently (see
// documentation on that function). Requests may originate from both the
// browser process and the render process.
//
// For requests originating from the browser process:
// - POST data may only contain a single element of type PDE_TYPE_FILE or
// PDE_TYPE_BYTES.
// For requests originating from the render process:
// - POST data may only contain a single element of type PDE_TYPE_BYTES.
// - If the response contains Content-Disposition or Mime-Type header values
// that would not normally be rendered then the response may receive
// special handling inside the browser (for example, via the file download
// code path instead of the URL request code path).
//
// The |request| object will be marked as read-only after calling this
// function.
/// Create a new URL request that will be treated as originating from this
/// frame and the associated browser. Use cef_urlrequest_t::Create instead if
/// you do not want the request to have this association, in which case it may
/// be handled differently (see documentation on that function). A request
/// created with this function may only originate from the browser process,
/// and will behave as follows:
/// - It may be intercepted by the client via CefResourceRequestHandler or
/// CefSchemeHandlerFactory.
/// - POST data may only contain a single element of type PDE_TYPE_FILE or
/// PDE_TYPE_BYTES.
///
/// The |request| object will be marked as read-only after calling this
/// function.
///
struct _cef_urlrequest_t*(CEF_CALLBACK* create_urlrequest)(
struct _cef_frame_t* self,
@@ -242,12 +237,12 @@ typedef struct _cef_frame_t {
struct _cef_urlrequest_client_t* client);
///
// Send a message to the specified |target_process|. Ownership of the message
// contents will be transferred and the |message| reference will be
// invalidated. Message delivery is not guaranteed in all cases (for example,
// if the browser is closing, navigating, or if the target process crashes).
// Send an ACK message back from the target process if confirmation is
// required.
/// Send a message to the specified |target_process|. Ownership of the message
/// contents will be transferred and the |message| reference will be
/// invalidated. Message delivery is not guaranteed in all cases (for example,
/// if the browser is closing, navigating, or if the target process crashes).
/// Send an ACK message back from the target process if confirmation is
/// required.
///
void(CEF_CALLBACK* send_process_message)(
struct _cef_frame_t* self,

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=8f791b2d1d5bea27f9e6ca5e0db731a0a76d181c$
// $hash=fc6fbee765ce2b649f5293c8c4b076d36014e4aa$
//
#ifndef CEF_INCLUDE_CAPI_CEF_FRAME_HANDLER_CAPI_H_
@@ -49,107 +49,106 @@ extern "C" {
#endif
///
// Implement this structure to handle events related to cef_frame_t life span.
// The order of callbacks is:
//
// (1) During initial cef_browser_host_t creation and navigation of the main
// frame: - cef_frame_handler_t::OnFrameCreated => The initial main frame object
// has been
// created. Any commands will be queued until the frame is attached.
// - cef_frame_handler_t::OnMainFrameChanged => The initial main frame object
// has
// been assigned to the browser.
// - cef_life_span_handler_t::OnAfterCreated => The browser is now valid and can
// be
// used.
// - cef_frame_handler_t::OnFrameAttached => The initial main frame object is
// now
// connected to its peer in the renderer process. Commands can be routed.
//
// (2) During further cef_browser_host_t navigation/loading of the main frame
// and/or sub-frames: - cef_frame_handler_t::OnFrameCreated => A new main frame
// or sub-frame object has
// been created. Any commands will be queued until the frame is attached.
// - cef_frame_handler_t::OnFrameAttached => A new main frame or sub-frame
// object is
// now connected to its peer in the renderer process. Commands can be routed.
// - cef_frame_handler_t::OnFrameDetached => An existing main frame or sub-frame
// object has lost its connection to the renderer process. If multiple objects
// are detached at the same time then notifications will be sent for any
// sub-frame objects before the main frame object. Commands can no longer be
// routed and will be discarded.
// - cef_frame_handler_t::OnMainFrameChanged => A new main frame object has been
// assigned to the browser. This will only occur with cross-origin navigation
// or re-navigation after renderer process termination (due to crashes, etc).
//
// (3) During final cef_browser_host_t destruction of the main frame: -
// cef_frame_handler_t::OnFrameDetached => Any sub-frame objects have lost their
// connection to the renderer process. Commands can no longer be routed and
// will be discarded.
// - cef_life_span_handler_t::OnBeforeClose => The browser has been destroyed. -
// cef_frame_handler_t::OnFrameDetached => The main frame object have lost its
// connection to the renderer process. Notifications will be sent for any
// sub-frame objects before the main frame object. Commands can no longer be
// routed and will be discarded.
// - cef_frame_handler_t::OnMainFrameChanged => The final main frame object has
// been
// removed from the browser.
//
// Cross-origin navigation and/or loading receives special handling.
//
// When the main frame navigates to a different origin the OnMainFrameChanged
// callback (2) will be executed with the old and new main frame objects.
//
// When a new sub-frame is loaded in, or an existing sub-frame is navigated to,
// a different origin from the parent frame, a temporary sub-frame object will
// first be created in the parent's renderer process. That temporary sub-frame
// will then be discarded after the real cross-origin sub-frame is created in
// the new/target renderer process. The client will receive cross-origin
// navigation callbacks (2) for the transition from the temporary sub-frame to
// the real sub-frame. The temporary sub-frame will not recieve or execute
// commands during this transitional period (any sent commands will be
// discarded).
//
// When a new popup browser is created in a different origin from the parent
// browser, a temporary main frame object for the popup will first be created in
// the parent's renderer process. That temporary main frame will then be
// discarded after the real cross-origin main frame is created in the new/target
// renderer process. The client will recieve creation and initial navigation
// callbacks (1) for the temporary main frame, followed by cross-origin
// navigation callbacks (2) for the transition from the temporary main frame to
// the real main frame. The temporary main frame may receive and execute
// commands during this transitional period (any sent commands may be executed,
// but the behavior is potentially undesirable since they execute in the parent
// browser's renderer process and not the new/target renderer process).
//
// Callbacks will not be executed for placeholders that may be created during
// pre-commit navigation for sub-frames that do not yet exist in the renderer
// process. Placeholders will have cef_frame_t::get_identifier() == -4.
//
// The functions of this structure will be called on the UI thread unless
// otherwise indicated.
/// Implement this structure to handle events related to cef_frame_t life span.
/// The order of callbacks is:
///
/// (1) During initial cef_browser_host_t creation and navigation of the main
/// frame:
/// - cef_frame_handler_t::OnFrameCreated => The initial main frame object has
/// been created. Any commands will be queued until the frame is attached.
/// - cef_frame_handler_t::OnMainFrameChanged => The initial main frame object
/// has been assigned to the browser.
/// - cef_life_span_handler_t::OnAfterCreated => The browser is now valid and
/// can be used.
/// - cef_frame_handler_t::OnFrameAttached => The initial main frame object is
/// now connected to its peer in the renderer process. Commands can be routed.
///
/// (2) During further cef_browser_host_t navigation/loading of the main frame
/// and/or sub-frames:
/// - cef_frame_handler_t::OnFrameCreated => A new main frame or sub-frame
/// object has been created. Any commands will be queued until the frame is
/// attached.
/// - cef_frame_handler_t::OnFrameAttached => A new main frame or sub-frame
/// object is now connected to its peer in the renderer process. Commands can
/// be routed.
/// - cef_frame_handler_t::OnFrameDetached => An existing main frame or sub-
/// frame object has lost its connection to the renderer process. If multiple
/// objects are detached at the same time then notifications will be sent for
/// any sub-frame objects before the main frame object. Commands can no longer
/// be routed and will be discarded.
/// - cef_frame_handler_t::OnMainFrameChanged => A new main frame object has
/// been assigned to the browser. This will only occur with cross-origin
/// navigation or re-navigation after renderer process termination (due to
/// crashes, etc).
///
/// (3) During final cef_browser_host_t destruction of the main frame:
/// - cef_frame_handler_t::OnFrameDetached => Any sub-frame objects have lost
/// their connection to the renderer process. Commands can no longer be routed
/// and will be discarded.
/// - cef_life_span_handler_t::OnBeforeClose => The browser has been destroyed.
/// - cef_frame_handler_t::OnFrameDetached => The main frame object have lost
/// its connection to the renderer process. Notifications will be sent for any
/// sub-frame objects before the main frame object. Commands can no longer be
/// routed and will be discarded.
/// - cef_frame_handler_t::OnMainFrameChanged => The final main frame object has
/// been removed from the browser.
///
/// Cross-origin navigation and/or loading receives special handling.
///
/// When the main frame navigates to a different origin the OnMainFrameChanged
/// callback (2) will be executed with the old and new main frame objects.
///
/// When a new sub-frame is loaded in, or an existing sub-frame is navigated to,
/// a different origin from the parent frame, a temporary sub-frame object will
/// first be created in the parent's renderer process. That temporary sub-frame
/// will then be discarded after the real cross-origin sub-frame is created in
/// the new/target renderer process. The client will receive cross-origin
/// navigation callbacks (2) for the transition from the temporary sub-frame to
/// the real sub-frame. The temporary sub-frame will not receive or execute
/// commands during this transitional period (any sent commands will be
/// discarded).
///
/// When a new popup browser is created in a different origin from the parent
/// browser, a temporary main frame object for the popup will first be created
/// in the parent's renderer process. That temporary main frame will then be
/// discarded after the real cross-origin main frame is created in the
/// new/target renderer process. The client will receive creation and initial
/// navigation callbacks (1) for the temporary main frame, followed by cross-
/// origin navigation callbacks (2) for the transition from the temporary main
/// frame to the real main frame. The temporary main frame may receive and
/// execute commands during this transitional period (any sent commands may be
/// executed, but the behavior is potentially undesirable since they execute in
/// the parent browser's renderer process and not the new/target renderer
/// process).
///
/// Callbacks will not be executed for placeholders that may be created during
/// pre-commit navigation for sub-frames that do not yet exist in the renderer
/// process. Placeholders will have cef_frame_t::get_identifier() == -4.
///
/// The functions of this structure will be called on the UI thread unless
/// otherwise indicated.
///
typedef struct _cef_frame_handler_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Called when a new frame is created. This will be the first notification
// that references |frame|. Any commands that require transport to the
// associated renderer process (LoadRequest, SendProcessMessage, GetSource,
// etc.) will be queued until OnFrameAttached is called for |frame|.
/// Called when a new frame is created. This will be the first notification
/// that references |frame|. Any commands that require transport to the
/// associated renderer process (LoadRequest, SendProcessMessage, GetSource,
/// etc.) will be queued until OnFrameAttached is called for |frame|.
///
void(CEF_CALLBACK* on_frame_created)(struct _cef_frame_handler_t* self,
struct _cef_browser_t* browser,
struct _cef_frame_t* frame);
///
// Called when a frame can begin routing commands to/from the associated
// renderer process. |reattached| will be true (1) if the frame was re-
// attached after exiting the BackForwardCache. Any commands that were queued
// have now been dispatched.
/// Called when a frame can begin routing commands to/from the associated
/// renderer process. |reattached| will be true (1) if the frame was re-
/// attached after exiting the BackForwardCache. Any commands that were queued
/// have now been dispatched.
///
void(CEF_CALLBACK* on_frame_attached)(struct _cef_frame_handler_t* self,
struct _cef_browser_t* browser,
@@ -157,29 +156,31 @@ typedef struct _cef_frame_handler_t {
int reattached);
///
// Called when a frame loses its connection to the renderer process and will
// be destroyed. Any pending or future commands will be discarded and
// cef_frame_t::is_valid() will now return false (0) for |frame|. If called
// after cef_life_span_handler_t::on_before_close() during browser destruction
// then cef_browser_t::is_valid() will return false (0) for |browser|.
/// Called when a frame loses its connection to the renderer process and will
/// be destroyed. Any pending or future commands will be discarded and
/// cef_frame_t::is_valid() will now return false (0) for |frame|. If called
/// after cef_life_span_handler_t::on_before_close() during browser
/// destruction then cef_browser_t::is_valid() will return false (0) for
/// |browser|.
///
void(CEF_CALLBACK* on_frame_detached)(struct _cef_frame_handler_t* self,
struct _cef_browser_t* browser,
struct _cef_frame_t* frame);
///
// Called when the main frame changes due to (a) initial browser creation, (b)
// final browser destruction, (c) cross-origin navigation or (d) re-navigation
// after renderer process termination (due to crashes, etc). |old_frame| will
// be NULL and |new_frame| will be non-NULL when a main frame is assigned to
// |browser| for the first time. |old_frame| will be non-NULL and |new_frame|
// will be NULL and when a main frame is removed from |browser| for the last
// time. Both |old_frame| and |new_frame| will be non-NULL for cross-origin
// navigations or re-navigation after renderer process termination. This
// function will be called after on_frame_created() for |new_frame| and/or
// after on_frame_detached() for |old_frame|. If called after
// cef_life_span_handler_t::on_before_close() during browser destruction then
// cef_browser_t::is_valid() will return false (0) for |browser|.
/// Called when the main frame changes due to (a) initial browser creation,
/// (b) final browser destruction, (c) cross-origin navigation or (d) re-
/// navigation after renderer process termination (due to crashes, etc).
/// |old_frame| will be NULL and |new_frame| will be non-NULL when a main
/// frame is assigned to |browser| for the first time. |old_frame| will be
/// non-NULL and |new_frame| will be NULL and when a main frame is removed
/// from |browser| for the last time. Both |old_frame| and |new_frame| will be
/// non-NULL for cross-origin navigations or re-navigation after renderer
/// process termination. This function will be called after on_frame_created()
/// for |new_frame| and/or after on_frame_detached() for |old_frame|. If
/// called after cef_life_span_handler_t::on_before_close() during browser
/// destruction then cef_browser_t::is_valid() will return false (0) for
/// |browser|.
///
void(CEF_CALLBACK* on_main_frame_changed)(struct _cef_frame_handler_t* self,
struct _cef_browser_t* browser,

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=c063e5f0e0c9fef71bdb56e7cc3ea775de17a3ea$
// $hash=990e80ab5ae04298e6b70cbc0a67115825563251$
//
#ifndef CEF_INCLUDE_CAPI_CEF_I18N_UTIL_CAPI_H_
@@ -47,7 +47,7 @@ extern "C" {
#endif
///
// Returns true (1) if the application text direction is right-to-left.
/// Returns true (1) if the application text direction is right-to-left.
///
CEF_EXPORT int cef_is_rtl(void);

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=bbc87eb4ecaf92c900193afef7059caedbe8ab3a$
// $hash=7512ccf755017d5b1866b753890b498e8163006d$
//
#ifndef CEF_INCLUDE_CAPI_CEF_IMAGE_CAPI_H_
@@ -48,37 +48,37 @@ extern "C" {
#endif
///
// Container for a single image represented at different scale factors. All
// image representations should be the same size in density independent pixel
// (DIP) units. For example, if the image at scale factor 1.0 is 100x100 pixels
// then the image at scale factor 2.0 should be 200x200 pixels -- both images
// will display with a DIP size of 100x100 units. The functions of this
// structure can be called on any browser process thread.
/// Container for a single image represented at different scale factors. All
/// image representations should be the same size in density independent pixel
/// (DIP) units. For example, if the image at scale factor 1.0 is 100x100 pixels
/// then the image at scale factor 2.0 should be 200x200 pixels -- both images
/// will display with a DIP size of 100x100 units. The functions of this
/// structure can be called on any browser process thread.
///
typedef struct _cef_image_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Returns true (1) if this Image is NULL.
/// Returns true (1) if this Image is NULL.
///
int(CEF_CALLBACK* is_empty)(struct _cef_image_t* self);
///
// Returns true (1) if this Image and |that| Image share the same underlying
// storage. Will also return true (1) if both images are NULL.
/// Returns true (1) if this Image and |that| Image share the same underlying
/// storage. Will also return true (1) if both images are NULL.
///
int(CEF_CALLBACK* is_same)(struct _cef_image_t* self,
struct _cef_image_t* that);
///
// Add a bitmap image representation for |scale_factor|. Only 32-bit RGBA/BGRA
// formats are supported. |pixel_width| and |pixel_height| are the bitmap
// representation size in pixel coordinates. |pixel_data| is the array of
// pixel data and should be |pixel_width| x |pixel_height| x 4 bytes in size.
// |color_type| and |alpha_type| values specify the pixel format.
/// Add a bitmap image representation for |scale_factor|. Only 32-bit
/// RGBA/BGRA formats are supported. |pixel_width| and |pixel_height| are the
/// bitmap representation size in pixel coordinates. |pixel_data| is the array
/// of pixel data and should be |pixel_width| x |pixel_height| x 4 bytes in
/// size. |color_type| and |alpha_type| values specify the pixel format.
///
int(CEF_CALLBACK* add_bitmap)(struct _cef_image_t* self,
float scale_factor,
@@ -90,9 +90,9 @@ typedef struct _cef_image_t {
size_t pixel_data_size);
///
// Add a PNG image representation for |scale_factor|. |png_data| is the image
// data of size |png_data_size|. Any alpha transparency in the PNG data will
// be maintained.
/// Add a PNG image representation for |scale_factor|. |png_data| is the image
/// data of size |png_data_size|. Any alpha transparency in the PNG data will
/// be maintained.
///
int(CEF_CALLBACK* add_png)(struct _cef_image_t* self,
float scale_factor,
@@ -100,9 +100,9 @@ typedef struct _cef_image_t {
size_t png_data_size);
///
// Create a JPEG image representation for |scale_factor|. |jpeg_data| is the
// image data of size |jpeg_data_size|. The JPEG format does not support
// transparency so the alpha byte will be set to 0xFF for all pixels.
/// Create a JPEG image representation for |scale_factor|. |jpeg_data| is the
/// image data of size |jpeg_data_size|. The JPEG format does not support
/// transparency so the alpha byte will be set to 0xFF for all pixels.
///
int(CEF_CALLBACK* add_jpeg)(struct _cef_image_t* self,
float scale_factor,
@@ -110,33 +110,34 @@ typedef struct _cef_image_t {
size_t jpeg_data_size);
///
// Returns the image width in density independent pixel (DIP) units.
/// Returns the image width in density independent pixel (DIP) units.
///
size_t(CEF_CALLBACK* get_width)(struct _cef_image_t* self);
///
// Returns the image height in density independent pixel (DIP) units.
/// Returns the image height in density independent pixel (DIP) units.
///
size_t(CEF_CALLBACK* get_height)(struct _cef_image_t* self);
///
// Returns true (1) if this image contains a representation for
// |scale_factor|.
/// Returns true (1) if this image contains a representation for
/// |scale_factor|.
///
int(CEF_CALLBACK* has_representation)(struct _cef_image_t* self,
float scale_factor);
///
// Removes the representation for |scale_factor|. Returns true (1) on success.
/// Removes the representation for |scale_factor|. Returns true (1) on
/// success.
///
int(CEF_CALLBACK* remove_representation)(struct _cef_image_t* self,
float scale_factor);
///
// Returns information for the representation that most closely matches
// |scale_factor|. |actual_scale_factor| is the actual scale factor for the
// representation. |pixel_width| and |pixel_height| are the representation
// size in pixel coordinates. Returns true (1) on success.
/// Returns information for the representation that most closely matches
/// |scale_factor|. |actual_scale_factor| is the actual scale factor for the
/// representation. |pixel_width| and |pixel_height| are the representation
/// size in pixel coordinates. Returns true (1) on success.
///
int(CEF_CALLBACK* get_representation_info)(struct _cef_image_t* self,
float scale_factor,
@@ -145,12 +146,12 @@ typedef struct _cef_image_t {
int* pixel_height);
///
// Returns the bitmap representation that most closely matches |scale_factor|.
// Only 32-bit RGBA/BGRA formats are supported. |color_type| and |alpha_type|
// values specify the desired output pixel format. |pixel_width| and
// |pixel_height| are the output representation size in pixel coordinates.
// Returns a cef_binary_value_t containing the pixel data on success or NULL
// on failure.
/// Returns the bitmap representation that most closely matches
/// |scale_factor|. Only 32-bit RGBA/BGRA formats are supported. |color_type|
/// and |alpha_type| values specify the desired output pixel format.
/// |pixel_width| and |pixel_height| are the output representation size in
/// pixel coordinates. Returns a cef_binary_value_t containing the pixel data
/// on success or NULL on failure.
///
struct _cef_binary_value_t*(CEF_CALLBACK* get_as_bitmap)(
struct _cef_image_t* self,
@@ -161,12 +162,12 @@ typedef struct _cef_image_t {
int* pixel_height);
///
// Returns the PNG representation that most closely matches |scale_factor|. If
// |with_transparency| is true (1) any alpha transparency in the image will be
// represented in the resulting PNG data. |pixel_width| and |pixel_height| are
// the output representation size in pixel coordinates. Returns a
// cef_binary_value_t containing the PNG image data on success or NULL on
// failure.
/// Returns the PNG representation that most closely matches |scale_factor|.
/// If |with_transparency| is true (1) any alpha transparency in the image
/// will be represented in the resulting PNG data. |pixel_width| and
/// |pixel_height| are the output representation size in pixel coordinates.
/// Returns a cef_binary_value_t containing the PNG image data on success or
/// NULL on failure.
///
struct _cef_binary_value_t*(CEF_CALLBACK* get_as_png)(
struct _cef_image_t* self,
@@ -176,13 +177,13 @@ typedef struct _cef_image_t {
int* pixel_height);
///
// Returns the JPEG representation that most closely matches |scale_factor|.
// |quality| determines the compression level with 0 == lowest and 100 ==
// highest. The JPEG format does not support alpha transparency and the alpha
// channel, if any, will be discarded. |pixel_width| and |pixel_height| are
// the output representation size in pixel coordinates. Returns a
// cef_binary_value_t containing the JPEG image data on success or NULL on
// failure.
/// Returns the JPEG representation that most closely matches |scale_factor|.
/// |quality| determines the compression level with 0 == lowest and 100 ==
/// highest. The JPEG format does not support alpha transparency and the alpha
/// channel, if any, will be discarded. |pixel_width| and |pixel_height| are
/// the output representation size in pixel coordinates. Returns a
/// cef_binary_value_t containing the JPEG image data on success or NULL on
/// failure.
///
struct _cef_binary_value_t*(CEF_CALLBACK* get_as_jpeg)(
struct _cef_image_t* self,
@@ -193,8 +194,8 @@ typedef struct _cef_image_t {
} cef_image_t;
///
// Create a new cef_image_t. It will initially be NULL. Use the Add*() functions
// to add representations at different scale factors.
/// Create a new cef_image_t. It will initially be NULL. Use the Add*()
/// functions to add representations at different scale factors.
///
CEF_EXPORT cef_image_t* cef_image_create(void);

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=c68332a779bab425aa2e6a858d20a43448631890$
// $hash=c6810367ba3a17824247dcb17f87040cd021c295$
//
#ifndef CEF_INCLUDE_CAPI_CEF_JSDIALOG_HANDLER_CAPI_H_
@@ -48,18 +48,19 @@ extern "C" {
#endif
///
// Callback structure used for asynchronous continuation of JavaScript dialog
// requests.
/// Callback structure used for asynchronous continuation of JavaScript dialog
/// requests.
///
typedef struct _cef_jsdialog_callback_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Continue the JS dialog request. Set |success| to true (1) if the OK button
// was pressed. The |user_input| value should be specified for prompt dialogs.
/// Continue the JS dialog request. Set |success| to true (1) if the OK button
/// was pressed. The |user_input| value should be specified for prompt
/// dialogs.
///
void(CEF_CALLBACK* cont)(struct _cef_jsdialog_callback_t* self,
int success,
@@ -67,31 +68,31 @@ typedef struct _cef_jsdialog_callback_t {
} cef_jsdialog_callback_t;
///
// Implement this structure to handle events related to JavaScript dialogs. The
// functions of this structure will be called on the UI thread.
/// Implement this structure to handle events related to JavaScript dialogs. The
/// functions of this structure will be called on the UI thread.
///
typedef struct _cef_jsdialog_handler_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Called to run a JavaScript dialog. If |origin_url| is non-NULL it can be
// passed to the CefFormatUrlForSecurityDisplay function to retrieve a secure
// and user-friendly display string. The |default_prompt_text| value will be
// specified for prompt dialogs only. Set |suppress_message| to true (1) and
// return false (0) to suppress the message (suppressing messages is
// preferable to immediately executing the callback as this is used to detect
// presumably malicious behavior like spamming alert messages in
// onbeforeunload). Set |suppress_message| to false (0) and return false (0)
// to use the default implementation (the default implementation will show one
// modal dialog at a time and suppress any additional dialog requests until
// the displayed dialog is dismissed). Return true (1) if the application will
// use a custom dialog or if the callback has been executed immediately.
// Custom dialogs may be either modal or modeless. If a custom dialog is used
// the application must execute |callback| once the custom dialog is
// dismissed.
/// Called to run a JavaScript dialog. If |origin_url| is non-NULL it can be
/// passed to the CefFormatUrlForSecurityDisplay function to retrieve a secure
/// and user-friendly display string. The |default_prompt_text| value will be
/// specified for prompt dialogs only. Set |suppress_message| to true (1) and
/// return false (0) to suppress the message (suppressing messages is
/// preferable to immediately executing the callback as this is used to detect
/// presumably malicious behavior like spamming alert messages in
/// onbeforeunload). Set |suppress_message| to false (0) and return false (0)
/// to use the default implementation (the default implementation will show
/// one modal dialog at a time and suppress any additional dialog requests
/// until the displayed dialog is dismissed). Return true (1) if the
/// application will use a custom dialog or if the callback has been executed
/// immediately. Custom dialogs may be either modal or modeless. If a custom
/// dialog is used the application must execute |callback| once the custom
/// dialog is dismissed.
///
int(CEF_CALLBACK* on_jsdialog)(struct _cef_jsdialog_handler_t* self,
struct _cef_browser_t* browser,
@@ -103,12 +104,12 @@ typedef struct _cef_jsdialog_handler_t {
int* suppress_message);
///
// Called to run a dialog asking the user if they want to leave a page. Return
// false (0) to use the default dialog implementation. Return true (1) if the
// application will use a custom dialog or if the callback has been executed
// immediately. Custom dialogs may be either modal or modeless. If a custom
// dialog is used the application must execute |callback| once the custom
// dialog is dismissed.
/// Called to run a dialog asking the user if they want to leave a page.
/// Return false (0) to use the default dialog implementation. Return true (1)
/// if the application will use a custom dialog or if the callback has been
/// executed immediately. Custom dialogs may be either modal or modeless. If a
/// custom dialog is used the application must execute |callback| once the
/// custom dialog is dismissed.
///
int(CEF_CALLBACK* on_before_unload_dialog)(
struct _cef_jsdialog_handler_t* self,
@@ -118,16 +119,16 @@ typedef struct _cef_jsdialog_handler_t {
struct _cef_jsdialog_callback_t* callback);
///
// Called to cancel any pending dialogs and reset any saved dialog state. Will
// be called due to events like page navigation irregardless of whether any
// dialogs are currently pending.
/// Called to cancel any pending dialogs and reset any saved dialog state.
/// Will be called due to events like page navigation irregardless of whether
/// any dialogs are currently pending.
///
void(CEF_CALLBACK* on_reset_dialog_state)(
struct _cef_jsdialog_handler_t* self,
struct _cef_browser_t* browser);
///
// Called when the default implementation dialog is closed.
/// Called when the dialog is closed.
///
void(CEF_CALLBACK* on_dialog_closed)(struct _cef_jsdialog_handler_t* self,
struct _cef_browser_t* browser);

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=140d3a3ce78f5e8ab50a24a2fd6377e7a8ea3256$
// $hash=0bfe161c51cc6378b2e8e2e2b2c017b750b46864$
//
#ifndef CEF_INCLUDE_CAPI_CEF_KEYBOARD_HANDLER_CAPI_H_
@@ -48,37 +48,38 @@ extern "C" {
#endif
///
// Implement this structure to handle events related to keyboard input. The
// functions of this structure will be called on the UI thread.
/// Implement this structure to handle events related to keyboard input. The
/// functions of this structure will be called on the UI thread.
///
typedef struct _cef_keyboard_handler_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Called before a keyboard event is sent to the renderer. |event| contains
// information about the keyboard event. |os_event| is the operating system
// event message, if any. Return true (1) if the event was handled or false
// (0) otherwise. If the event will be handled in on_key_event() as a keyboard
// shortcut set |is_keyboard_shortcut| to true (1) and return false (0).
/// Called before a keyboard event is sent to the renderer. |event| contains
/// information about the keyboard event. |os_event| is the operating system
/// event message, if any. Return true (1) if the event was handled or false
/// (0) otherwise. If the event will be handled in on_key_event() as a
/// keyboard shortcut set |is_keyboard_shortcut| to true (1) and return false
/// (0).
///
int(CEF_CALLBACK* on_pre_key_event)(struct _cef_keyboard_handler_t* self,
struct _cef_browser_t* browser,
const struct _cef_key_event_t* event,
const cef_key_event_t* event,
cef_event_handle_t os_event,
int* is_keyboard_shortcut);
///
// Called after the renderer and JavaScript in the page has had a chance to
// handle the event. |event| contains information about the keyboard event.
// |os_event| is the operating system event message, if any. Return true (1)
// if the keyboard event was handled or false (0) otherwise.
/// Called after the renderer and JavaScript in the page has had a chance to
/// handle the event. |event| contains information about the keyboard event.
/// |os_event| is the operating system event message, if any. Return true (1)
/// if the keyboard event was handled or false (0) otherwise.
///
int(CEF_CALLBACK* on_key_event)(struct _cef_keyboard_handler_t* self,
struct _cef_browser_t* browser,
const struct _cef_key_event_t* event,
const cef_key_event_t* event,
cef_event_handle_t os_event);
} cef_keyboard_handler_t;

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=34a6559587adbd0dc3143989a8c6e49e0664b43e$
// $hash=6aad2ccf30a6c519bbeee64d83866e82a41a48d8$
//
#ifndef CEF_INCLUDE_CAPI_CEF_LIFE_SPAN_HANDLER_CAPI_H_
@@ -50,40 +50,40 @@ extern "C" {
struct _cef_client_t;
///
// Implement this structure to handle events related to browser life span. The
// functions of this structure will be called on the UI thread unless otherwise
// indicated.
/// Implement this structure to handle events related to browser life span. The
/// functions of this structure will be called on the UI thread unless otherwise
/// indicated.
///
typedef struct _cef_life_span_handler_t {
///
// Base structure.
/// Base structure.
///
cef_base_ref_counted_t base;
///
// Called on the UI thread before a new popup browser is created. The
// |browser| and |frame| values represent the source of the popup request. The
// |target_url| and |target_frame_name| values indicate where the popup
// browser should navigate and may be NULL if not specified with the request.
// The |target_disposition| value indicates where the user intended to open
// the popup (e.g. current tab, new tab, etc). The |user_gesture| value will
// be true (1) if the popup was opened via explicit user gesture (e.g.
// clicking a link) or false (0) if the popup opened automatically (e.g. via
// the DomContentLoaded event). The |popupFeatures| structure contains
// additional information about the requested popup window. To allow creation
// of the popup browser optionally modify |windowInfo|, |client|, |settings|
// and |no_javascript_access| and return false (0). To cancel creation of the
// popup browser return true (1). The |client| and |settings| values will
// default to the source browser's values. If the |no_javascript_access| value
// is set to false (0) the new browser will not be scriptable and may not be
// hosted in the same renderer process as the source browser. Any
// modifications to |windowInfo| will be ignored if the parent browser is
// wrapped in a cef_browser_view_t. Popup browser creation will be canceled if
// the parent browser is destroyed before the popup browser creation completes
// (indicated by a call to OnAfterCreated for the popup browser). The
// |extra_info| parameter provides an opportunity to specify extra information
// specific to the created popup browser that will be passed to
// cef_render_process_handler_t::on_browser_created() in the render process.
/// Called on the UI thread before a new popup browser is created. The
/// |browser| and |frame| values represent the source of the popup request.
/// The |target_url| and |target_frame_name| values indicate where the popup
/// browser should navigate and may be NULL if not specified with the request.
/// The |target_disposition| value indicates where the user intended to open
/// the popup (e.g. current tab, new tab, etc). The |user_gesture| value will
/// be true (1) if the popup was opened via explicit user gesture (e.g.
/// clicking a link) or false (0) if the popup opened automatically (e.g. via
/// the DomContentLoaded event). The |popupFeatures| structure contains
/// additional information about the requested popup window. To allow creation
/// of the popup browser optionally modify |windowInfo|, |client|, |settings|
/// and |no_javascript_access| and return false (0). To cancel creation of the
/// popup browser return true (1). The |client| and |settings| values will
/// default to the source browser's values. If the |no_javascript_access|
/// value is set to false (0) the new browser will not be scriptable and may
/// not be hosted in the same renderer process as the source browser. Any
/// modifications to |windowInfo| will be ignored if the parent browser is
/// wrapped in a cef_browser_view_t. Popup browser creation will be canceled
/// if the parent browser is destroyed before the popup browser creation
/// completes (indicated by a call to OnAfterCreated for the popup browser).
/// The |extra_info| parameter provides an opportunity to specify extra
/// information specific to the created popup browser that will be passed to
/// cef_render_process_handler_t::on_browser_created() in the render process.
///
int(CEF_CALLBACK* on_before_popup)(
struct _cef_life_span_handler_t* self,
@@ -93,7 +93,7 @@ typedef struct _cef_life_span_handler_t {
const cef_string_t* target_frame_name,
cef_window_open_disposition_t target_disposition,
int user_gesture,
const struct _cef_popup_features_t* popupFeatures,
const cef_popup_features_t* popupFeatures,
struct _cef_window_info_t* windowInfo,
struct _cef_client_t** client,
struct _cef_browser_settings_t* settings,
@@ -101,117 +101,163 @@ typedef struct _cef_life_span_handler_t {
int* no_javascript_access);
///
// Called after a new browser is created. It is now safe to begin performing
// actions with |browser|. cef_frame_handler_t callbacks related to initial
// main frame creation will arrive before this callback. See
// cef_frame_handler_t documentation for additional usage information.
/// Called on the UI thread before a new DevTools popup browser is created.
/// The |browser| value represents the source of the popup request. Optionally
/// modify |windowInfo|, |client|, |settings| and |extra_info| values. The
/// |client|, |settings| and |extra_info| values will default to the source
/// browser's values. Any modifications to |windowInfo| will be ignored if the
/// parent browser is Views-hosted (wrapped in a cef_browser_view_t).
///
/// The |extra_info| parameter provides an opportunity to specify extra
/// information specific to the created popup browser that will be passed to
/// cef_render_process_handler_t::on_browser_created() in the render process.
/// The existing |extra_info| object, if any, will be read-only but may be
/// replaced with a new object.
///
/// Views-hosted source browsers will create Views-hosted DevTools popups
/// unless |use_default_window| is set to to true (1). DevTools popups can be
/// blocked by returning true (1) from cef_command_handler_t::OnChromeCommand
/// for IDC_DEV_TOOLS. Only used with Chrome style.
///
void(CEF_CALLBACK* on_before_dev_tools_popup)(
struct _cef_life_span_handler_t* self,
struct _cef_browser_t* browser,
struct _cef_window_info_t* windowInfo,
struct _cef_client_t** client,
struct _cef_browser_settings_t* settings,
struct _cef_dictionary_value_t** extra_info,
int* use_default_window);
///
/// Called after a new browser is created. It is now safe to begin performing
/// actions with |browser|. cef_frame_handler_t callbacks related to initial
/// main frame creation will arrive before this callback. See
/// cef_frame_handler_t documentation for additional usage information.
///
void(CEF_CALLBACK* on_after_created)(struct _cef_life_span_handler_t* self,
struct _cef_browser_t* browser);
///
// Called when a browser has recieved a request to close. This may result
// directly from a call to cef_browser_host_t::*close_browser() or indirectly
// if the browser is parented to a top-level window created by CEF and the
// user attempts to close that window (by clicking the 'X', for example). The
// do_close() function will be called after the JavaScript 'onunload' event
// has been fired.
//
// An application should handle top-level owner window close notifications by
// calling cef_browser_host_t::try_close_browser() or
// cef_browser_host_t::CloseBrowser(false (0)) instead of allowing the window
// to close immediately (see the examples below). This gives CEF an
// opportunity to process the 'onbeforeunload' event and optionally cancel the
// close before do_close() is called.
//
// When windowed rendering is enabled CEF will internally create a window or
// view to host the browser. In that case returning false (0) from do_close()
// will send the standard close notification to the browser's top-level owner
// window (e.g. WM_CLOSE on Windows, performClose: on OS X, "delete_event" on
// Linux or cef_window_delegate_t::can_close() callback from Views). If the
// browser's host window/view has already been destroyed (via view hierarchy
// tear-down, for example) then do_close() will not be called for that browser
// since is no longer possible to cancel the close.
//
// When windowed rendering is disabled returning false (0) from do_close()
// will cause the browser object to be destroyed immediately.
//
// If the browser's top-level owner window requires a non-standard close
// notification then send that notification from do_close() and return true
// (1).
//
// The cef_life_span_handler_t::on_before_close() function will be called
// after do_close() (if do_close() is called) and immediately before the
// browser object is destroyed. The application should only exit after
// on_before_close() has been called for all existing browsers.
//
// The below examples describe what should happen during window close when the
// browser is parented to an application-provided top-level window.
//
// Example 1: Using cef_browser_host_t::try_close_browser(). This is
// recommended for clients using standard close handling and windows created
// on the browser process UI thread. 1. User clicks the window close button
// which sends a close notification to
// the application's top-level window.
// 2. Application's top-level window receives the close notification and
// calls TryCloseBrowser() (which internally calls CloseBrowser(false)).
// TryCloseBrowser() returns false so the client cancels the window close.
// 3. JavaScript 'onbeforeunload' handler executes and shows the close
// confirmation dialog (which can be overridden via
// CefJSDialogHandler::OnBeforeUnloadDialog()).
// 4. User approves the close. 5. JavaScript 'onunload' handler executes. 6.
// CEF sends a close notification to the application's top-level window
// (because DoClose() returned false by default).
// 7. Application's top-level window receives the close notification and
// calls TryCloseBrowser(). TryCloseBrowser() returns true so the client
// allows the window close.
// 8. Application's top-level window is destroyed. 9. Application's
// on_before_close() handler is called and the browser object
// is destroyed.
// 10. Application exits by calling cef_quit_message_loop() if no other
// browsers
// exist.
//
// Example 2: Using cef_browser_host_t::CloseBrowser(false (0)) and
// implementing the do_close() callback. This is recommended for clients using
// non-standard close handling or windows that were not created on the browser
// process UI thread. 1. User clicks the window close button which sends a
// close notification to
// the application's top-level window.
// 2. Application's top-level window receives the close notification and:
// A. Calls CefBrowserHost::CloseBrowser(false).
// B. Cancels the window close.
// 3. JavaScript 'onbeforeunload' handler executes and shows the close
// confirmation dialog (which can be overridden via
// CefJSDialogHandler::OnBeforeUnloadDialog()).
// 4. User approves the close. 5. JavaScript 'onunload' handler executes. 6.
// Application's do_close() handler is called. Application will:
// A. Set a flag to indicate that the next close attempt will be allowed.
// B. Return false.
// 7. CEF sends an close notification to the application's top-level window.
// 8. Application's top-level window receives the close notification and
// allows the window to close based on the flag from #6B.
// 9. Application's top-level window is destroyed. 10. Application's
// on_before_close() handler is called and the browser object
// is destroyed.
// 11. Application exits by calling cef_quit_message_loop() if no other
// browsers
// exist.
/// Called when an Alloy style browser is ready to be closed, meaning that the
/// close has already been initiated and that JavaScript unload handlers have
/// already executed or should be ignored. This may result directly from a
/// call to cef_browser_host_t::[Try]close_browser() or indirectly if the
/// browser's top-level parent window was created by CEF and the user attempts
/// to close that window (by clicking the 'X', for example). do_close() will
/// not be called if the browser's host window/view has already been destroyed
/// (via parent window/view hierarchy tear-down, for example), as it is no
/// longer possible to customize the close behavior at that point.
///
/// An application should handle top-level parent window close notifications
/// by calling cef_browser_host_t::try_close_browser() or
/// cef_browser_host_t::CloseBrowser(false (0)) instead of allowing the window
/// to close immediately (see the examples below). This gives CEF an
/// opportunity to process JavaScript unload handlers and optionally cancel
/// the close before do_close() is called.
///
/// When windowed rendering is enabled CEF will create an internal child
/// window/view to host the browser. In that case returning false (0) from
/// do_close() will send the standard close notification to the browser's top-
/// level parent window (e.g. WM_CLOSE on Windows, performClose: on OS X,
/// "delete_event" on Linux or cef_window_delegate_t::can_close() callback
/// from Views).
///
/// When windowed rendering is disabled there is no internal window/view and
/// returning false (0) from do_close() will cause the browser object to be
/// destroyed immediately.
///
/// If the browser's top-level parent window requires a non-standard close
/// notification then send that notification from do_close() and return true
/// (1). You are still required to complete the browser close as soon as
/// possible (either by calling [Try]close_browser() or by proceeding with
/// window/view hierarchy tear-down), otherwise the browser will be left in a
/// partially closed state that interferes with proper functioning. Top-level
/// windows created on the browser process UI thread can alternately call
/// cef_browser_host_t::is_ready_to_be_closed() in the close handler to check
/// close status instead of relying on custom do_close() handling. See
/// documentation on that function for additional details.
///
/// The cef_life_span_handler_t::on_before_close() function will be called
/// after do_close() (if do_close() is called) and immediately before the
/// browser object is destroyed. The application should only exit after
/// on_before_close() has been called for all existing browsers.
///
/// The below examples describe what should happen during window close when
/// the browser is parented to an application-provided top-level window.
///
/// Example 1: Using cef_browser_host_t::try_close_browser(). This is
/// recommended for clients using standard close handling and windows created
/// on the browser process UI thread. 1. User clicks the window close button
/// which sends a close notification
/// to the application's top-level window.
/// 2. Application's top-level window receives the close notification and
/// calls TryCloseBrowser() (similar to calling CloseBrowser(false)).
/// TryCloseBrowser() returns false so the client cancels the window
/// close.
/// 3. JavaScript 'onbeforeunload' handler executes and shows the close
/// confirmation dialog (which can be overridden via
/// CefJSDialogHandler::OnBeforeUnloadDialog()).
/// 4. User approves the close. 5. JavaScript 'onunload' handler executes.
/// 6. Application's do_close() handler is called and returns false (0) by
/// default.
/// 7. CEF sends a close notification to the application's top-level window
/// (because DoClose() returned false).
/// 8. Application's top-level window receives the close notification and
/// calls TryCloseBrowser(). TryCloseBrowser() returns true so the client
/// allows the window close.
/// 9. Application's top-level window is destroyed, triggering destruction
/// of the child browser window.
/// 10. Application's on_before_close() handler is called and the browser
/// object
/// is destroyed.
/// 11. Application exits by calling cef_quit_message_loop() if no other
/// browsers
/// exist.
///
/// Example 2: Using cef_browser_host_t::CloseBrowser(false (0)) and
/// implementing the do_close() callback. This is recommended for clients
/// using non-standard close handling or windows that were not created on the
/// browser process UI thread. 1. User clicks the window close button which
/// sends a close notification
/// to the application's top-level window.
/// 2. Application's top-level window receives the close notification and:
/// A. Calls CefBrowserHost::CloseBrowser(false).
/// B. Cancels the window close.
/// 3. JavaScript 'onbeforeunload' handler executes and shows the close
/// confirmation dialog (which can be overridden via
/// CefJSDialogHandler::OnBeforeUnloadDialog()).
/// 4. User approves the close. 5. JavaScript 'onunload' handler executes.
/// 6. Application's do_close() handler is called. Application will:
/// A. Set a flag to indicate that the next top-level window close attempt
/// will be allowed.
/// B. Return false.
/// 7. CEF sends a close notification to the application's top-level window
/// (because DoClose() returned false).
/// 8. Application's top-level window receives the close notification and
/// allows the window to close based on the flag from #6A.
/// 9. Application's top-level window is destroyed, triggering destruction
/// of the child browser window.
/// 10. Application's on_before_close() handler is called and the browser
/// object
/// is destroyed.
/// 11. Application exits by calling cef_quit_message_loop() if no other
/// browsers
/// exist.
///
int(CEF_CALLBACK* do_close)(struct _cef_life_span_handler_t* self,
struct _cef_browser_t* browser);
///
// Called just before a browser is destroyed. Release all references to the
// browser object and do not attempt to execute any functions on the browser
// object (other than IsValid, GetIdentifier or IsSame) after this callback
// returns. cef_frame_handler_t callbacks related to final main frame
// destruction will arrive after this callback and cef_browser_t::IsValid will
// return false (0) at that time. Any in-progress network requests associated
// with |browser| will be aborted when the browser is destroyed, and
// cef_resource_request_handler_t callbacks related to those requests may
// still arrive on the IO thread after this callback. See cef_frame_handler_t
// and do_close() documentation for additional usage information.
/// Called just before a browser is destroyed. Release all references to the
/// browser object and do not attempt to execute any functions on the browser
/// object (other than IsValid, GetIdentifier or IsSame) after this callback
/// returns. cef_frame_handler_t callbacks related to final main frame
/// destruction will arrive after this callback and cef_browser_t::IsValid
/// will return false (0) at that time. Any in-progress network requests
/// associated with |browser| will be aborted when the browser is destroyed,
/// and cef_resource_request_handler_t callbacks related to those requests may
/// still arrive on the IO thread after this callback. See cef_frame_handler_t
/// and do_close() documentation for additional usage information.
///
void(CEF_CALLBACK* on_before_close)(struct _cef_life_span_handler_t* self,
struct _cef_browser_t* browser);

Some files were not shown because too many files have changed in this diff Show More