Skip to content

Commit

Permalink
Update to CEF 126.2.0+g5c56e98+chromium-126.0.6478.62
Browse files Browse the repository at this point in the history
  • Loading branch information
S1artie authored and magreenblatt committed Jun 19, 2024
1 parent 38becac commit 7a13412
Show file tree
Hide file tree
Showing 18 changed files with 90 additions and 60 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ set_property(GLOBAL PROPERTY OS_FOLDERS ON)

# Specify the CEF distribution version.
if(NOT DEFINED CEF_VERSION)
set(CEF_VERSION "122.1.10+gc902316+chromium-122.0.6261.112")
set(CEF_VERSION "126.2.0+g5c56e98+chromium-126.0.6478.62")
endif()

# Determine the platform.
Expand Down
19 changes: 12 additions & 7 deletions java/org/cef/CefClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,11 @@ public void removeDialogHandler() {

@Override
public boolean onFileDialog(CefBrowser browser, FileDialogMode mode, String title,
String defaultFilePath, Vector<String> acceptFilters, CefFileDialogCallback callback) {
String defaultFilePath, Vector<String> acceptFilters, Vector<String> acceptExtensions,
Vector<String> acceptDescriptions, CefFileDialogCallback callback) {
if (dialogHandler_ != null && browser != null) {
return dialogHandler_.onFileDialog(
browser, mode, title, defaultFilePath, acceptFilters, callback);
return dialogHandler_.onFileDialog(browser, mode, title, defaultFilePath, acceptFilters,
acceptExtensions, acceptDescriptions, callback);
}
return false;
}
Expand Down Expand Up @@ -371,10 +372,12 @@ public void removeDownloadHandler() {
}

@Override
public void onBeforeDownload(CefBrowser browser, CefDownloadItem downloadItem,
public boolean onBeforeDownload(CefBrowser browser, CefDownloadItem downloadItem,
String suggestedName, CefBeforeDownloadCallback callback) {
if (downloadHandler_ != null && browser != null)
downloadHandler_.onBeforeDownload(browser, downloadItem, suggestedName, callback);
return downloadHandler_.onBeforeDownload(
browser, downloadItem, suggestedName, callback);
return false;
}

@Override
Expand Down Expand Up @@ -849,8 +852,10 @@ public boolean onCertificateError(
}

@Override
public void onRenderProcessTerminated(CefBrowser browser, TerminationStatus status) {
if (requestHandler_ != null) requestHandler_.onRenderProcessTerminated(browser, status);
public void onRenderProcessTerminated(
CefBrowser browser, TerminationStatus status, int error_code, String error_string) {
if (requestHandler_ != null)
requestHandler_.onRenderProcessTerminated(browser, status, error_code, error_string);
}

// CefWindowHandler
Expand Down
8 changes: 7 additions & 1 deletion java/org/cef/handler/CefDialogHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,17 @@ enum FileDialogMode {
* "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").
* @param acceptExtensions provides the semicolon-delimited expansion of MIME
* types to file extensions (if known, or empty string otherwise).
* @param acceptDescriptions provides the descriptions for MIME types (if known,
* or empty string otherwise). For example, the "image/*" mime type might
* have extensions ".png;.jpg;.bmp;..." and description "Image Files".
* @param callback is a callback handler for handling own file dialogs.
*
* @return To display a custom dialog return true and execute callback.
* To display the default dialog return false.
*/
public boolean onFileDialog(CefBrowser browser, FileDialogMode mode, String title,
String defaultFilePath, Vector<String> acceptFilters, CefFileDialogCallback callback);
String defaultFilePath, Vector<String> acceptFilters, Vector<String> acceptExtensions,
Vector<String> acceptDescriptions, CefFileDialogCallback callback);
}
10 changes: 6 additions & 4 deletions java/org/cef/handler/CefDownloadHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,19 @@
*/
public interface CefDownloadHandler {
/**
* Called before a download begins. By default the download will be canceled.
* Execute callback either asynchronously or in this method to continue the download
* if desired.
* Called before a download begins. Return true and execute |callback| either
* asynchronously or in this method to continue or cancel the download.
* Return false to proceed with default handling (cancel with Alloy style,
* download shelf with Chrome style). Do not keep a reference to
* downloadItem outside of this method.
*
* @param browser The desired browser.
* @param downloadItem The item to be downloaded. Do not keep a reference to it outside this
* method.
* @param suggestedName is the suggested name for the download file.
* @param callback start the download by calling the Continue method
*/
public void onBeforeDownload(CefBrowser browser, CefDownloadItem downloadItem,
public boolean onBeforeDownload(CefBrowser browser, CefDownloadItem downloadItem,
String suggestedName, CefBeforeDownloadCallback callback);

/**
Expand Down
6 changes: 4 additions & 2 deletions java/org/cef/handler/CefDownloadHandlerAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
*/
public abstract class CefDownloadHandlerAdapter implements CefDownloadHandler {
@Override
public void onBeforeDownload(CefBrowser browser, CefDownloadItem downloadItem,
String suggestedName, CefBeforeDownloadCallback callback) {}
public boolean onBeforeDownload(CefBrowser browser, CefDownloadItem downloadItem,
String suggestedName, CefBeforeDownloadCallback callback) {
return false;
}

@Override
public void onDownloadUpdated(
Expand Down
7 changes: 0 additions & 7 deletions java/org/cef/handler/CefLoadHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,6 @@ enum ErrorCode {
ERR_INVALID_WEB_BUNDLE(-505),
ERR_TRUST_TOKEN_OPERATION_FAILED(-506),
ERR_TRUST_TOKEN_OPERATION_SUCCESS_WITHOUT_SENDING_REQUEST(-507),
ERR_FTP_FAILED(-601),
ERR_FTP_SERVICE_UNAVAILABLE(-602),
ERR_FTP_TRANSFER_ABORTED(-603),
ERR_FTP_FILE_BUSY(-604),
ERR_FTP_SYNTAX_ERROR(-605),
ERR_FTP_COMMAND_NOT_SUPPORTED(-606),
ERR_FTP_BAD_COMMAND_SEQUENCE(-607),
ERR_PKCS12_IMPORT_BAD_PASSWORD(-701),
ERR_PKCS12_IMPORT_FAILED(-702),
ERR_IMPORT_CA_CERT_NOT_CA(-703),
Expand Down
9 changes: 7 additions & 2 deletions java/org/cef/handler/CefRequestHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ enum TerminationStatus {
TS_ABNORMAL_TERMINATION, //!< Non-zero exit status.
TS_PROCESS_WAS_KILLED, //!< SIGKILL or task manager kill.
TS_PROCESS_CRASHED, //!< Segmentation fault.
TS_PROCESS_OOM //!< Out of memory.
TS_PROCESS_OOM, //!< Out of memory.
TS_LAUNCH_FAILED, //!< Failed to launch.
TS_INTEGRITY_FAILURE //!< Integrity check failed.
}

/**
Expand Down Expand Up @@ -123,6 +125,9 @@ boolean onCertificateError(CefBrowser browser, CefLoadHandler.ErrorCode cert_err
* Called on the browser process UI thread when the render process terminates unexpectedly.
* @param browser The corresponding browser.
* @param status Indicates how the process was terminated.
* @param error_code The process error code.
* @param error_string A string description of the error.
*/
void onRenderProcessTerminated(CefBrowser browser, TerminationStatus status);
void onRenderProcessTerminated(
CefBrowser browser, TerminationStatus status, int error_code, String error_string);
}
3 changes: 2 additions & 1 deletion java/org/cef/handler/CefRequestHandlerAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,6 @@ public boolean onCertificateError(
}

@Override
public void onRenderProcessTerminated(CefBrowser browser, TerminationStatus status) {}
public void onRenderProcessTerminated(
CefBrowser browser, TerminationStatus status, int error_code, String error_string) {}
}
4 changes: 3 additions & 1 deletion java/tests/detailed/dialog/DownloadDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,15 @@ void update(CefDownloadItem downloadItem, CefDownloadItemCallback callback) {
}

@Override
public void onBeforeDownload(CefBrowser browser, CefDownloadItem downloadItem,
public boolean onBeforeDownload(CefBrowser browser, CefDownloadItem downloadItem,
String suggestedName, CefBeforeDownloadCallback callback) {
callback.Continue(suggestedName, true);

DownloadObject dlObject = new DownloadObject(downloadItem, suggestedName);
downloadObjects_.put(downloadItem.getId(), dlObject);
downloadPanel_.add(dlObject);

return true;
}

@Override
Expand Down
6 changes: 4 additions & 2 deletions java/tests/detailed/handler/RequestHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@ public boolean onCertificateError(
}

@Override
public void onRenderProcessTerminated(CefBrowser browser, TerminationStatus status) {
System.out.println("render process terminated: " + status);
public void onRenderProcessTerminated(
CefBrowser browser, TerminationStatus status, int error_code, String error_string) {
System.out.println("render process terminated: " + status + " errorCode: " + error_code
+ " errorString: " + error_string);
}
}
3 changes: 2 additions & 1 deletion java/tests/junittests/TestFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@ public boolean onCertificateError(CefBrowser browser, CefLoadHandler.ErrorCode c
}

@Override
public void onRenderProcessTerminated(CefBrowser browser, TerminationStatus status) {}
public void onRenderProcessTerminated(
CefBrowser browser, TerminationStatus status, int error_code, String error_string) {}

// CefResourceRequestHandler methods:

Expand Down
25 changes: 17 additions & 8 deletions native/dialog_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,15 @@ class ScopedJNIFileDialogCallback
DialogHandler::DialogHandler(JNIEnv* env, jobject handler)
: handle_(env, handler) {}

bool DialogHandler::OnFileDialog(CefRefPtr<CefBrowser> browser,
FileDialogMode mode,
const CefString& title,
const CefString& default_file_path,
const std::vector<CefString>& accept_filters,
CefRefPtr<CefFileDialogCallback> callback) {
bool DialogHandler::OnFileDialog(
CefRefPtr<CefBrowser> browser,
FileDialogMode mode,
const CefString& title,
const CefString& default_file_path,
const std::vector<CefString>& accept_filters,
const std::vector<CefString>& accept_extensions,
const std::vector<CefString>& accept_descriptions,
CefRefPtr<CefFileDialogCallback> callback) {
ScopedJNIEnv env;
if (!env)
return false;
Expand All @@ -42,6 +45,10 @@ bool DialogHandler::OnFileDialog(CefRefPtr<CefBrowser> browser,
ScopedJNIString jdefaultFilePath(env, default_file_path);
ScopedJNIObjectLocal jacceptFilters(env,
NewJNIStringVector(env, accept_filters));
ScopedJNIObjectLocal jacceptExtensions(
env, NewJNIStringVector(env, accept_extensions));
ScopedJNIObjectLocal jacceptDescriptions(
env, NewJNIStringVector(env, accept_descriptions));
ScopedJNIFileDialogCallback jcallback(env, callback);

ScopedJNIObjectResult jmode(env);
Expand All @@ -61,9 +68,11 @@ bool DialogHandler::OnFileDialog(CefRefPtr<CefBrowser> browser,
env, handle_, "onFileDialog",
"(Lorg/cef/browser/CefBrowser;Lorg/cef/handler/"
"CefDialogHandler$FileDialogMode;Ljava/lang/String;Ljava/lang/"
"String;Ljava/util/Vector;Lorg/cef/callback/CefFileDialogCallback;)Z",
"String;Ljava/util/Vector;Ljava/util/Vector;Ljava/util/Vector;Lorg/cef/"
"callback/CefFileDialogCallback;)Z",
Boolean, jreturn, jbrowser.get(), jmode.get(), jtitle.get(),
jdefaultFilePath.get(), jacceptFilters.get(), jcallback.get());
jdefaultFilePath.get(), jacceptFilters.get(), jacceptExtensions.get(),
jacceptDescriptions.get(), jcallback.get());

if (jreturn == JNI_FALSE) {
// If the Java method returns "false" the callback won't be used and
Expand Down
2 changes: 2 additions & 0 deletions native/dialog_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class DialogHandler : public CefDialogHandler {
const CefString& title,
const CefString& default_file_path,
const std::vector<CefString>& accept_filters,
const std::vector<CefString>& accept_extensions,
const std::vector<CefString>& accept_descriptions,
CefRefPtr<CefFileDialogCallback> callback) override;

protected:
Expand Down
14 changes: 9 additions & 5 deletions native/download_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,27 +49,31 @@ class ScopedJNIDownloadItemCallback
DownloadHandler::DownloadHandler(JNIEnv* env, jobject handler)
: handle_(env, handler) {}

void DownloadHandler::OnBeforeDownload(
bool DownloadHandler::OnBeforeDownload(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDownloadItem> download_item,
const CefString& suggested_name,
CefRefPtr<CefBeforeDownloadCallback> callback) {
ScopedJNIEnv env;
if (!env)
return;
return false;

ScopedJNIBrowser jbrowser(env, browser);
ScopedJNIDownloadItem jdownloadItem(env, download_item);
jdownloadItem.SetTemporary();
ScopedJNIString jsuggestedName(env, suggested_name);
ScopedJNIBeforeDownloadCallback jcallback(env, callback);

JNI_CALL_VOID_METHOD(
env, handle_, "onBeforeDownload",
jboolean jresult = 0;

JNI_CALL_BOOLEAN_METHOD(
jresult, env, handle_, "onBeforeDownload",
"(Lorg/cef/browser/CefBrowser;Lorg/cef/callback/CefDownloadItem;"
"Ljava/lang/String;Lorg/cef/callback/CefBeforeDownloadCallback;)V",
"Ljava/lang/String;Lorg/cef/callback/CefBeforeDownloadCallback;)Z",
jbrowser.get(), jdownloadItem.get(), jsuggestedName.get(),
jcallback.get());

return jresult;
}

void DownloadHandler::OnDownloadUpdated(
Expand Down
2 changes: 1 addition & 1 deletion native/download_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class DownloadHandler : public CefDownloadHandler {
DownloadHandler(JNIEnv* env, jobject handler);

// CefDownloadHandler methods
virtual void OnBeforeDownload(
virtual bool OnBeforeDownload(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDownloadItem> download_item,
const CefString& suggested_name,
Expand Down
14 changes: 0 additions & 14 deletions native/jni_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -686,20 +686,6 @@ jobject NewJNIErrorCode(JNIEnv* env, cef_errorcode_t errorCode) {
JNI_CASE(env, "org/cef/handler/CefLoadHandler$ErrorCode",
ERR_TRUST_TOKEN_OPERATION_SUCCESS_WITHOUT_SENDING_REQUEST,
jerrorCode);
JNI_CASE(env, "org/cef/handler/CefLoadHandler$ErrorCode", ERR_FTP_FAILED,
jerrorCode);
JNI_CASE(env, "org/cef/handler/CefLoadHandler$ErrorCode",
ERR_FTP_SERVICE_UNAVAILABLE, jerrorCode);
JNI_CASE(env, "org/cef/handler/CefLoadHandler$ErrorCode",
ERR_FTP_TRANSFER_ABORTED, jerrorCode);
JNI_CASE(env, "org/cef/handler/CefLoadHandler$ErrorCode",
ERR_FTP_FILE_BUSY, jerrorCode);
JNI_CASE(env, "org/cef/handler/CefLoadHandler$ErrorCode",
ERR_FTP_SYNTAX_ERROR, jerrorCode);
JNI_CASE(env, "org/cef/handler/CefLoadHandler$ErrorCode",
ERR_FTP_COMMAND_NOT_SUPPORTED, jerrorCode);
JNI_CASE(env, "org/cef/handler/CefLoadHandler$ErrorCode",
ERR_FTP_BAD_COMMAND_SEQUENCE, jerrorCode);
JNI_CASE(env, "org/cef/handler/CefLoadHandler$ErrorCode",
ERR_PKCS12_IMPORT_BAD_PASSWORD, jerrorCode);
JNI_CASE(env, "org/cef/handler/CefLoadHandler$ErrorCode",
Expand Down
12 changes: 10 additions & 2 deletions native/request_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ bool RequestHandler::OnCertificateError(CefRefPtr<CefBrowser> browser,
}

void RequestHandler::OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
TerminationStatus status) {
TerminationStatus status,
int error_code,
const CefString& error_string) {
// Forward request to ClientHandler to make the message_router_ happy.
CefRefPtr<ClientHandler> client =
(ClientHandler*)browser->GetHost()->GetClient().get();
Expand All @@ -197,11 +199,17 @@ void RequestHandler::OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
TS_PROCESS_CRASHED, jstatus);
JNI_CASE(env, "org/cef/handler/CefRequestHandler$TerminationStatus",
TS_PROCESS_OOM, jstatus);
JNI_CASE(env, "org/cef/handler/CefRequestHandler$TerminationStatus",
TS_LAUNCH_FAILED, jstatus);
JNI_CASE(env, "org/cef/handler/CefRequestHandler$TerminationStatus",
TS_INTEGRITY_FAILURE, jstatus);
}

ScopedJNIString jerrorString(env, error_string);

JNI_CALL_VOID_METHOD(
env, handle_, "onRenderProcessTerminated",
"(Lorg/cef/browser/CefBrowser;"
"Lorg/cef/handler/CefRequestHandler$TerminationStatus;)V",
jbrowser.get(), jstatus.get());
jbrowser.get(), jstatus.get(), error_code, jerrorString.get());
}
4 changes: 3 additions & 1 deletion native/request_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ class RequestHandler : public CefRequestHandler {
CefRefPtr<CefSSLInfo> ssl_info,
CefRefPtr<CefCallback> callback) override;
void OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
TerminationStatus status) override;
TerminationStatus status,
int error_code,
const CefString& error_string) override;

protected:
ScopedJNIObjectGlobal handle_;
Expand Down

0 comments on commit 7a13412

Please sign in to comment.