aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtem Bochkarev <artem.bochkarev@jetbrains.com>2023-02-16 13:35:06 +0700
committerArtem Bochkarev <artem.bochkarev@jetbrains.com>2023-02-16 13:35:06 +0700
commit06a87a0b717c98bbe401527d5d66106404cb22e1 (patch)
tree9deb8abca5561a22ed4475b259fdff4a5242a62e
parent0bc64e4cd9c16c88d2a0eb09dd792cbd2a0f13c6 (diff)
parent6658c29eb313b1aca13cc06e4bcd957b96a209e6 (diff)
downloadjcef-06a87a0b717c98bbe401527d5d66106404cb22e1.tar.gz
Merge branch java-cef/master into dev
# Conflicts: # CMakeLists.txt # java/org/cef/CefClient.java # java/org/cef/callback/CefFileDialogCallback_N.java # java_tests/tests/detailed/dialog/CookieManagerDialog.java # java_tests/tests/detailed/dialog/DownloadDialog.java # java_tests/tests/detailed/dialog/PasswordDialog.java # java_tests/tests/detailed/dialog/SearchDialog.java # java_tests/tests/detailed/dialog/ShowTextDialog.java # java_tests/tests/detailed/handler/ClientSchemeHandler.java # java_tests/tests/detailed/ui/ControlPanel.java # native/CefBrowser_N.cpp # native/CefFileDialogCallback_N.cpp # native/dialog_handler.cpp # native/run_file_dialog_callback.cpp # tools/buildtools/README.jcef # tools/buildtools/download_from_google_storage.py
-rw-r--r--CMakeLists.txt18
-rw-r--r--java/org/cef/CefClient.java3
-rw-r--r--java/org/cef/callback/CefFileDialogCallback.java2
-rw-r--r--java/org/cef/callback/CefFileDialogCallback_N.java3
-rw-r--r--java/org/cef/callback/CefPdfPrintCallback.java2
-rw-r--r--java/org/cef/callback/CefRunFileDialogCallback.java3
-rw-r--r--java/org/cef/callback/CefSchemeRegistrar.java2
-rw-r--r--java/org/cef/handler/CefDialogHandler.java2
-rw-r--r--java/org/cef/handler/CefWindowHandler.java84
-rw-r--r--java/org/cef/handler/CefWindowHandlerAdapter.java50
-rw-r--r--java/org/cef/misc/CefPdfPrintSettings.java115
-rw-r--r--java_tests/tests/detailed/BrowserFrame.java9
-rw-r--r--java_tests/tests/detailed/dialog/CookieManagerDialog.java10
-rw-r--r--java_tests/tests/detailed/dialog/DevToolsDialog.java4
-rw-r--r--java_tests/tests/detailed/dialog/DownloadDialog.java12
-rw-r--r--java_tests/tests/detailed/dialog/PasswordDialog.java4
-rw-r--r--java_tests/tests/detailed/dialog/SearchDialog.java4
-rw-r--r--java_tests/tests/detailed/dialog/ShowTextDialog.java4
-rw-r--r--java_tests/tests/detailed/dialog/UrlRequestDialog.java10
-rw-r--r--java_tests/tests/detailed/handler/ClientSchemeHandler.java8
-rw-r--r--java_tests/tests/detailed/handler/ContextMenuHandler.java10
-rw-r--r--java_tests/tests/detailed/handler/ResourceHandler.java4
-rw-r--r--java_tests/tests/detailed/ui/ControlPanel.java6
-rw-r--r--java_tests/tests/detailed/ui/MenuBar.java11
-rw-r--r--native/CefBrowser_N.cpp67
-rw-r--r--native/CefCookieManager_N.cpp2
-rw-r--r--native/CefFileDialogCallback_N.cpp9
-rw-r--r--native/CefMessageRouter_N.cpp5
-rw-r--r--native/dialog_handler.cpp3
-rw-r--r--native/jni_scoped_helpers.cpp8
-rw-r--r--native/jni_scoped_helpers.h2
-rw-r--r--native/jni_util.cpp8
-rw-r--r--native/jni_util.h2
-rw-r--r--native/resource_handler.cpp2
-rw-r--r--native/run_file_dialog_callback.cpp3
-rw-r--r--tools/buildtools/README.jcef5
-rw-r--r--tools/buildtools/download_from_google_storage.py86
-rw-r--r--tools/buildtools/gsutil.py72
-rw-r--r--tools/buildtools/linux64/clang-format.sha12
-rw-r--r--tools/buildtools/mac/clang-format.arm64.sha11
-rw-r--r--tools/buildtools/mac/clang-format.sha11
-rw-r--r--tools/buildtools/mac/clang-format.x64.sha11
-rw-r--r--tools/buildtools/subprocess2.py37
-rw-r--r--tools/buildtools/win/clang-format.exe.sha12
-rwxr-xr-xtools/fix_style.sh2
-rw-r--r--tools/make_distrib.bat4
-rwxr-xr-xtools/make_distrib.sh4
47 files changed, 402 insertions, 306 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a18ac3c..533213f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -130,14 +130,20 @@ set_property(GLOBAL PROPERTY OS_FOLDERS ON)
# Specify the CEF distribution version.
if(NOT DEFINED CEF_VERSION)
- set(CEF_VERSION "104.4.26+g4180781+chromium-104.0.5112.102")
+ set(CEF_VERSION "108.4.13+ga98cd4c+chromium-108.0.5359.125")
endif()
# Determine the platform.
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
if("${PROJECT_ARCH}" STREQUAL "arm64")
set(CEF_PLATFORM "macosarm64")
+ elseif("${PROJECT_ARCH}" STREQUAL "x86_64")
+ set(CEF_PLATFORM "macosx64")
+ elseif("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "arm64")
+ set(PROJECT_ARCH "arm64")
+ set(CEF_PLATFORM "macosarm64")
else()
+ set(PROJECT_ARCH "x86_64")
set(CEF_PLATFORM "macosx64")
endif()
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
@@ -280,12 +286,19 @@ file(COPY "${CEF_ROOT}/README.txt" DESTINATION "${CMAKE_BINARY_DIR}")
if(OS_WINDOWS)
set(GS_PLATFORM "win32")
set(GS_HASHPATH "win/clang-format.exe.sha1")
+ set(GS_OUTPATH "win/clang-format.exe")
elseif(OS_MACOSX)
set(GS_PLATFORM "darwin")
- set(GS_HASHPATH "mac/clang-format.sha1")
+ if("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "arm64")
+ set(GS_HASHPATH "mac/clang-format.arm64.sha1")
+ else()
+ set(GS_HASHPATH "mac/clang-format.x64.sha1")
+ endif()
+ set(GS_OUTPATH "mac/clang-format")
elseif(OS_LINUX)
set(GS_PLATFORM "linux*")
set(GS_HASHPATH "linux64/clang-format.sha1")
+ set(GS_OUTPATH "linux64/clang-format")
endif()
message(STATUS "Downloading clang-format from Google Storage...")
@@ -297,6 +310,7 @@ execute_process(
"--no_auth"
"--bucket" "chromium-clang-format"
"-s" "tools/buildtools/${GS_HASHPATH}"
+ "-o" "tools/buildtools/${GS_OUTPATH}"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE EXECUTE_RV
)
diff --git a/java/org/cef/CefClient.java b/java/org/cef/CefClient.java
index 53b8f1a..5040e29 100644
--- a/java/org/cef/CefClient.java
+++ b/java/org/cef/CefClient.java
@@ -302,7 +302,8 @@ public class CefClient extends CefClientHandler
public boolean onFileDialog(CefBrowser browser, FileDialogMode mode, String title,
String defaultFilePath, Vector<String> acceptFilters, CefFileDialogCallback callback) {
if (dialogHandler_ != null && browser != null) {
- return dialogHandler_.onFileDialog(browser, mode, title, defaultFilePath, acceptFilters, callback);
+ return dialogHandler_.onFileDialog(
+ browser, mode, title, defaultFilePath, acceptFilters, callback);
}
return false;
}
diff --git a/java/org/cef/callback/CefFileDialogCallback.java b/java/org/cef/callback/CefFileDialogCallback.java
index 492dac7..edc06c3 100644
--- a/java/org/cef/callback/CefFileDialogCallback.java
+++ b/java/org/cef/callback/CefFileDialogCallback.java
@@ -15,8 +15,6 @@ public interface CefFileDialogCallback {
* a single value or a list of values depending on the dialog mode. An empty
* value is treated the same as calling Cancel().
*
- * @param selectedAcceptFilter 0-based index of the value selected from the
- * accept filters array passed to CefDialogHandler::OnFileDialog.
* @param filePaths list of selected file paths or an empty list.
*/
public void Continue(Vector<String> filePaths);
diff --git a/java/org/cef/callback/CefFileDialogCallback_N.java b/java/org/cef/callback/CefFileDialogCallback_N.java
index f3bb2a2..770ed97 100644
--- a/java/org/cef/callback/CefFileDialogCallback_N.java
+++ b/java/org/cef/callback/CefFileDialogCallback_N.java
@@ -33,7 +33,6 @@ class CefFileDialogCallback_N extends CefNativeAdapter implements CefFileDialogC
}
}
- private final native void N_Continue(
- long self, Vector<String> filePaths);
+ private final native void N_Continue(long self, Vector<String> filePaths);
private final native void N_Cancel(long self);
}
diff --git a/java/org/cef/callback/CefPdfPrintCallback.java b/java/org/cef/callback/CefPdfPrintCallback.java
index 7bedd5c..cd48404 100644
--- a/java/org/cef/callback/CefPdfPrintCallback.java
+++ b/java/org/cef/callback/CefPdfPrintCallback.java
@@ -9,7 +9,6 @@ package org.cef.callback;
* will be called on the browser process UI thread.
*/
public interface CefPdfPrintCallback {
-
/**
* Method that will be executed when the PDF printing has completed. |path|
* is the output path. |ok| will be true if the printing completed
@@ -18,5 +17,4 @@ public interface CefPdfPrintCallback {
* @param ok True if printing completed or false otherwise.
*/
public abstract void onPdfPrintFinished(String path, boolean ok);
-
}
diff --git a/java/org/cef/callback/CefRunFileDialogCallback.java b/java/org/cef/callback/CefRunFileDialogCallback.java
index f40000a..9d7381a 100644
--- a/java/org/cef/callback/CefRunFileDialogCallback.java
+++ b/java/org/cef/callback/CefRunFileDialogCallback.java
@@ -4,9 +4,10 @@
package org.cef.callback;
-import java.util.Vector;
import org.cef.browser.CefBrowser;
+import java.util.Vector;
+
/**
* Callback interface for CefBrowserHost::RunFileDialog. The methods of this
* class will be called on the browser process UI thread.
diff --git a/java/org/cef/callback/CefSchemeRegistrar.java b/java/org/cef/callback/CefSchemeRegistrar.java
index d4fcb4f..f59263c 100644
--- a/java/org/cef/callback/CefSchemeRegistrar.java
+++ b/java/org/cef/callback/CefSchemeRegistrar.java
@@ -62,7 +62,7 @@ public interface CefSchemeRegistrar {
* If |isCspBypassing| is true the scheme can bypass Content-Security-Policy
* (CSP) checks. This value should be false in most cases where |isStandard|
* is true.
- *
+ *
* If |is_fetch_enabled| is true the scheme can perform Fetch API requests.
*
* This function may be called on any thread. It should only be called once
diff --git a/java/org/cef/handler/CefDialogHandler.java b/java/org/cef/handler/CefDialogHandler.java
index 8c0dbc9..311de4c 100644
--- a/java/org/cef/handler/CefDialogHandler.java
+++ b/java/org/cef/handler/CefDialogHandler.java
@@ -38,8 +38,6 @@ public interface CefDialogHandler {
* "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 selectedAcceptFilter is the 0-based index of the filter that should
- * be selected by default.
* @param callback is a callback handler for handling own file dialogs.
*
* @return To display a custom dialog return true and execute callback.
diff --git a/java/org/cef/handler/CefWindowHandler.java b/java/org/cef/handler/CefWindowHandler.java
index eeda8da..c0bc0f1 100644
--- a/java/org/cef/handler/CefWindowHandler.java
+++ b/java/org/cef/handler/CefWindowHandler.java
@@ -1,42 +1,42 @@
-// Copyright (c) 2015 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.
-
-package org.cef.handler;
-
-import java.awt.Rectangle;
-
-import org.cef.browser.CefBrowser;
-
-/**
- * Implement this interface to handle events if window rendering is enabled.
- *
- */
-public interface CefWindowHandler {
- /**
- * Retrieve the view rectangle.
- * @param browser The browser generating the event.
- * @return The view rectangle.
- */
- public Rectangle getRect(CefBrowser browser);
-
- /**
- * Implement this method to handle mouse events on Windows.
- *
- * The method is called in case of the following events:
- * MOUSE_MOVED, MOUSE_PRESSED, MOUSE_RELEASED and MOUSE_WHEEL for a
- * horizontal wheel movement.
- *
- * @param browser The browser generating the event.
- * @param event A mouse event like MouseEvent.MOUSE_MOVED.
- * @param screenX The absolute X position on the screen.
- * @param screenY The absolute Y position on the screen.
- * @param modifier The modifier keys down during event (e.g. Shift, Ctrl).
- * @param button An integer indicating which mouse button state changed.
- * If parameter event is set to MouseEvent.MOUSE_WHEEL, the value of this
- * parameter specifies the rotation indicator (negative value for left scroll
- * and positive value for right scroll).
- */
- public void onMouseEvent(
- CefBrowser browser, int event, int screenX, int screenY, int modifier, int button);
-}
+// Copyright (c) 2015 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.
+
+package org.cef.handler;
+
+import org.cef.browser.CefBrowser;
+
+import java.awt.Rectangle;
+
+/**
+ * Implement this interface to handle events if window rendering is enabled.
+ *
+ */
+public interface CefWindowHandler {
+ /**
+ * Retrieve the view rectangle.
+ * @param browser The browser generating the event.
+ * @return The view rectangle.
+ */
+ public Rectangle getRect(CefBrowser browser);
+
+ /**
+ * Implement this method to handle mouse events on Windows.
+ *
+ * The method is called in case of the following events:
+ * MOUSE_MOVED, MOUSE_PRESSED, MOUSE_RELEASED and MOUSE_WHEEL for a
+ * horizontal wheel movement.
+ *
+ * @param browser The browser generating the event.
+ * @param event A mouse event like MouseEvent.MOUSE_MOVED.
+ * @param screenX The absolute X position on the screen.
+ * @param screenY The absolute Y position on the screen.
+ * @param modifier The modifier keys down during event (e.g. Shift, Ctrl).
+ * @param button An integer indicating which mouse button state changed.
+ * If parameter event is set to MouseEvent.MOUSE_WHEEL, the value of this
+ * parameter specifies the rotation indicator (negative value for left scroll
+ * and positive value for right scroll).
+ */
+ public void onMouseEvent(
+ CefBrowser browser, int event, int screenX, int screenY, int modifier, int button);
+}
diff --git a/java/org/cef/handler/CefWindowHandlerAdapter.java b/java/org/cef/handler/CefWindowHandlerAdapter.java
index 1e6ad6b..839c0c7 100644
--- a/java/org/cef/handler/CefWindowHandlerAdapter.java
+++ b/java/org/cef/handler/CefWindowHandlerAdapter.java
@@ -1,25 +1,25 @@
-// Copyright (c) 2015 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.
-
-package org.cef.handler;
-
-import java.awt.Rectangle;
-
-import org.cef.browser.CefBrowser;
-
-/**
- * An abstract adapter class for receiving windowed render events.
- * The methods in this class are empty.
- * This class exists as convenience for creating handler objects.
- */
-public abstract class CefWindowHandlerAdapter implements CefWindowHandler {
- @Override
- public Rectangle getRect(CefBrowser browser) {
- return new Rectangle(0, 0, 0, 0);
- }
-
- @Override
- public void onMouseEvent(
- CefBrowser browser, int event, int screenX, int screenY, int modifier, int button) {}
-}
+// Copyright (c) 2015 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.
+
+package org.cef.handler;
+
+import org.cef.browser.CefBrowser;
+
+import java.awt.Rectangle;
+
+/**
+ * An abstract adapter class for receiving windowed render events.
+ * The methods in this class are empty.
+ * This class exists as convenience for creating handler objects.
+ */
+public abstract class CefWindowHandlerAdapter implements CefWindowHandler {
+ @Override
+ public Rectangle getRect(CefBrowser browser) {
+ return new Rectangle(0, 0, 0, 0);
+ }
+
+ @Override
+ public void onMouseEvent(
+ CefBrowser browser, int event, int screenX, int screenY, int modifier, int button) {}
+}
diff --git a/java/org/cef/misc/CefPdfPrintSettings.java b/java/org/cef/misc/CefPdfPrintSettings.java
index 554c292..49afdc2 100644
--- a/java/org/cef/misc/CefPdfPrintSettings.java
+++ b/java/org/cef/misc/CefPdfPrintSettings.java
@@ -15,97 +15,116 @@ public class CefPdfPrintSettings {
// No margins
NONE,
- // Minimum margins.
- MINIMUM,
-
// Custom margins using the values from CefPdfPrintSettings
CUSTOM
}
/**
- * Set to true to print headers and footers or false to not print
- * headers and footers.
+ * Set to true for landscape mode or false for portrait mode.
*/
- public boolean header_footer_enabled;
+ public boolean landscape;
/**
- * Page title to display in the header. Only used if header_footer_enabled
- * is set to true.
+ * Set to true to print background graphics or false to not print
+ * background graphics.
*/
- public String header_footer_title;
+ public boolean print_background;
/**
- * URL to display in the footer. Only used if header_footer_enabled is set
- * to true.
+ * The percentage to scale the PDF by before printing (e.g. .5 is 50%).
+ * If this value is less than or equal to zero the default value of 1.0
+ * will be used.
*/
- public String header_footer_url;
+ public double scale;
/**
- * Set to true for landscape mode or false for portrait mode.
+ * Output paper size in inches. If either of these values is less than or
+ * equal to zero then the default paper size (letter, 8.5 x 11 inches) will
+ * be used.
*/
- public boolean landscape;
+ public double paper_width;
+ public double paper_height;
/**
- * Set to true to print background graphics or false to not print
- * background graphics.
+ * Set to true to prefer page size as defined by css. Defaults to false
+ * in which case the content will be scaled to fit the paper size.
+ */
+ public boolean prefer_css_page_size;
+
+ /**
+ * Margin type.
*/
- public boolean backgrounds_enabled;
+ public MarginType margin_type;
/**
- * Output page size in microns (1 millimeter = 1000 microns). If either of these
- * values is less than or equal to zero then the default paper size will be
- * used as returned by the print_handler. A4 is 210 x 297 mm which would
- * be 210000 x 297000 microns. US Letter is 215.9 x 279.4 mm which would
- * be 215900 x 279400 microns.
+ * Margins in inches. Only used if margin_type is set to CUSTOM.
*/
- public int page_width;
- public int page_height;
+ public double margin_top;
+ public double margin_right;
+ public double margin_bottom;
+ public double margin_left;
/**
- * Set to true to print the selection only or false to print all.
+ * Paper ranges to print, one based, e.g., '1-5, 8, 11-13'. Pages are printed
+ * in the document order, not in the order specified, and no more than once.
+ * Defaults to empty string, which implies the entire document is printed.
+ * The page numbers are quietly capped to actual page count of the document,
+ * and ranges beyond the end of the document are ignored. If this results in
+ * no pages to print, an error is reported. It is an error to specify a range
+ * with start greater than end.
*/
- public boolean selection_only;
+ public String page_ranges;
/**
- * The percentage to scale the PDF by before printing (e.g. 50 is 50%).
- * If this value is less than or equal to zero the default value of 100
- * will be used.
+ * Set to true to print headers and footers or false to not print
+ * headers and footers. Modify header_template and/or footer_template to
+ * customize the display.
*/
- public int scale_factor;
+ public boolean display_header_footer;
/**
- * Margins in points. Only used if |margin_type| is set to
- * PDF_PRINT_MARGIN_CUSTOM.
+ * HTML template for the print header. Only displayed if
+ * |display_header_footer| is true (1). Should be valid HTML markup with
+ * the following classes used to inject printing values into them:
+ *
+ * - date: formatted print date
+ * - title: document title
+ * - url: document location
+ * - pageNumber: current page number
+ * - totalPages: total pages in the document
+ *
+ * For example, "<span class=title></span>" would generate a span containing
+ * the title.
*/
- public int margin_top;
- public int margin_right;
- public int margin_bottom;
- public int margin_left;
+ public String header_template;
/**
- * Margin type.
+ * HTML template for the print footer. Only displayed if
+ * |display_header_footer| is true (1). Uses the same format as
+ * |header_template|.
*/
- public MarginType margin_type;
+ public String footer_template;
public CefPdfPrintSettings() {}
@Override
public CefPdfPrintSettings clone() {
CefPdfPrintSettings tmp = new CefPdfPrintSettings();
- tmp.header_footer_enabled = this.header_footer_enabled;
- tmp.header_footer_title = this.header_footer_title;
- tmp.header_footer_url = this.header_footer_url;
tmp.landscape = this.landscape;
- tmp.backgrounds_enabled = this.backgrounds_enabled;
- tmp.page_width = this.page_width;
- tmp.page_height = this.page_height;
- tmp.selection_only = this.selection_only;
- tmp.scale_factor = this.scale_factor;
+ tmp.print_background = this.print_background;
+ tmp.scale = this.scale;
+ tmp.paper_width = this.paper_width;
+ tmp.paper_height = this.paper_height;
+ tmp.prefer_css_page_size = this.prefer_css_page_size;
+ tmp.margin_type = this.margin_type;
tmp.margin_top = this.margin_top;
- tmp.margin_right = this.margin_right;
tmp.margin_bottom = this.margin_bottom;
+ tmp.margin_right = this.margin_right;
tmp.margin_left = this.margin_left;
- tmp.margin_type = this.margin_type;
+ tmp.page_ranges = this.page_ranges;
+ tmp.display_header_footer = this.display_header_footer;
+ tmp.header_template = this.header_template;
+ tmp.footer_template = this.footer_template;
return tmp;
}
}
diff --git a/java_tests/tests/detailed/BrowserFrame.java b/java_tests/tests/detailed/BrowserFrame.java
index aa955f7..dedcd1f 100644
--- a/java_tests/tests/detailed/BrowserFrame.java
+++ b/java_tests/tests/detailed/BrowserFrame.java
@@ -4,15 +4,16 @@
package tests.detailed;
+import org.cef.CefApp;
+import org.cef.browser.CefBrowser;
+import org.cef.handler.CefLifeSpanHandlerAdapter;
+
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
+
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
-import org.cef.CefApp;
-import org.cef.browser.CefBrowser;
-import org.cef.handler.CefLifeSpanHandlerAdapter;
-
public class BrowserFrame extends JFrame {
private volatile boolean isClosed_ = false;
private CefBrowser browser_ = null;
diff --git a/java_tests/tests/detailed/dialog/CookieManagerDialog.java b/java_tests/tests/detailed/dialog/CookieManagerDialog.java
index ecc0d21..279ebbf 100644
--- a/java_tests/tests/detailed/dialog/CookieManagerDialog.java
+++ b/java_tests/tests/detailed/dialog/CookieManagerDialog.java
@@ -4,6 +4,11 @@
package tests.detailed.dialog;
+import org.cef.callback.CefCookieVisitor;
+import org.cef.misc.BoolRef;
+import org.cef.network.CefCookie;
+import org.cef.network.CefCookieManager;
+
import java.awt.BorderLayout;
import java.awt.Frame;
import java.awt.event.ActionEvent;
@@ -19,11 +24,6 @@ import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.AbstractTableModel;
-import org.cef.callback.CefCookieVisitor;
-import org.cef.misc.BoolRef;
-import org.cef.network.CefCookie;
-import org.cef.network.CefCookieManager;
-
@SuppressWarnings("serial")
public class CookieManagerDialog extends JDialog {
private static int testCookieId = 1;
diff --git a/java_tests/tests/detailed/dialog/DevToolsDialog.java b/java_tests/tests/detailed/dialog/DevToolsDialog.java
index fb811ea..d1fb3d8 100644
--- a/java_tests/tests/detailed/dialog/DevToolsDialog.java
+++ b/java_tests/tests/detailed/dialog/DevToolsDialog.java
@@ -4,6 +4,8 @@
package tests.detailed.dialog;
+import org.cef.browser.CefBrowser;
+
import java.awt.BorderLayout;
import java.awt.Frame;
import java.awt.Point;
@@ -12,8 +14,6 @@ import java.awt.event.ComponentEvent;
import javax.swing.JDialog;
-import org.cef.browser.CefBrowser;
-
@SuppressWarnings("serial")
public class DevToolsDialog extends JDialog {
private final CefBrowser devTools_;
diff --git a/java_tests/tests/detailed/dialog/DownloadDialog.java b/java_tests/tests/detailed/dialog/DownloadDialog.java
index 74a7aca..f9717a5 100644
--- a/java_tests/tests/detailed/dialog/DownloadDialog.java
+++ b/java_tests/tests/detailed/dialog/DownloadDialog.java
@@ -4,6 +4,12 @@
package tests.detailed.dialog;
+import org.cef.browser.CefBrowser;
+import org.cef.callback.CefBeforeDownloadCallback;
+import org.cef.callback.CefDownloadItem;
+import org.cef.callback.CefDownloadItemCallback;
+import org.cef.handler.CefDownloadHandler;
+
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
@@ -19,12 +25,6 @@ import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
-import org.cef.browser.CefBrowser;
-import org.cef.callback.CefBeforeDownloadCallback;
-import org.cef.callback.CefDownloadItem;
-import org.cef.callback.CefDownloadItemCallback;
-import org.cef.handler.CefDownloadHandler;
-
@SuppressWarnings("serial")
public class DownloadDialog extends JDialog implements CefDownloadHandler {
private final Frame owner_;
diff --git a/java_tests/tests/detailed/dialog/PasswordDialog.java b/java_tests/tests/detailed/dialog/PasswordDialog.java
index 0e12074..61662f4 100644
--- a/java_tests/tests/detailed/dialog/PasswordDialog.java
+++ b/java_tests/tests/detailed/dialog/PasswordDialog.java
@@ -4,6 +4,8 @@
package tests.detailed.dialog;
+import org.cef.callback.CefAuthCallback;
+
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
@@ -15,8 +17,6 @@ import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
-import org.cef.callback.CefAuthCallback;
-
@SuppressWarnings("serial")
public class PasswordDialog extends JDialog implements Runnable {
private final JTextField username_ = new JTextField(20);
diff --git a/java_tests/tests/detailed/dialog/SearchDialog.java b/java_tests/tests/detailed/dialog/SearchDialog.java
index 9a87b31..88838c3 100644
--- a/java_tests/tests/detailed/dialog/SearchDialog.java
+++ b/java_tests/tests/detailed/dialog/SearchDialog.java
@@ -4,6 +4,8 @@
package tests.detailed.dialog;
+import org.cef.browser.CefBrowser;
+
import java.awt.BorderLayout;
import java.awt.Frame;
import java.awt.event.ActionEvent;
@@ -18,8 +20,6 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
-import org.cef.browser.CefBrowser;
-
@SuppressWarnings("serial")
public class SearchDialog extends JDialog {
private final CefBrowser browser_;
diff --git a/java_tests/tests/detailed/dialog/ShowTextDialog.java b/java_tests/tests/detailed/dialog/ShowTextDialog.java
index 6261bef..7081304 100644
--- a/java_tests/tests/detailed/dialog/ShowTextDialog.java
+++ b/java_tests/tests/detailed/dialog/ShowTextDialog.java
@@ -4,6 +4,8 @@
package tests.detailed.dialog;
+import org.cef.callback.CefStringVisitor;
+
import java.awt.BorderLayout;
import java.awt.Frame;
import java.awt.event.ActionEvent;
@@ -16,8 +18,6 @@ import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
-import org.cef.callback.CefStringVisitor;
-
@SuppressWarnings("serial")
public class ShowTextDialog extends JDialog implements CefStringVisitor {
private final JTextArea textArea_ = new JTextArea();
diff --git a/java_tests/tests/detailed/dialog/UrlRequestDialog.java b/java_tests/tests/detailed/dialog/UrlRequestDialog.java
index 3b19035..b1cc175 100644
--- a/java_tests/tests/detailed/dialog/UrlRequestDialog.java
+++ b/java_tests/tests/detailed/dialog/UrlRequestDialog.java
@@ -4,6 +4,11 @@
package tests.detailed.dialog;
+import org.cef.network.CefPostData;
+import org.cef.network.CefPostDataElement;
+import org.cef.network.CefRequest;
+import org.cef.network.CefRequest.CefUrlRequestFlags;
+
import java.awt.BorderLayout;
import java.awt.Frame;
import java.awt.GridBagConstraints;
@@ -32,11 +37,6 @@ import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.table.AbstractTableModel;
-import org.cef.network.CefPostData;
-import org.cef.network.CefPostDataElement;
-import org.cef.network.CefRequest;
-import org.cef.network.CefRequest.CefUrlRequestFlags;
-
@SuppressWarnings("serial")
public class UrlRequestDialog extends JDialog {
private final Vector<JRadioButton> requestMethods = new Vector<>();
diff --git a/java_tests/tests/detailed/handler/ClientSchemeHandler.java b/java_tests/tests/detailed/handler/ClientSchemeHandler.java
index c1eef91..2ee156f 100644
--- a/java_tests/tests/detailed/handler/ClientSchemeHandler.java
+++ b/java_tests/tests/detailed/handler/ClientSchemeHandler.java
@@ -4,10 +4,6 @@
package tests.detailed.handler;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
import org.cef.callback.CefCallback;
import org.cef.handler.CefResourceHandlerAdapter;
import org.cef.misc.IntRef;
@@ -15,6 +11,10 @@ import org.cef.misc.StringRef;
import org.cef.network.CefRequest;
import org.cef.network.CefResponse;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
/**
* The example for the second scheme with domain handling is a more
* complex example and is taken from the parent project CEF. Please
diff --git a/java_tests/tests/detailed/handler/ContextMenuHandler.java b/java_tests/tests/detailed/handler/ContextMenuHandler.java
index 6d52c29..c18c76b 100644
--- a/java_tests/tests/detailed/handler/ContextMenuHandler.java
+++ b/java_tests/tests/detailed/handler/ContextMenuHandler.java
@@ -4,11 +4,6 @@
package tests.detailed.handler;
-import java.awt.Frame;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Vector;
-
import org.cef.browser.CefBrowser;
import org.cef.browser.CefFrame;
import org.cef.callback.CefContextMenuParams;
@@ -16,6 +11,11 @@ import org.cef.callback.CefMenuModel;
import org.cef.callback.CefMenuModel.MenuId;
import org.cef.handler.CefContextMenuHandler;
+import java.awt.Frame;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Vector;
+
import tests.detailed.dialog.SearchDialog;
import tests.detailed.dialog.ShowTextDialog;
diff --git a/java_tests/tests/detailed/handler/ResourceHandler.java b/java_tests/tests/detailed/handler/ResourceHandler.java
index 968a278..4a36e0e 100644
--- a/java_tests/tests/detailed/handler/ResourceHandler.java
+++ b/java_tests/tests/detailed/handler/ResourceHandler.java
@@ -1,7 +1,5 @@
package tests.detailed.handler;
-import java.nio.ByteBuffer;
-
import org.cef.callback.CefCallback;
import org.cef.handler.CefLoadHandler;
import org.cef.handler.CefResourceHandlerAdapter;
@@ -10,6 +8,8 @@ import org.cef.misc.StringRef;
import org.cef.network.CefRequest;
import org.cef.network.CefResponse;
+import java.nio.ByteBuffer;
+
public class ResourceHandler extends CefResourceHandlerAdapter {
private int startPos = 0;
private static final String html = new String("<html>\n"
diff --git a/java_tests/tests/detailed/ui/ControlPanel.java b/java_tests/tests/detailed/ui/ControlPanel.java
index 057fa8a..c3923dc 100644
--- a/java_tests/tests/detailed/ui/ControlPanel.java
+++ b/java_tests/tests/detailed/ui/ControlPanel.java
@@ -4,6 +4,9 @@
package tests.detailed.ui;
+import org.cef.OS;
+import org.cef.browser.CefBrowser;
+
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
@@ -18,9 +21,6 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
-import org.cef.OS;
-import org.cef.browser.CefBrowser;
-
@SuppressWarnings("serial")
public class ControlPanel extends JPanel {
private final JButton backButton_;
diff --git a/java_tests/tests/detailed/ui/MenuBar.java b/java_tests/tests/detailed/ui/MenuBar.java
index c7e2b9c..b606aa2 100644
--- a/java_tests/tests/detailed/ui/MenuBar.java
+++ b/java_tests/tests/detailed/ui/MenuBar.java
@@ -157,10 +157,10 @@ public class MenuBar extends JMenuBar {
File selectedFile = fc.getSelectedFile();
if (selectedFile != null) {
CefPdfPrintSettings pdfSettings = new CefPdfPrintSettings();
- pdfSettings.header_footer_enabled = true;
- // A4 page size
- pdfSettings.page_width = 210000;
- pdfSettings.page_height = 297000;
+ pdfSettings.display_header_footer = true;
+ // letter page size
+ pdfSettings.paper_width = 8.5;
+ pdfSettings.paper_height = 11;
browser.printToPDF(
selectedFile.getAbsolutePath(), pdfSettings, new CefPdfPrintCallback() {
@Override
@@ -496,8 +496,7 @@ public class MenuBar extends JMenuBar {
CompletableFuture<BufferedImage> shot = browser.createScreenshot(false);
shot.thenAccept((image) -> {
System.out.println("Took screenshot asynchronously in "
- + TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start)
- + " msecs");
+ + TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start) + " msecs");
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
diff --git a/native/CefBrowser_N.cpp b/native/CefBrowser_N.cpp
index 4fb18de..d0cfca0 100644
--- a/native/CefBrowser_N.cpp
+++ b/native/CefBrowser_N.cpp
@@ -1086,33 +1086,18 @@ CefPdfPrintSettings GetJNIPdfPrintSettings(JNIEnv* env, jobject obj) {
if (!cls)
return settings;
- GetJNIFieldBoolean(env, cls, obj, "header_footer_enabled",
- &settings.header_footer_enabled);
-
- if (GetJNIFieldString(env, cls, obj, "header_footer_title", &tmp) &&
- !tmp.empty()) {
- CefString(&settings.header_footer_title) = tmp;
- tmp.clear();
- }
-
- if (GetJNIFieldString(env, cls, obj, "header_footer_url", &tmp) &&
- !tmp.empty()) {
- CefString(&settings.header_footer_url) = tmp;
- tmp.clear();
- }
-
GetJNIFieldBoolean(env, cls, obj, "landscape", &settings.landscape);
- GetJNIFieldBoolean(env, cls, obj, "backgrounds_enabled",
- &settings.backgrounds_enabled);
+ GetJNIFieldBoolean(env, cls, obj, "print_background",
+ &settings.print_background);
- GetJNIFieldInt(env, cls, obj, "page_width", &settings.page_width);
+ GetJNIFieldDouble(env, cls, obj, "scale", &settings.scale);
- GetJNIFieldInt(env, cls, obj, "page_height", &settings.page_height);
+ GetJNIFieldDouble(env, cls, obj, "paper_width", &settings.paper_width);
+ GetJNIFieldDouble(env, cls, obj, "paper_height", &settings.paper_height);
- GetJNIFieldBoolean(env, cls, obj, "selection_only", &settings.selection_only);
-
- GetJNIFieldInt(env, cls, obj, "scale_factor", &settings.scale_factor);
+ GetJNIFieldBoolean(env, cls, obj, "prefer_css_page_size",
+ &settings.prefer_css_page_size);
jobject obj_margin_type = nullptr;
if (GetJNIFieldObject(env, cls, obj, "margin_type", &obj_margin_type,
@@ -1128,19 +1113,35 @@ CefPdfPrintSettings GetJNIPdfPrintSettings(JNIEnv* env, jobject obj) {
settings.margin_type = PDF_PRINT_MARGIN_NONE;
} else if (IsJNIEnumValue(env, margin_type,
"org/cef/misc/CefPdfPrintSettings$MarginType",
- "MINIMUM")) {
- settings.margin_type = PDF_PRINT_MARGIN_MINIMUM;
- } else if (IsJNIEnumValue(env, margin_type,
- "org/cef/misc/CefPdfPrintSettings$MarginType",
"CUSTOM")) {
settings.margin_type = PDF_PRINT_MARGIN_CUSTOM;
}
}
- GetJNIFieldInt(env, cls, obj, "margin_top", &settings.margin_top);
- GetJNIFieldInt(env, cls, obj, "margin_bottom", &settings.margin_bottom);
- GetJNIFieldInt(env, cls, obj, "margin_right", &settings.margin_right);
- GetJNIFieldInt(env, cls, obj, "margin_left", &settings.margin_left);
+ GetJNIFieldDouble(env, cls, obj, "margin_top", &settings.margin_top);
+ GetJNIFieldDouble(env, cls, obj, "margin_bottom", &settings.margin_bottom);
+ GetJNIFieldDouble(env, cls, obj, "margin_right", &settings.margin_right);
+ GetJNIFieldDouble(env, cls, obj, "margin_left", &settings.margin_left);
+
+ if (GetJNIFieldString(env, cls, obj, "page_ranges", &tmp) && !tmp.empty()) {
+ CefString(&settings.page_ranges) = tmp;
+ tmp.clear();
+ }
+
+ GetJNIFieldBoolean(env, cls, obj, "display_header_footer",
+ &settings.display_header_footer);
+
+ if (GetJNIFieldString(env, cls, obj, "header_template", &tmp) &&
+ !tmp.empty()) {
+ CefString(&settings.header_template) = tmp;
+ tmp.clear();
+ }
+
+ if (GetJNIFieldString(env, cls, obj, "footer_template", &tmp) &&
+ !tmp.empty()) {
+ CefString(&settings.footer_template) = tmp;
+ tmp.clear();
+ }
return settings;
}
@@ -1544,9 +1545,9 @@ Java_org_cef_browser_CefBrowser_1N_N_1RunFileDialog(JNIEnv* env,
mode = FILE_DIALOG_OPEN;
}
- browser->GetHost()->RunFileDialog(mode, GetJNIString(env, jtitle),
- GetJNIString(env, jdefaultFilePath),
- accept_types, new RunFileDialogCallback(env, jcallback));
+ browser->GetHost()->RunFileDialog(
+ mode, GetJNIString(env, jtitle), GetJNIString(env, jdefaultFilePath),
+ accept_types, new RunFileDialogCallback(env, jcallback));
}
JNIEXPORT void JNICALL
diff --git a/native/CefCookieManager_N.cpp b/native/CefCookieManager_N.cpp
index d1cca3f..1c294fc 100644
--- a/native/CefCookieManager_N.cpp
+++ b/native/CefCookieManager_N.cpp
@@ -33,7 +33,7 @@ CefCookie GetJNICookie(JNIEnv* env, jobject jcookie) {
CefString value(&cookie.value);
CefString domain(&cookie.domain);
CefString path(&cookie.path);
- CefTime creation, lastAccess, expires;
+ CefBaseTime creation, lastAccess, expires;
GetJNIFieldString(env, cls, jcookie, "name", &name);
GetJNIFieldString(env, cls, jcookie, "value", &value);
diff --git a/native/CefFileDialogCallback_N.cpp b/native/CefFileDialogCallback_N.cpp
index af865c8..d516387 100644
--- a/native/CefFileDialogCallback_N.cpp
+++ b/native/CefFileDialogCallback_N.cpp
@@ -22,11 +22,10 @@ void ClearSelf(JNIEnv* env, jobject obj) {
} // namespace
JNIEXPORT void JNICALL
-Java_org_cef_callback_CefFileDialogCallback_1N_N_1Continue(
- JNIEnv* env,
- jobject obj,
- jlong self,
- jobject jFilePaths) {
+Java_org_cef_callback_CefFileDialogCallback_1N_N_1Continue(JNIEnv* env,
+ jobject obj,
+ jlong self,
+ jobject jFilePaths) {
CefRefPtr<CefFileDialogCallback> callback = GetSelf(self);
if (!callback)
return;
diff --git a/native/CefMessageRouter_N.cpp b/native/CefMessageRouter_N.cpp
index bedf57b..ab3c3a8 100644
--- a/native/CefMessageRouter_N.cpp
+++ b/native/CefMessageRouter_N.cpp
@@ -109,12 +109,11 @@ Java_org_cef_browser_CefMessageRouter_1N_N_1RemoveHandler(
},
msgRouter, routerHandler));
}
-
-
+
// Remove JNI reference on jrouterhandler added by the ScopedJNIObject
SetCefForJNIObject_sync<MessageRouterHandler>(env, jrouterHandler, nullptr,
"CefMessageRouterHandler");
-
+
return JNI_TRUE;
}
diff --git a/native/dialog_handler.cpp b/native/dialog_handler.cpp
index 1e47813..30acb46 100644
--- a/native/dialog_handler.cpp
+++ b/native/dialog_handler.cpp
@@ -63,8 +63,7 @@ bool DialogHandler::OnFileDialog(CefRefPtr<CefBrowser> browser,
"CefDialogHandler$FileDialogMode;Ljava/lang/String;Ljava/lang/"
"String;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(), jcallback.get());
if (jreturn == JNI_FALSE) {
// If the Java method returns "false" the callback won't be used and
diff --git a/native/jni_scoped_helpers.cpp b/native/jni_scoped_helpers.cpp
index 283cbf3..b3ad7f0 100644
--- a/native/jni_scoped_helpers.cpp
+++ b/native/jni_scoped_helpers.cpp
@@ -120,11 +120,13 @@ jobject NewJNIStringRef(JNIEnv* env, const CefString& initValue) {
return jstringRef.Release();
}
-jobject NewJNIDate(JNIEnv* env, const CefTime& time) {
+jobject NewJNIDate(JNIEnv* env, const CefBaseTime& time) {
ScopedJNIObjectLocal jdate(env, "java/util/Date");
if (!jdate)
return nullptr;
- double timestamp = time.GetDoubleT() * 1000;
+ CefTime cef_time;
+ cef_time_from_basetime(time, &cef_time);
+ double timestamp = cef_time.GetDoubleT() * 1000;
JNI_CALL_VOID_METHOD(env, jdate, "setTime", "(J)V", (jlong)timestamp);
return jdate.Release();
}
@@ -294,7 +296,7 @@ ScopedJNIString::ScopedJNIString(JNIEnv* env, const CefString& str)
DCHECK(jhandle_);
}
-ScopedJNIDate::ScopedJNIDate(JNIEnv* env, const CefTime& time)
+ScopedJNIDate::ScopedJNIDate(JNIEnv* env, const CefBaseTime& time)
: ScopedJNIBase<jobject>(env) {
jhandle_ = NewJNIDate(env, time);
DCHECK(jhandle_);
diff --git a/native/jni_scoped_helpers.h b/native/jni_scoped_helpers.h
index 735d258..336add1 100644
--- a/native/jni_scoped_helpers.h
+++ b/native/jni_scoped_helpers.h
@@ -688,7 +688,7 @@ class ScopedJNIString : public ScopedJNIBase<jstring> {
// JNI date.
class ScopedJNIDate : public ScopedJNIBase<jobject> {
public:
- ScopedJNIDate(JNIEnv* env, const CefTime& time);
+ ScopedJNIDate(JNIEnv* env, const CefBaseTime& time);
};
// JNI cookie.
diff --git a/native/jni_util.cpp b/native/jni_util.cpp
index 9687059..b224366 100644
--- a/native/jni_util.cpp
+++ b/native/jni_util.cpp
@@ -9,6 +9,8 @@
#include "jni_scoped_helpers.h"
+#include "include/cef_base.h"
+
namespace {
JavaVM* g_jvm = nullptr;
@@ -809,14 +811,16 @@ bool GetJNIFieldDate(JNIEnv* env,
jclass cls,
jobject obj,
const char* field_name,
- CefTime* value) {
+ CefBaseTime* value) {
jobject fieldobj = nullptr;
if (GetJNIFieldObject(env, cls, obj, field_name, &fieldobj,
"Ljava/util/Date;")) {
ScopedJNIObjectLocal jdate(env, fieldobj);
long timestamp = 0;
JNI_CALL_METHOD(env, jdate, "getTime", "()J", Long, timestamp);
- value->SetDoubleT((double)(timestamp / 1000));
+ CefTime cef_time;
+ cef_time.SetDoubleT((double)(timestamp / 1000));
+ cef_time_to_basetime(&cef_time, value);
return true;
}
return false;
diff --git a/native/jni_util.h b/native/jni_util.h
index 790d2b9..268c83c 100644
--- a/native/jni_util.h
+++ b/native/jni_util.h
@@ -110,7 +110,7 @@ bool GetJNIFieldDate(JNIEnv* env,
jclass cls,
jobject obj,
const char* field_name,
- CefTime* value);
+ CefBaseTime* value);
bool GetJNIFieldBoolean(JNIEnv* env,
jclass cls,
diff --git a/native/resource_handler.cpp b/native/resource_handler.cpp
index e436870..40d1e21 100644
--- a/native/resource_handler.cpp
+++ b/native/resource_handler.cpp
@@ -44,7 +44,7 @@ void ResourceHandler::GetResponseHeaders(CefRefPtr<CefResponse> response,
ScopedJNIResponse jresponse(env, response);
jresponse.SetTemporary();
- ScopedJNIIntRef jresponseLength(env, response_length);
+ ScopedJNIIntRef jresponseLength(env, (int)response_length);
ScopedJNIStringRef jredirectUrl(env, redirectUrl);
JNI_CALL_VOID_METHOD(env, handle_, "getResponseHeaders",
diff --git a/native/run_file_dialog_callback.cpp b/native/run_file_dialog_callback.cpp
index 35461fc..e7f946f 100644
--- a/native/run_file_dialog_callback.cpp
+++ b/native/run_file_dialog_callback.cpp
@@ -19,6 +19,5 @@ void RunFileDialogCallback::OnFileDialogDismissed(
ScopedJNIObjectLocal jfilePaths(env, NewJNIStringVector(env, file_paths));
JNI_CALL_VOID_METHOD(env, handle_, "onFileDialogDismissed",
- "(Ljava/util/Vector;)V",
- jfilePaths.get());
+ "(Ljava/util/Vector;)V", jfilePaths.get());
}
diff --git a/tools/buildtools/README.jcef b/tools/buildtools/README.jcef
index 18e2ad0..298b17d 100644
--- a/tools/buildtools/README.jcef
+++ b/tools/buildtools/README.jcef
@@ -1,8 +1,8 @@
Name: depot_tools
Short Name: depot_tools
URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git
-Date: 11 Jan 2020
-Revision: 7a8bf9489
+Date: 21 Sep 2022
+Revision: 08bb5c487f
License: BSD
License File: LICENSE
@@ -11,4 +11,3 @@ Select tools extracted from depot_tools.
Local Modifications:
- Remove dependency on vpython.
-- Update gsutil version to 4.68.
diff --git a/tools/buildtools/download_from_google_storage.py b/tools/buildtools/download_from_google_storage.py
index b627017..fb3fb98 100644
--- a/tools/buildtools/download_from_google_storage.py
+++ b/tools/buildtools/download_from_google_storage.py
@@ -1,8 +1,7 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-
"""Download files from Google Storage based on SHA1 sums."""
from __future__ import print_function
@@ -45,9 +44,10 @@ PLATFORM_MAPPING = {
'aix7': 'aix',
}
-
-class FileNotFoundError(IOError):
- pass
+if sys.version_info.major == 2:
+ # pylint: disable=redefined-builtin
+ class FileNotFoundError(IOError):
+ pass
class InvalidFileError(IOError):
@@ -78,12 +78,11 @@ class Gsutil(object):
RETRY_BASE_DELAY = 5.0
RETRY_DELAY_MULTIPLE = 1.3
- def __init__(self, path, boto_path=None, version='4.68'):
+ def __init__(self, path, boto_path=None):
if not os.path.exists(path):
raise FileNotFoundError('GSUtil not found in %s' % path)
self.path = path
self.boto_path = boto_path
- self.version = version
def get_sub_env(self):
env = os.environ.copy()
@@ -100,12 +99,12 @@ class Gsutil(object):
return env
def call(self, *args):
- cmd = [sys.executable, self.path, '--force-version', self.version]
+ cmd = [sys.executable, self.path]
cmd.extend(args)
return subprocess2.call(cmd, env=self.get_sub_env())
def check_call(self, *args):
- cmd = [sys.executable, self.path, '--force-version', self.version]
+ cmd = [sys.executable, self.path]
cmd.extend(args)
((out, err), code) = subprocess2.communicate(
cmd,
@@ -129,7 +128,7 @@ class Gsutil(object):
def check_call_with_retries(self, *args):
delay = self.RETRY_BASE_DELAY
- for i in xrange(self.MAX_TRIES):
+ for i in range(self.MAX_TRIES):
code, out, err = self.check_call(*args)
if not code or i == self.MAX_TRIES - 1:
break
@@ -254,40 +253,59 @@ def _downloader_worker_thread(thread_num, q, force, base_url,
continue
extract_dir = output_filename[:-len('.tar.gz')]
if os.path.exists(output_filename) and not force:
- if not extract or os.path.exists(extract_dir):
- if get_sha1(output_filename) == input_sha1_sum:
- continue
- # Check if file exists.
+ skip = get_sha1(output_filename) == input_sha1_sum
+ if extract:
+ # Additional condition for extract:
+ # 1) extract_dir must exist
+ # 2) .tmp flag file mustn't exist
+ if not os.path.exists(extract_dir):
+ out_q.put('%d> Extract dir %s does not exist, re-downloading...' %
+ (thread_num, extract_dir))
+ skip = False
+ # .tmp file is created just before extraction and removed just after
+ # extraction. If such file exists, it means the process was terminated
+ # mid-extraction and therefore needs to be extracted again.
+ elif os.path.exists(extract_dir + '.tmp'):
+ out_q.put('%d> Detected tmp flag file for %s, '
+ 're-downloading...' % (thread_num, output_filename))
+ skip = False
+ if skip:
+ continue
+
file_url = '%s/%s' % (base_url, input_sha1_sum)
- (code, _, err) = gsutil.check_call('ls', file_url)
+
+ try:
+ if delete:
+ os.remove(output_filename) # Delete the file if it exists already.
+ except OSError:
+ if os.path.exists(output_filename):
+ out_q.put('%d> Warning: deleting %s failed.' % (
+ thread_num, output_filename))
+ if verbose:
+ out_q.put('%d> Downloading %s@%s...' % (
+ thread_num, output_filename, input_sha1_sum))
+ code, _, err = gsutil.check_call('cp', file_url, output_filename)
if code != 0:
if code == 404:
out_q.put('%d> File %s for %s does not exist, skipping.' % (
thread_num, file_url, output_filename))
ret_codes.put((1, 'File %s for %s does not exist.' % (
file_url, output_filename)))
+ elif code == 401:
+ out_q.put(
+ """%d> Failed to fetch file %s for %s due to unauthorized access,
+ skipping. Try running `gsutil.py config` and pass 0 if you don't
+ know your project id.""" % (thread_num, file_url, output_filename))
+ ret_codes.put(
+ (1, 'Failed to fetch file %s for %s due to unauthorized access.' %
+ (file_url, output_filename)))
else:
# Other error, probably auth related (bad ~/.boto, etc).
out_q.put('%d> Failed to fetch file %s for %s, skipping. [Err: %s]' %
(thread_num, file_url, output_filename, err))
- ret_codes.put((1, 'Failed to fetch file %s for %s. [Err: %s]' %
+ ret_codes.put((code, 'Failed to fetch file %s for %s. [Err: %s]' %
(file_url, output_filename, err)))
continue
- # Fetch the file.
- if verbose:
- out_q.put('%d> Downloading %s...' % (thread_num, output_filename))
- try:
- if delete:
- os.remove(output_filename) # Delete the file if it exists already.
- except OSError:
- if os.path.exists(output_filename):
- out_q.put('%d> Warning: deleting %s failed.' % (
- thread_num, output_filename))
- code, _, err = gsutil.check_call('cp', file_url, output_filename)
- if code != 0:
- out_q.put('%d> %s' % (thread_num, err))
- ret_codes.put((code, err))
- continue
remote_sha1 = get_sha1(output_filename)
if remote_sha1 != input_sha1_sum:
@@ -327,7 +345,9 @@ def _downloader_worker_thread(thread_num, q, force, base_url,
out_q.put('%d> Extracting %d entries from %s to %s' %
(thread_num, len(tar.getmembers()),output_filename,
extract_dir))
- tar.extractall(path=dirname)
+ with open(extract_dir + '.tmp', 'a'):
+ tar.extractall(path=dirname)
+ os.remove(extract_dir + '.tmp')
# Set executable bit.
if sys.platform == 'cygwin':
# Under cygwin, mark all files as executable. The executable flag in
@@ -373,7 +393,7 @@ def _data_exists(input_sha1_sum, output_filename, extract):
input_sha1_sum: Expected sha1 stored on disk.
output_filename: The file to potentially download later. Its sha1 will be
compared to input_sha1_sum.
- extract: Wheather or not a downloaded file should be extracted. If the file
+ extract: Whether or not a downloaded file should be extracted. If the file
is not extracted, this just compares the sha1 of the file. If the file
is to be extracted, this only compares the sha1 of the target archive if
the target directory already exists. The content of the target directory
diff --git a/tools/buildtools/gsutil.py b/tools/buildtools/gsutil.py
index 63847d2..cff91fa 100644
--- a/tools/buildtools/gsutil.py
+++ b/tools/buildtools/gsutil.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -31,11 +31,11 @@ API_URL = 'https://www.googleapis.com/storage/v1/b/pub/o/'
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
DEFAULT_BIN_DIR = os.path.join(THIS_DIR, 'external_bin', 'gsutil')
-DEFAULT_FALLBACK_GSUTIL = os.path.join(
- THIS_DIR, 'third_party', 'gsutil', 'gsutil')
IS_WINDOWS = os.name == 'nt'
+VERSION = '4.68'
+
class InvalidGsutilError(Exception):
pass
@@ -79,7 +79,7 @@ def download_gsutil(version, target_dir):
@contextlib.contextmanager
def temporary_directory(base):
- tmpdir = tempfile.mkdtemp(prefix='gsutil_py', dir=base)
+ tmpdir = tempfile.mkdtemp(prefix='t', dir=base)
try:
yield tmpdir
finally:
@@ -98,7 +98,20 @@ def ensure_gsutil(version, target, clean):
return gsutil_bin
if not os.path.exists(target):
- os.makedirs(target)
+ try:
+ os.makedirs(target)
+ except FileExistsError:
+ # Another process is prepping workspace, so let's check if gsutil_bin is
+ # present. If after several checks it's still not, continue with
+ # downloading gsutil.
+ delay = 2 # base delay, in seconds
+ for _ in range(3): # make N attempts
+ # sleep first as it's not expected to have file ready just yet.
+ time.sleep(delay)
+ delay *= 1.5 # next delay increased by that factor
+ if os.path.isfile(gsutil_bin):
+ return gsutil_bin
+
with temporary_directory(target) as instance_dir:
# Clean up if we're redownloading a corrupted gsutil.
cleanup_path = os.path.join(instance_dir, 'clean')
@@ -109,16 +122,12 @@ def ensure_gsutil(version, target, clean):
if cleanup_path:
shutil.rmtree(cleanup_path)
- download_dir = os.path.join(instance_dir, 'download')
+ download_dir = os.path.join(instance_dir, 'd')
target_zip_filename = download_gsutil(version, instance_dir)
with zipfile.ZipFile(target_zip_filename, 'r') as target_zip:
target_zip.extractall(download_dir)
- try:
- os.rename(download_dir, bin_dir)
- except (OSError, IOError):
- # Something else did this in parallel.
- pass
+ shutil.move(download_dir, bin_dir)
# Final check that the gsutil bin exists. This should never fail.
if not os.path.isfile(gsutil_bin):
raise InvalidGsutilError()
@@ -129,29 +138,45 @@ def ensure_gsutil(version, target, clean):
return gsutil_bin
-def run_gsutil(force_version, fallback, target, args, clean=False):
- if force_version:
- gsutil_bin = ensure_gsutil(force_version, target, clean)
- else:
- gsutil_bin = fallback
- disable_update = ['-o', 'GSUtil:software_update_check_period=0']
- cmd = [sys.executable, gsutil_bin] + disable_update + args
- return subprocess.call(cmd)
+def run_gsutil(target, args, clean=False):
+ gsutil_bin = ensure_gsutil(VERSION, target, clean)
+ args_opt = ['-o', 'GSUtil:software_update_check_period=0']
+ if sys.platform == 'darwin':
+ # We are experiencing problems with multiprocessing on MacOS where gsutil.py
+ # may hang.
+ # This behavior is documented in gsutil codebase, and recommendation is to
+ # set GSUtil:parallel_process_count=1.
+ # https://github.com/GoogleCloudPlatform/gsutil/blob/06efc9dc23719fab4fd5fadb506d252bbd3fe0dd/gslib/command.py#L1331
+ # https://github.com/GoogleCloudPlatform/gsutil/issues/1100
+ args_opt.extend(['-o', 'GSUtil:parallel_process_count=1'])
+ assert sys.platform != 'cygwin'
+ cmd = [
+ sys.executable,
+ gsutil_bin
+ ] + args_opt + args
+ return subprocess.call(cmd, shell=IS_WINDOWS)
def parse_args():
bin_dir = os.environ.get('DEPOT_TOOLS_GSUTIL_BIN_DIR', DEFAULT_BIN_DIR)
- parser = argparse.ArgumentParser()
- parser.add_argument('--force-version', default='4.30')
+ # Help is disabled as it conflicts with gsutil -h, which controls headers.
+ parser = argparse.ArgumentParser(add_help=False)
+
parser.add_argument('--clean', action='store_true',
help='Clear any existing gsutil package, forcing a new download.')
- parser.add_argument('--fallback', default=DEFAULT_FALLBACK_GSUTIL)
parser.add_argument('--target', default=bin_dir,
help='The target directory to download/store a gsutil version in. '
'(default is %(default)s).')
+
+ # These two args exist for backwards-compatibility but are no-ops.
+ parser.add_argument('--force-version', default=VERSION,
+ help='(deprecated, this flag has no effect)')
+ parser.add_argument('--fallback',
+ help='(deprecated, this flag has no effect)')
+
parser.add_argument('args', nargs=argparse.REMAINDER)
args, extras = parser.parse_known_args()
@@ -164,8 +189,7 @@ def parse_args():
def main():
args = parse_args()
- return run_gsutil(args.force_version, args.fallback, args.target, args.args,
- clean=args.clean)
+ return run_gsutil(args.target, args.args, clean=args.clean)
if __name__ == '__main__':
diff --git a/tools/buildtools/linux64/clang-format.sha1 b/tools/buildtools/linux64/clang-format.sha1
index e2b3199..6f3349c 100644
--- a/tools/buildtools/linux64/clang-format.sha1
+++ b/tools/buildtools/linux64/clang-format.sha1
@@ -1 +1 @@
-942fc8b1789144b8071d3fc03ff0fcbe1cf81ac8 \ No newline at end of file
+dd736afb28430c9782750fc0fd5f0ed497399263 \ No newline at end of file
diff --git a/tools/buildtools/mac/clang-format.arm64.sha1 b/tools/buildtools/mac/clang-format.arm64.sha1
new file mode 100644
index 0000000..46f9b3c
--- /dev/null
+++ b/tools/buildtools/mac/clang-format.arm64.sha1
@@ -0,0 +1 @@
+f1424c44ee758922823d6b37de43705955c99d7e \ No newline at end of file
diff --git a/tools/buildtools/mac/clang-format.sha1 b/tools/buildtools/mac/clang-format.sha1
deleted file mode 100644
index d32c626..0000000
--- a/tools/buildtools/mac/clang-format.sha1
+++ /dev/null
@@ -1 +0,0 @@
-025ca7c75f37ef4a40f3a67d81ddd11d7d0cdb9b \ No newline at end of file
diff --git a/tools/buildtools/mac/clang-format.x64.sha1 b/tools/buildtools/mac/clang-format.x64.sha1
new file mode 100644
index 0000000..3a23ea2
--- /dev/null
+++ b/tools/buildtools/mac/clang-format.x64.sha1
@@ -0,0 +1 @@
+a1b33be85faf2578f3101d7806e443e1c0949498 \ No newline at end of file
diff --git a/tools/buildtools/subprocess2.py b/tools/buildtools/subprocess2.py
index dea1a2d..7df49da 100644
--- a/tools/buildtools/subprocess2.py
+++ b/tools/buildtools/subprocess2.py
@@ -21,18 +21,18 @@ import threading
if sys.version_info.major == 2:
import Queue
codecs.lookup('string-escape')
+ # Sends stdout or stderr to os.devnull.
+ DEVNULL = open(os.devnull, 'r+')
else:
import queue as Queue
# pylint: disable=redefined-builtin
basestring = (str, bytes)
+ DEVNULL = subprocess.DEVNULL
# Constants forwarded from subprocess.
PIPE = subprocess.PIPE
STDOUT = subprocess.STDOUT
-# Sends stdout or stderr to os.devnull.
-VOID = open(os.devnull, 'w')
-VOID_INPUT = open(os.devnull, 'r')
class CalledProcessError(subprocess.CalledProcessError):
@@ -48,7 +48,11 @@ class CalledProcessError(subprocess.CalledProcessError):
' '.join(self.cmd), self.returncode)
if self.cwd:
out += ' in ' + self.cwd
- return '\n'.join(filter(None, (out, self.stdout, self.stderr)))
+ if self.stdout:
+ out += '\n' + self.stdout.decode('utf-8', 'ignore')
+ if self.stderr:
+ out += '\n' + self.stderr.decode('utf-8', 'ignore')
+ return out
class CygwinRebaseError(CalledProcessError):
@@ -103,7 +107,7 @@ class Popen(subprocess.Popen):
in English.
- Sets shell=True on windows by default. You can override this by forcing
shell parameter to a value.
- - Adds support for VOID to not buffer when not needed.
+ - Adds support for DEVNULL to not buffer when not needed.
- Adds self.start property.
Note: Popen() can throw OSError when cwd or args[0] doesn't exist. Translate
@@ -121,6 +125,17 @@ class Popen(subprocess.Popen):
env = get_english_env(kwargs.get('env'))
if env:
kwargs['env'] = env
+ if kwargs.get('env') is not None and sys.version_info.major != 2:
+ # Subprocess expects environment variables to be strings in Python 3.
+ def ensure_str(value):
+ if isinstance(value, bytes):
+ return value.decode()
+ return value
+
+ kwargs['env'] = {
+ ensure_str(k): ensure_str(v)
+ for k, v in kwargs['env'].items()
+ }
if kwargs.get('shell') is None:
# *Sigh*: Windows needs shell=True, or else it won't search %PATH% for
# the executable, but shell=True makes subprocess on Linux fail when it's
@@ -182,14 +197,16 @@ def communicate(args, **kwargs):
def call(args, **kwargs):
"""Emulates subprocess.call().
- Automatically convert stdout=PIPE or stderr=PIPE to VOID.
+ Automatically convert stdout=PIPE or stderr=PIPE to DEVNULL.
In no case they can be returned since no code path raises
subprocess2.CalledProcessError.
+
+ Returns exit code.
"""
if kwargs.get('stdout') == PIPE:
- kwargs['stdout'] = VOID
+ kwargs['stdout'] = DEVNULL
if kwargs.get('stderr') == PIPE:
- kwargs['stderr'] = VOID
+ kwargs['stderr'] = DEVNULL
return communicate(args, **kwargs)[1]
@@ -219,7 +236,7 @@ def capture(args, **kwargs):
- Discards returncode.
- Blocks stdin by default if not specified since no output will be visible.
"""
- kwargs.setdefault('stdin', VOID_INPUT)
+ kwargs.setdefault('stdin', DEVNULL)
# Like check_output, deny the caller from using stdout arg.
return communicate(args, stdout=PIPE, **kwargs)[0][0]
@@ -235,7 +252,7 @@ def check_output(args, **kwargs):
- Blocks stdin by default if not specified since no output will be visible.
- As per doc, "The stdout argument is not allowed as it is used internally."
"""
- kwargs.setdefault('stdin', VOID_INPUT)
+ kwargs.setdefault('stdin', DEVNULL)
if 'stdout' in kwargs:
raise ValueError('stdout argument not allowed, it would be overridden.')
return check_call_out(args, stdout=PIPE, **kwargs)[0]
diff --git a/tools/buildtools/win/clang-format.exe.sha1 b/tools/buildtools/win/clang-format.exe.sha1
index d31c76f..c7efe6f 100644
--- a/tools/buildtools/win/clang-format.exe.sha1
+++ b/tools/buildtools/win/clang-format.exe.sha1
@@ -1 +1 @@
-b5f5d8d5f8a8fcd2edb5b6cae37c0dc3e129c945 \ No newline at end of file
+66882fadbf9e99cc00b8677d8c1e7e8b3cfdf4fe \ No newline at end of file
diff --git a/tools/fix_style.sh b/tools/fix_style.sh
index c466ab0..042c01f 100755
--- a/tools/fix_style.sh
+++ b/tools/fix_style.sh
@@ -1,2 +1,2 @@
#!/bin/sh
-python tools/fix_style.py $@
+python3 tools/fix_style.py $@
diff --git a/tools/make_distrib.bat b/tools/make_distrib.bat
index 5deb8c9..f4863b1 100644
--- a/tools/make_distrib.bat
+++ b/tools/make_distrib.bat
@@ -75,8 +75,10 @@ copy %OUT_BINARY_PATH%\libGLESv2.dll %DISTRIB_LIB_PATH%
copy %OUT_BINARY_PATH%\natives_blob.bin %DISTRIB_LIB_PATH%
copy %OUT_BINARY_PATH%\snapshot_blob.bin %DISTRIB_LIB_PATH%
copy %OUT_BINARY_PATH%\v8_context_snapshot.bin %DISTRIB_LIB_PATH%
+copy %OUT_BINARY_PATH%\vk_swiftshader.dll %DISTRIB_LIB_PATH%
+copy %OUT_BINARY_PATH%\vk_swiftshader_icd.json %DISTRIB_LIB_PATH%
+copy %OUT_BINARY_PATH%\vulkan-1.dll %DISTRIB_LIB_PATH%
xcopy /sfy %OUT_BINARY_PATH%\*.pak %DISTRIB_LIB_PATH%
-xcopy /sfy %OUT_BINARY_PATH%\swiftshader\* %DISTRIB_LIB_PATH%\swiftshader\
:: Copy documentation to the docs directory.
xcopy /sfy %OUT_DOCS_PATH%\* %DISTRIB_DOCS_PATH%\
diff --git a/tools/make_distrib.sh b/tools/make_distrib.sh
index 1b66aba..909cf35 100755
--- a/tools/make_distrib.sh
+++ b/tools/make_distrib.sh
@@ -98,7 +98,9 @@ else
cp -f "$OUT_BINARY_PATH"/v8_context_snapshot.bin "$DISTRIB_LIB_PATH"
cp -f "$OUT_BINARY_PATH"/*.pak "$DISTRIB_LIB_PATH"
cp -rf "$OUT_BINARY_PATH"/locales/ "$DISTRIB_LIB_PATH"
- cp -rf "$OUT_BINARY_PATH"/swiftshader/ "$DISTRIB_LIB_PATH"
+ cp -f "$OUT_BINARY_PATH"/libvk_swiftshader.so "$DISTRIB_LIB_PATH"
+ cp -f "$OUT_BINARY_PATH"/vk_swiftshader_icd.json "$DISTRIB_LIB_PATH"
+ cp -f "$OUT_BINARY_PATH"/libvulkan.so.1 "$DISTRIB_LIB_PATH"
fi
fi