Skip to content

Commit 926b08f

Browse files
S1artiemagreenblatt
authored andcommitted
Update to CEF version 92.0.25+gd15cfa8+chromium-92.0.4515.131
1 parent 62432af commit 926b08f

21 files changed

Lines changed: 151 additions & 101 deletions

CMakeLists.txt

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

127127
# Specify the CEF distribution version.
128128
if(NOT DEFINED CEF_VERSION)
129-
set(CEF_VERSION "88.2.6+gd717f0e+chromium-88.0.4324.150")
129+
set(CEF_VERSION "92.0.25+gd15cfa8+chromium-92.0.4515.131")
130130
endif()
131131

132132
# Determine the platform.

java/org/cef/CefClient.java

Lines changed: 65 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
import org.cef.callback.CefFileDialogCallback;
1919
import org.cef.callback.CefJSDialogCallback;
2020
import org.cef.callback.CefMenuModel;
21+
import org.cef.callback.CefPrintDialogCallback;
22+
import org.cef.callback.CefPrintJobCallback;
2123
import org.cef.callback.CefRequestCallback;
2224
import org.cef.handler.CefClientHandler;
2325
import org.cef.handler.CefContextMenuHandler;
@@ -30,13 +32,15 @@
3032
import org.cef.handler.CefKeyboardHandler;
3133
import org.cef.handler.CefLifeSpanHandler;
3234
import org.cef.handler.CefLoadHandler;
35+
import org.cef.handler.CefPrintHandler;
3336
import org.cef.handler.CefRenderHandler;
3437
import org.cef.handler.CefRequestHandler;
3538
import org.cef.handler.CefResourceHandler;
3639
import org.cef.handler.CefResourceRequestHandler;
3740
import org.cef.handler.CefScreenInfo;
3841
import org.cef.handler.CefWindowHandler;
3942
import org.cef.misc.BoolRef;
43+
import org.cef.misc.CefPrintSettings;
4044
import org.cef.misc.StringRef;
4145
import org.cef.network.CefRequest;
4246
import org.cef.network.CefRequest.TransitionType;
@@ -46,6 +50,7 @@
4650

4751
import java.awt.Component;
4852
import java.awt.Container;
53+
import java.awt.Dimension;
4954
import java.awt.FocusTraversalPolicy;
5055
import java.awt.KeyboardFocusManager;
5156
import java.awt.Point;
@@ -65,8 +70,8 @@
6570
public class CefClient extends CefClientHandler
6671
implements CefContextMenuHandler, CefDialogHandler, CefDisplayHandler, CefDownloadHandler,
6772
CefDragHandler, CefFocusHandler, CefJSDialogHandler, CefKeyboardHandler,
68-
CefLifeSpanHandler, CefLoadHandler, CefRenderHandler, CefRequestHandler,
69-
CefWindowHandler {
73+
CefLifeSpanHandler, CefLoadHandler, CefPrintHandler, CefRenderHandler,
74+
CefRequestHandler, CefWindowHandler {
7075
private HashMap<Integer, CefBrowser> browser_ = new HashMap<Integer, CefBrowser>();
7176
private CefContextMenuHandler contextMenuHandler_ = null;
7277
private CefDialogHandler dialogHandler_ = null;
@@ -78,6 +83,7 @@ public class CefClient extends CefClientHandler
7883
private CefKeyboardHandler keyboardHandler_ = null;
7984
private CefLifeSpanHandler lifeSpanHandler_ = null;
8085
private CefLoadHandler loadHandler_ = null;
86+
private CefPrintHandler printHandler_ = null;
8187
private CefRequestHandler requestHandler_ = null;
8288
private boolean isDisposed_ = false;
8389
private volatile CefBrowser focusedBrowser_ = null;
@@ -203,6 +209,11 @@ protected CefLoadHandler getLoadHandler() {
203209
return this;
204210
}
205211

212+
@Override
213+
protected CefPrintHandler getPrintHandler() {
214+
return this;
215+
}
216+
206217
@Override
207218
protected CefRenderHandler getRenderHandler() {
208219
return this;
@@ -587,6 +598,7 @@ private void cleanupBrowser(int identifier) {
587598
removeKeyboardHandler(this);
588599
removeLifeSpanHandler(this);
589600
removeLoadHandler(this);
601+
removePrintHandler(this);
590602
removeRenderHandler(this);
591603
removeRequestHandler(this);
592604
removeWindowHandler(this);
@@ -634,6 +646,57 @@ public void onLoadError(CefBrowser browser, CefFrame frame, ErrorCode errorCode,
634646
loadHandler_.onLoadError(browser, frame, errorCode, errorText, failedUrl);
635647
}
636648

649+
// CefPrintHandler
650+
651+
public CefClient addPrintHandler(CefPrintHandler handler) {
652+
if (printHandler_ == null) printHandler_ = handler;
653+
return this;
654+
}
655+
656+
public void removePrintHandler() {
657+
printHandler_ = null;
658+
}
659+
660+
@Override
661+
public void onPrintStart(CefBrowser browser) {
662+
if (printHandler_ != null && browser != null) printHandler_.onPrintStart(browser);
663+
}
664+
665+
@Override
666+
public void onPrintSettings(
667+
CefBrowser browser, CefPrintSettings settings, boolean getDefaults) {
668+
if (printHandler_ != null && browser != null)
669+
printHandler_.onPrintSettings(browser, settings, getDefaults);
670+
}
671+
672+
@Override
673+
public boolean onPrintDialog(
674+
CefBrowser browser, boolean hasSelection, CefPrintDialogCallback callback) {
675+
if (printHandler_ != null && browser != null)
676+
return printHandler_.onPrintDialog(browser, hasSelection, callback);
677+
return false;
678+
}
679+
680+
@Override
681+
public boolean onPrintJob(CefBrowser browser, String documentName, String pdfFilePath,
682+
CefPrintJobCallback callback) {
683+
if (printHandler_ != null && browser != null)
684+
return printHandler_.onPrintJob(browser, documentName, pdfFilePath, callback);
685+
return false;
686+
}
687+
688+
@Override
689+
public void onPrintReset(CefBrowser browser) {
690+
if (printHandler_ != null && browser != null) printHandler_.onPrintReset(browser);
691+
}
692+
693+
@Override
694+
public Dimension getPdfPaperSize(CefBrowser browser, int deviceUnitsPerInch) {
695+
if (printHandler_ != null && browser != null)
696+
return printHandler_.getPdfPaperSize(browser, deviceUnitsPerInch);
697+
return null;
698+
}
699+
637700
// CefMessageRouter
638701

639702
@Override

java/org/cef/CefSettings.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ public ColorType clone() {
127127
* Value that will be inserted as the product portion of the default
128128
* User-Agent string. If empty the Chromium product version will be used. If
129129
* |userAgent| is specified this value will be ignored. Also configurable
130-
* using the "product-version" command-line switch.
130+
* using the "user_agent_product" command-line switch.
131131
*/
132-
public String product_version = null;
132+
public String user_agent_product = null;
133133

134134
/**
135135
* The locale string that will be passed to Blink. If empty the default
@@ -225,6 +225,20 @@ public ColorType clone() {
225225
*/
226226
public ColorType background_color = null;
227227

228+
///
229+
// Comma delimited list of schemes supported by the associated
230+
// CefCookieManager. If |cookieable_schemes_exclude_defaults| is false (0) the
231+
// default schemes ("http", "https", "ws" and "wss") will also be supported.
232+
// Specifying a |cookieable_schemes_list| value and setting
233+
// |cookieable_schemes_exclude_defaults| to true (1) will disable all loading
234+
// and saving of cookies for this manager. Can be overridden
235+
// for individual CefRequestContext instances via the
236+
// CefRequestContextSettings.cookieable_schemes_list and
237+
// CefRequestContextSettings.cookieable_schemes_exclude_defaults values.
238+
///
239+
public String cookieable_schemes_list = null;
240+
public boolean cookieable_schemes_exclude_defaults = false;
241+
228242
public CefSettings() {}
229243

230244
@Override
@@ -236,7 +250,7 @@ public CefSettings clone() {
236250
tmp.cache_path = cache_path;
237251
tmp.persist_session_cookies = persist_session_cookies;
238252
tmp.user_agent = user_agent;
239-
tmp.product_version = product_version;
253+
tmp.user_agent_product = user_agent_product;
240254
tmp.locale = locale;
241255
tmp.log_file = log_file;
242256
tmp.log_severity = log_severity;
@@ -248,6 +262,8 @@ public CefSettings clone() {
248262
tmp.uncaught_exception_stack_size = uncaught_exception_stack_size;
249263
tmp.ignore_certificate_errors = ignore_certificate_errors;
250264
if (background_color != null) tmp.background_color = background_color.clone();
265+
tmp.cookieable_schemes_list = cookieable_schemes_list;
266+
tmp.cookieable_schemes_exclude_defaults = cookieable_schemes_exclude_defaults;
251267
return tmp;
252268
}
253269
}

java/org/cef/handler/CefAppHandler.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,6 @@ public interface CefAppHandler {
6262
*/
6363
public void onContextInitialized();
6464

65-
/**
66-
* Return the handler for printing on Linux. If a print handler is not
67-
* provided then printing will not be supported on the Linux platform.
68-
*
69-
* @return a reference to a print handler implementation
70-
*/
71-
public CefPrintHandler getPrintHandler();
72-
7365
/**
7466
* Called from any thread when work has been scheduled for the browser process
7567
* main (UI) thread. This callback should schedule a

java/org/cef/handler/CefAppHandlerAdapter.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,6 @@ public void onContextInitialized() {
8484
// The default implementation does nothing
8585
}
8686

87-
@Override
88-
public CefPrintHandler getPrintHandler() {
89-
// The default implementation does nothing
90-
return null;
91-
}
92-
9387
@Override
9488
public void onScheduleMessagePumpWork(long delay_ms) {
9589
CefApp.getInstance().doMessageLoopWork(delay_ms);

java/org/cef/handler/CefClientHandler.java

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

55
package org.cef.handler;
66

7-
import java.util.HashMap;
8-
import java.util.Vector;
9-
107
import org.cef.browser.CefBrowser;
118
import org.cef.browser.CefMessageRouter;
129
import org.cef.callback.CefNative;
1310

11+
import java.util.HashMap;
12+
import java.util.Vector;
13+
1414
/**
1515
* Implement this interface to provide handler implementations.
1616
*/
@@ -137,6 +137,14 @@ protected void dispose() {
137137
*/
138138
abstract protected CefLoadHandler getLoadHandler();
139139

140+
/**
141+
* Return the handler for printing on Linux. If a print handler is not
142+
* provided then printing will not be supported on the Linux platform.
143+
* This method is a callback method and is called by
144+
* the native code.
145+
*/
146+
abstract protected CefPrintHandler getPrintHandler();
147+
140148
/**
141149
* Return the handler for off-screen rendering events.
142150
* This method is a callback method and is called by
@@ -247,6 +255,14 @@ protected void removeLoadHandler(CefLoadHandler h) {
247255
}
248256
}
249257

258+
protected void removePrintHandler(CefPrintHandler h) {
259+
try {
260+
N_removePrintHandler(h);
261+
} catch (UnsatisfiedLinkError err) {
262+
err.printStackTrace();
263+
}
264+
}
265+
250266
protected synchronized void removeMessageRouter(CefMessageRouter h) {
251267
try {
252268
msgRouters.remove(h);
@@ -292,6 +308,7 @@ protected void removeWindowHandler(CefWindowHandler h) {
292308
private final native void N_removeKeyboardHandler(CefKeyboardHandler h);
293309
private final native void N_removeLifeSpanHandler(CefLifeSpanHandler h);
294310
private final native void N_removeLoadHandler(CefLoadHandler h);
311+
private final native void N_removePrintHandler(CefPrintHandler h);
295312
private final native void N_removeMessageRouter(CefMessageRouter h);
296313
private final native void N_removeRenderHandler(CefRenderHandler h);
297314
private final native void N_removeRequestHandler(CefRequestHandler h);

java/org/cef/handler/CefPrintHandler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,9 @@ boolean onPrintJob(CefBrowser browser, String documentName, String pdfFilePath,
6969
/**
7070
* Called to retrieve the page size when printToPDF is requested for a browser.
7171
*
72+
* @param browser The corresponding browser.
7273
* @param deviceUnitsPerInch The DPI of the print. Use this to calculate the page size to use.
7374
* @return The page size in microns.
7475
*/
75-
Dimension getPdfPaperSize(int deviceUnitsPerInch);
76+
Dimension getPdfPaperSize(CefBrowser browser, int deviceUnitsPerInch);
7677
}

java/org/cef/handler/CefPrintHandlerAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void onPrintReset(CefBrowser browser) {
4949
}
5050

5151
@Override
52-
public Dimension getPdfPaperSize(int deviceUnitsPerInch) {
52+
public Dimension getPdfPaperSize(CefBrowser browser, int deviceUnitsPerInch) {
5353
// default implementation is A4 letter size
5454
// @ 300 DPI, A4 is 2480 x 3508
5555
// @ 150 DPI, A4 is 1240 x 1754

java/org/cef/network/CefCookieManager.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,6 @@ public static final CefCookieManager getGlobalManager() {
3737
*/
3838
public abstract void dispose();
3939

40-
/**
41-
* Set the schemes supported by this manager. Calling this method with an empty |schemes| value
42-
* and |includeDefaults| set to false will disable all loading and saving of cookies for this
43-
* manager. Must be called before any cookies are accessed.
44-
* @param schemes List of supported schemes.
45-
* @param includeDefaults If true the default schemes ("http", "https", "ws" and "wss") will
46-
* also be supported.
47-
*/
48-
public abstract void setSupportedSchemes(Vector<String> schemes, boolean includeDefaults);
49-
5040
/**
5141
* Visit all cookies. The returned cookies are ordered by longest path, then by earliest
5242
* creation date.

java/org/cef/network/CefCookieManager_N.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,6 @@ public void dispose() {
5555
}
5656
}
5757

58-
@Override
59-
public void setSupportedSchemes(Vector<String> schemes, boolean includeDefaults) {
60-
try {
61-
N_SetSupportedSchemes(N_CefHandle, schemes, includeDefaults);
62-
} catch (UnsatisfiedLinkError ule) {
63-
ule.printStackTrace();
64-
}
65-
}
66-
6758
@Override
6859
public boolean visitAllCookies(CefCookieVisitor visitor) {
6960
try {
@@ -116,8 +107,6 @@ public boolean flushStore(CefCompletionCallback handler) {
116107

117108
private final static native CefCookieManager_N N_GetGlobalManager();
118109
private final native void N_Dispose(long self);
119-
private final native void N_SetSupportedSchemes(
120-
long self, Vector<String> schemes, boolean include_defaults);
121110
private final native boolean N_VisitAllCookies(long self, CefCookieVisitor visitor);
122111
private final native boolean N_VisitUrlCookies(
123112
long self, String url, boolean includeHttpOnly, CefCookieVisitor visitor);

0 commit comments

Comments
 (0)