Skip to content

Commit 0b63fb2

Browse files
S1artiemagreenblatt
authored andcommitted
Update to CEF version 104.4.23+g46ae630+chromium-104.0.5112.102
- Adapts to CEF issue #3314: Use Chrome file dialogs on all platforms and runtimes. - Replaces some deprecated mask constants on macOS with their newer equivalents.
1 parent 08efede commit 0b63fb2

17 files changed

+55
-75
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ set_property(GLOBAL PROPERTY OS_FOLDERS ON)
130130

131131
# Specify the CEF distribution version.
132132
if(NOT DEFINED CEF_VERSION)
133-
set(CEF_VERSION "100.0.14+g4e5ba66+chromium-100.0.4896.75")
133+
set(CEF_VERSION "104.4.23+g46ae630+chromium-104.0.5112.102")
134134
endif()
135135

136136
# Determine the platform.

java/org/cef/CefClient.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,10 @@ public void removeDialogHandler() {
274274

275275
@Override
276276
public boolean onFileDialog(CefBrowser browser, FileDialogMode mode, String title,
277-
String defaultFilePath, Vector<String> acceptFilters, int selectedAcceptFilter,
278-
CefFileDialogCallback callback) {
277+
String defaultFilePath, Vector<String> acceptFilters, CefFileDialogCallback callback) {
279278
if (dialogHandler_ != null && browser != null) {
280-
return dialogHandler_.onFileDialog(browser, mode, title, defaultFilePath, acceptFilters,
281-
selectedAcceptFilter, callback);
279+
return dialogHandler_.onFileDialog(
280+
browser, mode, title, defaultFilePath, acceptFilters, callback);
282281
}
283282
return false;
284283
}

java/org/cef/browser/CefBrowser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ public void runFileDialog(FileDialogMode mode, String title, String defaultFileP
363363
* <p>
364364
* If executed on the AWT Event Thread, this returns an immediately resolved {@link
365365
* java.util.concurrent.CompletableFuture}. If executed from another thread, the {@link
366-
* java.util.concurrent.CompletableFuture} returned is resolved as soon as the screenshot
366+
* java.util.concurrent.CompletableFuture} returned is resolved as soon as the screenshot
367367
* has been taken (which must happen on the event thread).
368368
* <p>
369369
* The generated screenshot can either be returned as-is, containing all natively-rendered

java/org/cef/callback/CefFileDialogCallback.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@ public interface CefFileDialogCallback {
1515
* a single value or a list of values depending on the dialog mode. An empty
1616
* value is treated the same as calling Cancel().
1717
*
18-
* @param selectedAcceptFilter 0-based index of the value selected from the
19-
* accept filters array passed to CefDialogHandler::OnFileDialog.
2018
* @param filePaths list of selected file paths or an empty list.
2119
*/
22-
public void Continue(int selectedAcceptFilter, Vector<String> filePaths);
20+
public void Continue(Vector<String> filePaths);
2321

2422
/**
2523
* Cancel the file selection.

java/org/cef/callback/CefFileDialogCallback_N.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ protected void finalize() throws Throwable {
1616
}
1717

1818
@Override
19-
public void Continue(int selectedAcceptFilter, Vector<String> filePaths) {
19+
public void Continue(Vector<String> filePaths) {
2020
try {
21-
N_Continue(getNativeRef(null), selectedAcceptFilter, filePaths);
21+
N_Continue(getNativeRef(null), filePaths);
2222
} catch (UnsatisfiedLinkError ule) {
2323
ule.printStackTrace();
2424
}
@@ -33,7 +33,6 @@ public void Cancel() {
3333
}
3434
}
3535

36-
private final native void N_Continue(
37-
long self, int selectedAcceptFilter, Vector<String> filePaths);
36+
private final native void N_Continue(long self, Vector<String> filePaths);
3837
private final native void N_Cancel(long self);
3938
}

java/org/cef/callback/CefRunFileDialogCallback.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44

55
package org.cef.callback;
66

7-
import java.util.Vector;
87
import org.cef.browser.CefBrowser;
98

9+
import java.util.Vector;
10+
1011
/**
1112
* Callback interface for CefBrowserHost::RunFileDialog. The methods of this
1213
* class will be called on the browser process UI thread.
@@ -18,9 +19,7 @@ public interface CefRunFileDialogCallback {
1819
* depending on the dialog mode. If the selection was cancelled filePaths
1920
* will be empty.
2021
*
21-
* @param selectedAcceptFilter 0-based index of the value selected from
22-
* the accept filters array passed to CefBrowserHost::RunFileDialog.
2322
* @param filePaths list of file paths or empty list.
2423
*/
25-
void onFileDialogDismissed(int selectedAcceptFilter, Vector<String> filePaths);
24+
void onFileDialogDismissed(Vector<String> filePaths);
2625
}

java/org/cef/handler/CefDialogHandler.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,11 @@ enum FileDialogMode {
3838
* "image/*"), (b) individual file extensions (e.g. ".txt" or ".png"), or (c)
3939
* combined description and file extension delimited using "|" and ";" (e.g.
4040
* "Image Types|.png;.gif;.jpg").
41-
* @param selectedAcceptFilter is the 0-based index of the filter that should
42-
* be selected by default.
4341
* @param callback is a callback handler for handling own file dialogs.
4442
*
4543
* @return To display a custom dialog return true and execute callback.
4644
* To display the default dialog return false.
4745
*/
4846
public boolean onFileDialog(CefBrowser browser, FileDialogMode mode, String title,
49-
String defaultFilePath, Vector<String> acceptFilters, int selectedAcceptFilter,
50-
CefFileDialogCallback callback);
47+
String defaultFilePath, Vector<String> acceptFilters, CefFileDialogCallback callback);
5148
}

java/tests/detailed/ui/MenuBar.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,7 @@ public void actionPerformed(ActionEvent arg0) {
121121
public void actionPerformed(ActionEvent e) {
122122
CefRunFileDialogCallback callback = new CefRunFileDialogCallback() {
123123
@Override
124-
public void onFileDialogDismissed(
125-
int selectedAcceptFilter, Vector<String> filePaths) {
124+
public void onFileDialogDismissed(Vector<String> filePaths) {
126125
if (!filePaths.isEmpty()) {
127126
try {
128127
SaveAs saveContent = new SaveAs(filePaths.get(0));
@@ -493,8 +492,7 @@ public void actionPerformed(ActionEvent e) {
493492
CompletableFuture<BufferedImage> shot = browser.createScreenshot(false);
494493
shot.thenAccept((image) -> {
495494
System.out.println("Took screenshot asynchronously in "
496-
+ TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start)
497-
+ " msecs");
495+
+ TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start) + " msecs");
498496
SwingUtilities.invokeLater(new Runnable() {
499497
@Override
500498
public void run() {

native/CefBrowser_N.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,10 +1498,9 @@ Java_org_cef_browser_CefBrowser_1N_N_1RunFileDialog(JNIEnv* env,
14981498
mode = FILE_DIALOG_OPEN;
14991499
}
15001500

1501-
browser->GetHost()->RunFileDialog(mode, GetJNIString(env, jtitle),
1502-
GetJNIString(env, jdefaultFilePath),
1503-
accept_types, selectedAcceptFilter,
1504-
new RunFileDialogCallback(env, jcallback));
1501+
browser->GetHost()->RunFileDialog(
1502+
mode, GetJNIString(env, jtitle), GetJNIString(env, jdefaultFilePath),
1503+
accept_types, new RunFileDialogCallback(env, jcallback));
15051504
}
15061505

15071506
JNIEXPORT void JNICALL

native/CefFileDialogCallback_N.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,17 @@ void ClearSelf(JNIEnv* env, jobject obj) {
2222
} // namespace
2323

2424
JNIEXPORT void JNICALL
25-
Java_org_cef_callback_CefFileDialogCallback_1N_N_1Continue(
26-
JNIEnv* env,
27-
jobject obj,
28-
jlong self,
29-
jint selectedAcceptFilter,
30-
jobject jFilePaths) {
25+
Java_org_cef_callback_CefFileDialogCallback_1N_N_1Continue(JNIEnv* env,
26+
jobject obj,
27+
jlong self,
28+
jobject jFilePaths) {
3129
CefRefPtr<CefFileDialogCallback> callback = GetSelf(self);
3230
if (!callback)
3331
return;
3432

3533
std::vector<CefString> filePaths;
3634
GetJNIStringVector(env, jFilePaths, filePaths);
37-
callback->Continue(selectedAcceptFilter, filePaths);
35+
callback->Continue(filePaths);
3836

3937
ClearSelf(env, obj);
4038
}

0 commit comments

Comments
 (0)