├── .clang-format ├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── .gitignore ├── .style.cfg ├── .style.yapf ├── AUTHORS.txt ├── CMakeLists.txt ├── LICENSE.txt ├── README.md ├── appveyor.yml ├── build.xml ├── cmake └── DownloadCEF.cmake ├── java ├── manifest │ └── MANIFEST.MF ├── org │ └── cef │ │ ├── CefApp.java │ │ ├── CefBrowserSettings.java │ │ ├── CefClient.java │ │ ├── CefSettings.java │ │ ├── OS.java │ │ ├── SystemBootstrap.java │ │ ├── browser │ │ ├── CefBrowser.java │ │ ├── CefBrowserFactory.java │ │ ├── CefBrowserOsr.java │ │ ├── CefBrowserWindow.java │ │ ├── CefBrowserWr.java │ │ ├── CefBrowser_N.java │ │ ├── CefDevToolsClient.java │ │ ├── CefDevToolsMessageObserver.java │ │ ├── CefDropTargetListener.java │ │ ├── CefFrame.java │ │ ├── CefFrame_N.java │ │ ├── CefMessageRouter.java │ │ ├── CefMessageRouter_N.java │ │ ├── CefPaintEvent.java │ │ ├── CefRegistration.java │ │ ├── CefRegistration_N.java │ │ ├── CefRenderer.java │ │ ├── CefRequestContext.java │ │ ├── CefRequestContext_N.java │ │ └── mac │ │ │ └── CefBrowserWindowMac.java │ │ ├── callback │ │ ├── CefAuthCallback.java │ │ ├── CefAuthCallback_N.java │ │ ├── CefBeforeDownloadCallback.java │ │ ├── CefBeforeDownloadCallback_N.java │ │ ├── CefCallback.java │ │ ├── CefCallback_N.java │ │ ├── CefCommandLine.java │ │ ├── CefCommandLine_N.java │ │ ├── CefCompletionCallback.java │ │ ├── CefContextMenuParams.java │ │ ├── CefContextMenuParams_N.java │ │ ├── CefCookieVisitor.java │ │ ├── CefDownloadItem.java │ │ ├── CefDownloadItemCallback.java │ │ ├── CefDownloadItemCallback_N.java │ │ ├── CefDownloadItem_N.java │ │ ├── CefDragData.java │ │ ├── CefDragData_N.java │ │ ├── CefFileDialogCallback.java │ │ ├── CefFileDialogCallback_N.java │ │ ├── CefJSDialogCallback.java │ │ ├── CefJSDialogCallback_N.java │ │ ├── CefMenuModel.java │ │ ├── CefMenuModel_N.java │ │ ├── CefNative.java │ │ ├── CefNativeAdapter.java │ │ ├── CefPdfPrintCallback.java │ │ ├── CefPrintDialogCallback.java │ │ ├── CefPrintDialogCallback_N.java │ │ ├── CefPrintJobCallback.java │ │ ├── CefPrintJobCallback_N.java │ │ ├── CefQueryCallback.java │ │ ├── CefQueryCallback_N.java │ │ ├── CefRunFileDialogCallback.java │ │ ├── CefSchemeHandlerFactory.java │ │ ├── CefSchemeRegistrar.java │ │ ├── CefSchemeRegistrar_N.java │ │ ├── CefStringVisitor.java │ │ └── CefURLRequestClient.java │ │ ├── handler │ │ ├── CefAppHandler.java │ │ ├── CefAppHandlerAdapter.java │ │ ├── CefClientHandler.java │ │ ├── CefContextMenuHandler.java │ │ ├── CefContextMenuHandlerAdapter.java │ │ ├── CefCookieAccessFilter.java │ │ ├── CefCookieAccessFilterAdapter.java │ │ ├── CefDialogHandler.java │ │ ├── CefDisplayHandler.java │ │ ├── CefDisplayHandlerAdapter.java │ │ ├── CefDownloadHandler.java │ │ ├── CefDownloadHandlerAdapter.java │ │ ├── CefDragHandler.java │ │ ├── CefFocusHandler.java │ │ ├── CefFocusHandlerAdapter.java │ │ ├── CefJSDialogHandler.java │ │ ├── CefJSDialogHandlerAdapter.java │ │ ├── CefKeyboardHandler.java │ │ ├── CefKeyboardHandlerAdapter.java │ │ ├── CefLifeSpanHandler.java │ │ ├── CefLifeSpanHandlerAdapter.java │ │ ├── CefLoadHandler.java │ │ ├── CefLoadHandlerAdapter.java │ │ ├── CefMessageRouterHandler.java │ │ ├── CefMessageRouterHandlerAdapter.java │ │ ├── CefPrintHandler.java │ │ ├── CefPrintHandlerAdapter.java │ │ ├── CefRenderHandler.java │ │ ├── CefRenderHandlerAdapter.java │ │ ├── CefRequestContextHandler.java │ │ ├── CefRequestContextHandlerAdapter.java │ │ ├── CefRequestHandler.java │ │ ├── CefRequestHandlerAdapter.java │ │ ├── CefResourceHandler.java │ │ ├── CefResourceHandlerAdapter.java │ │ ├── CefResourceRequestHandler.java │ │ ├── CefResourceRequestHandlerAdapter.java │ │ ├── CefScreenInfo.java │ │ ├── CefWindowHandler.java │ │ └── CefWindowHandlerAdapter.java │ │ ├── misc │ │ ├── BoolRef.java │ │ ├── CefPageRange.java │ │ ├── CefPdfPrintSettings.java │ │ ├── CefPrintSettings.java │ │ ├── CefPrintSettings_N.java │ │ ├── EventFlags.java │ │ ├── IntRef.java │ │ └── StringRef.java │ │ └── network │ │ ├── CefCookie.java │ │ ├── CefCookieManager.java │ │ ├── CefCookieManager_N.java │ │ ├── CefPostData.java │ │ ├── CefPostDataElement.java │ │ ├── CefPostDataElement_N.java │ │ ├── CefPostData_N.java │ │ ├── CefRequest.java │ │ ├── CefRequest_N.java │ │ ├── CefResponse.java │ │ ├── CefResponse_N.java │ │ ├── CefURLRequest.java │ │ └── CefURLRequest_N.java └── tests │ ├── detailed │ ├── BrowserFrame.java │ ├── MainFrame.java │ ├── dialog │ │ ├── CertErrorDialog.java │ │ ├── CookieManagerDialog.java │ │ ├── DevToolsDialog.java │ │ ├── DownloadDialog.java │ │ ├── PasswordDialog.java │ │ ├── SearchDialog.java │ │ ├── ShowTextDialog.java │ │ ├── UrlRequestDialog.java │ │ └── UrlRequestDialogReply.java │ ├── handler │ │ ├── AppHandler.java │ │ ├── ClientSchemeHandler.java │ │ ├── ContextMenuHandler.java │ │ ├── DragHandler.java │ │ ├── JSDialogHandler.java │ │ ├── KeyboardHandler.java │ │ ├── MessageRouterHandler.java │ │ ├── MessageRouterHandlerEx.java │ │ ├── RequestHandler.java │ │ ├── ResourceHandler.java │ │ ├── ResourceSetErrorHandler.java │ │ ├── SearchSchemeHandler.java │ │ ├── binding_test.html │ │ ├── binding_test2.html │ │ ├── localstorage.html │ │ ├── logo.png │ │ ├── spellcheck.html │ │ └── transparency.html │ ├── ui │ │ ├── ControlPanel.java │ │ ├── MenuBar.java │ │ └── StatusPanel.java │ └── util │ │ └── DataUri.java │ ├── junittests │ ├── DisplayHandlerTest.java │ ├── DragDataTest.java │ ├── TestFrame.java │ ├── TestFrameTest.java │ ├── TestResourceHandler.java │ ├── TestSetupContext.java │ └── TestSetupExtension.java │ └── simple │ └── MainFrame.java ├── native ├── CMakeLists.txt ├── CefApp.cpp ├── CefApp.h ├── CefAuthCallback_N.cpp ├── CefAuthCallback_N.h ├── CefBeforeDownloadCallback_N.cpp ├── CefBeforeDownloadCallback_N.h ├── CefBrowser_N.cpp ├── CefBrowser_N.h ├── CefCallback_N.cpp ├── CefCallback_N.h ├── CefClientHandler.cpp ├── CefClientHandler.h ├── CefCommandLine_N.cpp ├── CefCommandLine_N.h ├── CefContextMenuParams_N.cpp ├── CefContextMenuParams_N.h ├── CefCookieManager_N.cpp ├── CefCookieManager_N.h ├── CefDownloadItemCallback_N.cpp ├── CefDownloadItemCallback_N.h ├── CefDownloadItem_N.cpp ├── CefDownloadItem_N.h ├── CefDragData_N.cpp ├── CefDragData_N.h ├── CefFileDialogCallback_N.cpp ├── CefFileDialogCallback_N.h ├── CefFrame_N.cpp ├── CefFrame_N.h ├── CefJSDialogCallback_N.cpp ├── CefJSDialogCallback_N.h ├── CefMenuModel_N.cpp ├── CefMenuModel_N.h ├── CefMessageRouter_N.cpp ├── CefMessageRouter_N.h ├── CefPostDataElement_N.cpp ├── CefPostDataElement_N.h ├── CefPostData_N.cpp ├── CefPostData_N.h ├── CefPrintDialogCallback_N.cpp ├── CefPrintDialogCallback_N.h ├── CefPrintJobCallback_N.cpp ├── CefPrintJobCallback_N.h ├── CefPrintSettings_N.cpp ├── CefPrintSettings_N.h ├── CefQueryCallback_N.cpp ├── CefQueryCallback_N.h ├── CefRegistration_N.cpp ├── CefRegistration_N.h ├── CefRequestContext_N.cpp ├── CefRequestContext_N.h ├── CefRequest_N.cpp ├── CefRequest_N.h ├── CefResponse_N.cpp ├── CefResponse_N.h ├── CefSchemeRegistrar_N.cpp ├── CefSchemeRegistrar_N.h ├── CefURLRequest_N.cpp ├── CefURLRequest_N.h ├── browser_process_handler.cpp ├── browser_process_handler.h ├── client_app.cpp ├── client_app.h ├── client_handler.cpp ├── client_handler.h ├── compatibility.manifest ├── completion_callback.cpp ├── completion_callback.h ├── context.cpp ├── context.h ├── context_menu_handler.cpp ├── context_menu_handler.h ├── cookie_access_filter.cpp ├── cookie_access_filter.h ├── cookie_visitor.cpp ├── cookie_visitor.h ├── critical_wait.h ├── critical_wait_posix.cpp ├── critical_wait_win.cpp ├── devtools_message_observer.cpp ├── devtools_message_observer.h ├── dialog_handler.cpp ├── dialog_handler.h ├── display_handler.cpp ├── display_handler.h ├── download_handler.cpp ├── download_handler.h ├── drag_handler.cpp ├── drag_handler.h ├── focus_handler.cpp ├── focus_handler.h ├── int_callback.cpp ├── int_callback.h ├── jcef.dll.manifest ├── jcef_dll.rc ├── jcef_helper.cpp ├── jcef_helper.exe.manifest ├── jcef_helper.rc ├── jni_scoped_helpers.cpp ├── jni_scoped_helpers.h ├── jni_util.cpp ├── jni_util.h ├── jni_util_linux.cpp ├── jni_util_win.cpp ├── jsdialog_handler.cpp ├── jsdialog_handler.h ├── keyboard_handler.cpp ├── keyboard_handler.h ├── life_span_handler.cpp ├── life_span_handler.h ├── load_handler.cpp ├── load_handler.h ├── message_router_handler.cpp ├── message_router_handler.h ├── pdf_print_callback.cpp ├── pdf_print_callback.h ├── print_handler.cpp ├── print_handler.h ├── render_handler.cpp ├── render_handler.h ├── request_context_handler.cpp ├── request_context_handler.h ├── request_handler.cpp ├── request_handler.h ├── resource_handler.cpp ├── resource_handler.h ├── resource_request_handler.cpp ├── resource_request_handler.h ├── resources │ └── jcef-Info.plist ├── run_file_dialog_callback.cpp ├── run_file_dialog_callback.h ├── scheme_handler_factory.cpp ├── scheme_handler_factory.h ├── string_visitor.cpp ├── string_visitor.h ├── temp_window.h ├── temp_window_mac.h ├── temp_window_mac.mm ├── temp_window_win.cc ├── temp_window_win.h ├── temp_window_x11.cc ├── temp_window_x11.h ├── url_request_client.cpp ├── url_request_client.h ├── util.h ├── util_linux.cpp ├── util_mac.h ├── util_mac.mm ├── util_posix.cpp ├── util_win.cpp ├── window_handler.cpp ├── window_handler.h ├── write_handler.cpp └── write_handler.h ├── third_party ├── appbundler │ ├── AppBundler.html │ ├── README.jcef │ ├── appbundler-1.0.jar │ └── appbundler.LICENSE.txt ├── cef │ ├── README.jcef │ └── res │ │ └── CefIcon.icns ├── jogamp │ ├── README.jcef │ ├── gluegen.LICENSE.txt │ ├── jar │ │ ├── gluegen-rt-natives-linux-amd64.jar │ │ ├── gluegen-rt-natives-linux-i586.jar │ │ ├── gluegen-rt-natives-macosx-universal.jar │ │ ├── gluegen-rt-natives-windows-amd64.jar │ │ ├── gluegen-rt-natives-windows-i586.jar │ │ ├── gluegen-rt.jar │ │ ├── jogl-all-natives-linux-amd64.jar │ │ ├── jogl-all-natives-linux-i586.jar │ │ ├── jogl-all-natives-macosx-universal.jar │ │ ├── jogl-all-natives-windows-amd64.jar │ │ ├── jogl-all-natives-windows-i586.jar │ │ └── jogl-all.jar │ └── jogl.LICENSE.txt └── junit │ ├── README.jcef │ └── junit-platform-console-standalone-1.4.2.jar └── tools ├── buildtools ├── LICENSE ├── README.jcef ├── download_from_google_storage.py ├── gsutil.py ├── linux64 │ └── clang-format.sha1 ├── mac │ ├── clang-format.arm64.sha1 │ └── clang-format.x64.sha1 ├── subprocess2.py └── win │ └── clang-format.exe.sha1 ├── clang_util.py ├── compile.bat ├── compile.sh ├── date_util.py ├── distrib ├── EXCLUDE_FILES.txt ├── README.footer.txt ├── README.header.txt ├── linux32 │ ├── README.redistrib.txt │ ├── README.standard.txt │ ├── compile.sh │ └── run.sh ├── linux64 │ ├── README.redistrib.txt │ ├── README.standard.txt │ ├── compile.sh │ └── run.sh ├── macosx64 │ ├── README.redistrib.txt │ ├── README.standard.txt │ └── compile.sh ├── win32 │ ├── README.redistrib.txt │ ├── README.standard.txt │ ├── compile.bat │ └── run.bat └── win64 │ ├── README.redistrib.txt │ ├── README.standard.txt │ ├── compile.bat │ └── run.bat ├── exec_util.py ├── file_util.py ├── fix_style.bat ├── fix_style.py ├── fix_style.sh ├── git_util.py ├── make_all_jni_headers.bat ├── make_all_jni_headers.sh ├── make_distrib.bat ├── make_distrib.sh ├── make_docs.bat ├── make_docs.sh ├── make_jar.bat ├── make_jar.sh ├── make_jni_header.bat ├── make_jni_header.sh ├── make_readme.bat ├── make_readme.py ├── make_readme.sh ├── make_version_header.py ├── readme_util.py ├── run.bat ├── run.sh ├── run_tests.bat ├── run_tests.sh ├── yapf ├── LICENSE ├── README.cef ├── __main__.py └── yapf │ ├── __init__.py │ └── yapflib │ ├── __init__.py │ ├── blank_line_calculator.py │ ├── comment_splicer.py │ ├── continuation_splicer.py │ ├── errors.py │ ├── file_resources.py │ ├── format_decision_state.py │ ├── format_token.py │ ├── line_joiner.py │ ├── py3compat.py │ ├── pytree_unwrapper.py │ ├── pytree_utils.py │ ├── pytree_visitor.py │ ├── reformatter.py │ ├── split_penalty.py │ ├── style.py │ ├── subtype_assigner.py │ ├── unwrapped_line.py │ ├── verifier.py │ └── yapf_api.py └── yapf_util.py /.clang-format: -------------------------------------------------------------------------------- 1 | # Defines the Chromium style for automatic reformatting. 2 | # http://clang.llvm.org/docs/ClangFormatStyleOptions.html 3 | BasedOnStyle: Chromium 4 | # This defaults to 'Auto'. Explicitly set it for a while, so that 5 | # 'vector >' in existing files gets formatted to 6 | # 'vector>'. ('Auto' means that clang-format will only use 7 | # 'int>>' if the file already contains at least one such instance.) 8 | Standard: Cpp11 9 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen and what happened instead. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Versions (please complete the following information):** 27 | - OS: [e.g. Windows 10, MacOS 13.2, Ubuntu 22.10] 28 | - Java Version: [e.g. OpenJDK 14] 29 | - JCEF Version: [e.g. 87476e9] 30 | - CEF Version: [e.g. 110.0.25] 31 | 32 | **Additional context** 33 | Does the problem reproduce with the JCEF simple or detailed sample application at the same version? 34 | 35 | Does the problem reproduce with the CEF cefclient or cefsimple sample application at the same version? 36 | 37 | Does the problem reproduce with Google Chrome at the same version? 38 | 39 | Add any other context about the problem here. 40 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.gypcmd 2 | *.mk 3 | *.ncb 4 | *.opensdf 5 | *.props 6 | *.pyc 7 | *.rules 8 | *.sdf 9 | *.sln 10 | *.sublime-project 11 | *.sublime-workspace 12 | *.suo 13 | *.targets 14 | *.user 15 | *.vcproj 16 | *.vcxproj 17 | *.vcxproj.filters 18 | *.vpj 19 | *.vpw 20 | *.vpwhistu 21 | *.vtg 22 | *.xcodeproj 23 | *.xcworkspace 24 | *_proto.xml 25 | *_proto_cpp.xml 26 | *~ 27 | !Android.mk 28 | .*.sw? 29 | .DS_Store 30 | .classpath 31 | .cproject 32 | .gdb_history 33 | .gdbinit 34 | .landmines 35 | .metadata 36 | .project 37 | .pydevproject 38 | # Settings directory for eclipse 39 | /.settings 40 | .checkstyle 41 | cscope.* 42 | Session.vim 43 | tags 44 | Thumbs.db 45 | # JCEF generated directories 46 | /binary_distrib 47 | /jcef_build 48 | /out 49 | # JCEF generated files 50 | /native/jcef_version.h 51 | # CEF downloads 52 | /third_party/cef/cef_binary_* 53 | # clang-format downloads 54 | /tools/buildtools/external_bin 55 | /tools/buildtools/linux64/clang-format 56 | /tools/buildtools/mac/clang-format 57 | /tools/buildtools/win/clang-format.exe 58 | -------------------------------------------------------------------------------- /.style.cfg: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights 2 | # reserved. Use of this source code is governed by a BSD-style license that 3 | # can be found in the LICENSE file 4 | 5 | # Configuration settings for tools/fix_style.py 6 | { 7 | # Directories containing these path components will be ignored. 8 | 'ignore_directories': ['binary_distrib', 'buildtools', 'jcef_build', 'out', 'third_party', 'yapf'], 9 | } 10 | -------------------------------------------------------------------------------- /.style.yapf: -------------------------------------------------------------------------------- 1 | [style] 2 | based_on_style = chromium 3 | -------------------------------------------------------------------------------- /AUTHORS.txt: -------------------------------------------------------------------------------- 1 | # This file is an addendum to the Chromium Embedded Framework AUTHORS file. It 2 | # lists authors through March 18, 2015 when Git was introduced for source code 3 | # management. A list of additional authors added after that date can be found 4 | # by executing this command on a local Git checkout: 5 | # git log --all --format="%aN <%aE>" | sort -u 6 | 7 | Marshall Greenblatt 8 | Kai Klimke, censhare AG 9 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2008-2013 Marshall A. Greenblatt. Portions Copyright (c) 2 | // 2006-2009 Google Inc. All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the name Chromium Embedded 15 | // Framework nor the names of its contributors may be used to endorse 16 | // or promote products derived from this software without specific prior 17 | // written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | # This is a configuration file for the continuous delivery service provided 2 | # by AppVeyor.com. Its purpose is to automatically build both the 32 3 | # and 64 bit versions of the Java Chromium Embedded Framework (JCEF). 4 | # Please refer to https://bitbucket.org/chromiumembedded/java-cef 5 | # for more information on JCEF. 6 | 7 | os: Visual Studio 2015 8 | 9 | clone_folder: c:\projects\java-cef\src 10 | 11 | platform: 12 | - win32 13 | - x64 14 | 15 | configuration: 16 | - Release 17 | 18 | environment: 19 | matrix: 20 | - buildType: win32 21 | generatorName: Visual Studio 14 22 | JAVA_HOME: C:\Program Files (x86)\Java\jdk1.8.0 23 | - buildType: win64 24 | generatorName: Visual Studio 14 Win64 25 | JAVA_HOME: C:\Program Files\Java\jdk1.8.0 26 | 27 | matrix: 28 | exclude: 29 | - platform: x64 30 | buildType: win32 31 | - platform: win32 32 | buildType: win64 33 | 34 | before_build: 35 | - SET PATH=%JAVA_HOME%;%PATH% 36 | - echo "Running cmake..." 37 | - cd c:\projects\java-cef\src 38 | - mkdir jcef_build 39 | - cd jcef_build 40 | - cmake -G "%generatorName%" .. 41 | - echo "Building the JCEF Java classes..." 42 | - cd c:\projects\java-cef\src\tools 43 | - compile.bat %buildType% 44 | 45 | after_build: 46 | - echo "Making distribution..." 47 | - cd c:\projects\java-cef\src\tools\ 48 | - make_distrib.bat %buildType% 49 | - cd c:\projects\java-cef\src\binary_distrib 50 | - 7z a jcef-%buildType%-distribution.zip %buildType% 51 | 52 | artifacts: 53 | - path: binary_distrib\jcef-%buildType%-distribution.zip 54 | name: jcef-%buildType%-distribution 55 | -------------------------------------------------------------------------------- /java/manifest/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Automatic-Module-Name: jcef 3 | -------------------------------------------------------------------------------- /java/org/cef/CefBrowserSettings.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef; 6 | 7 | /** 8 | * Browser initialization settings. Specify NULL or 0 to get the recommended 9 | * default values. The consequences of using custom values may not be well 10 | * tested. Many of these and other settings can also configured using command- 11 | * line switches. 12 | */ 13 | public class CefBrowserSettings { 14 | /** 15 | * The maximum rate in frames per second (fps) that CefRenderHandler::OnPaint 16 | * will be called for a windowless browser. The actual fps may be lower if 17 | * the browser cannot generate frames at the requested rate. The minimum 18 | * value is 1 and the maximum value is 60 (default 30). This value can also 19 | * be changed dynamically via {@code CefBrowser#setWindowlessFrameRate} 20 | */ 21 | public int windowless_frame_rate = 0; 22 | 23 | public CefBrowserSettings() {} 24 | 25 | @Override 26 | public CefBrowserSettings clone() { 27 | CefBrowserSettings tmp = new CefBrowserSettings(); 28 | tmp.windowless_frame_rate = windowless_frame_rate; 29 | return tmp; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /java/org/cef/OS.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef; 6 | 7 | public class OS { 8 | private static enum OSType { 9 | OSUndefined, 10 | OSLinux, 11 | OSWindows, 12 | OSMacintosh, 13 | OSUnknown, 14 | } 15 | ; 16 | private static OSType osType = OSType.OSUndefined; 17 | 18 | public static final boolean isWindows() { 19 | return getOSType() == OSType.OSWindows; 20 | } 21 | 22 | public static final boolean isMacintosh() { 23 | return getOSType() == OSType.OSMacintosh; 24 | } 25 | 26 | public static final boolean isLinux() { 27 | return getOSType() == OSType.OSLinux; 28 | } 29 | 30 | private static final OSType getOSType() { 31 | if (osType == OSType.OSUndefined) { 32 | String os = System.getProperty("os.name").toLowerCase(); 33 | if (os.startsWith("windows")) 34 | osType = OSType.OSWindows; 35 | else if (os.startsWith("linux")) 36 | osType = OSType.OSLinux; 37 | else if (os.startsWith("mac")) 38 | osType = OSType.OSMacintosh; 39 | else 40 | osType = OSType.OSUnknown; 41 | } 42 | return osType; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /java/org/cef/SystemBootstrap.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | package org.cef; 5 | 6 | /** 7 | * To allow customization of System.load() calls by supplying a different 8 | * implementation. You'll want to call setLoader with your custom 9 | * implementation before calling into any other CEF classes which then in turn 10 | * will start triggering libraries to be loaded at runtime. 11 | */ 12 | public class SystemBootstrap { 13 | /** 14 | * Simple interface for how a library by name should be loaded. 15 | */ 16 | static public interface Loader { 17 | public void loadLibrary(String libname); 18 | } 19 | 20 | /** 21 | * Default implementation is to call System.loadLibrary 22 | */ 23 | static private Loader loader_ = new Loader() { 24 | @Override 25 | public void loadLibrary(String libname) { 26 | System.loadLibrary(libname); 27 | } 28 | }; 29 | 30 | static public void setLoader(Loader loader) { 31 | if (loader == null) { 32 | throw new NullPointerException("Loader cannot be null"); 33 | } 34 | loader_ = loader; 35 | } 36 | 37 | static public void loadLibrary(String libname) { 38 | loader_.loadLibrary(libname); 39 | } 40 | } -------------------------------------------------------------------------------- /java/org/cef/browser/CefBrowserFactory.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.browser; 6 | 7 | import org.cef.CefBrowserSettings; 8 | import org.cef.CefClient; 9 | 10 | /** 11 | * Creates a new instance of CefBrowser according the passed values 12 | */ 13 | public class CefBrowserFactory { 14 | public static CefBrowser create(CefClient client, String url, boolean isOffscreenRendered, 15 | boolean isTransparent, CefRequestContext context, CefBrowserSettings settings) { 16 | if (isOffscreenRendered) 17 | return new CefBrowserOsr(client, url, isTransparent, context, settings); 18 | return new CefBrowserWr(client, url, context, settings); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /java/org/cef/browser/CefBrowserWindow.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.browser; 6 | 7 | import java.awt.Component; 8 | 9 | /** 10 | * Interface representing system dependent methods for the browser. 11 | */ 12 | public interface CefBrowserWindow { 13 | /** 14 | * Get the window handle for the given UI object. 15 | * 16 | * @param comp a UI component 17 | * @return a window pointer if any 18 | */ 19 | public long getWindowHandle(Component comp); 20 | } 21 | -------------------------------------------------------------------------------- /java/org/cef/browser/CefDevToolsMessageObserver.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.browser; 6 | 7 | /** 8 | * Used internally by {@link CefDevToolsClient}. 9 | *

10 | * Callback interface for {@link CefBrowser#addDevToolsMessageObserver(CefDevToolsMessageObserver)}. 11 | * The methods of this class will be called on the CEF UI thread. 12 | */ 13 | interface CefDevToolsMessageObserver { 14 | /** 15 | * Method that will be called after attempted execution of a DevTools protocol method. 16 | * 17 | * @param browser the originating browser instance 18 | * @param messageId the ID that identifies the originating method call 19 | * @param success if the method succeeded, |success| will be true and |result| will be a JSON 20 | * object containing the method call result. If the method call failed, |success| will 21 | * be false and |result| will be a JSON object describing the error. 22 | * @param result method call result or an error 23 | */ 24 | void onDevToolsMethodResult(CefBrowser browser, int messageId, boolean success, String result); 25 | 26 | /** 27 | * Method that will be called on receipt of a DevTools protocol event. 28 | * 29 | * @param browser the originating browser instance 30 | * @param method the method name 31 | * @param parameters the event data 32 | */ 33 | void onDevToolsEvent(CefBrowser browser, String method, String parameters); 34 | } 35 | -------------------------------------------------------------------------------- /java/org/cef/browser/CefPaintEvent.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.browser; 6 | 7 | import java.awt.*; 8 | import java.nio.ByteBuffer; 9 | 10 | public class CefPaintEvent { 11 | private final CefBrowser browser; 12 | private final boolean popup; 13 | private final Rectangle[] dirtyRects; 14 | private final ByteBuffer renderedFrame; 15 | private final int width; 16 | private final int height; 17 | 18 | public CefPaintEvent(CefBrowser browser, boolean popup, Rectangle[] dirtyRects, 19 | ByteBuffer renderedFrame, int width, int height) { 20 | this.browser = browser; 21 | this.popup = popup; 22 | this.dirtyRects = dirtyRects; 23 | this.renderedFrame = renderedFrame; 24 | this.width = width; 25 | this.height = height; 26 | } 27 | 28 | public CefBrowser getBrowser() { 29 | return browser; 30 | } 31 | 32 | public boolean getPopup() { 33 | return popup; 34 | } 35 | 36 | public Rectangle[] getDirtyRects() { 37 | return dirtyRects; 38 | } 39 | 40 | public ByteBuffer getRenderedFrame() { 41 | return renderedFrame; 42 | } 43 | 44 | public int getWidth() { 45 | return width; 46 | } 47 | 48 | public int getHeight() { 49 | return height; 50 | } 51 | } -------------------------------------------------------------------------------- /java/org/cef/browser/CefRegistration.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.browser; 6 | 7 | /** 8 | * Used internally by {@link CefDevToolsClient}. 9 | *

10 | * Handle to observer registration, As long as this object is alive, the observer will stay 11 | * registered. 12 | */ 13 | abstract class CefRegistration { 14 | /** 15 | * Removes the native reference from an unused object. 16 | */ 17 | public abstract void dispose(); 18 | 19 | @Override 20 | public void finalize() throws Throwable { 21 | dispose(); 22 | super.finalize(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /java/org/cef/browser/CefRegistration_N.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.browser; 6 | 7 | import org.cef.callback.CefNative; 8 | 9 | class CefRegistration_N extends CefRegistration implements CefNative { 10 | // Used internally to store a pointer to the CEF object. 11 | private long N_CefHandle = 0; 12 | 13 | @Override 14 | public void setNativeRef(String identifier, long nativeRef) { 15 | N_CefHandle = nativeRef; 16 | } 17 | 18 | @Override 19 | public long getNativeRef(String identifier) { 20 | return N_CefHandle; 21 | } 22 | 23 | @Override 24 | public void dispose() { 25 | try { 26 | N_Dispose(N_CefHandle); 27 | } catch (UnsatisfiedLinkError ule) { 28 | ule.printStackTrace(); 29 | } 30 | } 31 | 32 | private final native void N_Dispose(long self); 33 | } 34 | -------------------------------------------------------------------------------- /java/org/cef/browser/mac/CefBrowserWindowMac.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.browser.mac; 6 | 7 | import org.cef.browser.CefBrowserWindow; 8 | 9 | import java.awt.Component; 10 | import java.awt.peer.ComponentPeer; 11 | 12 | import sun.awt.AWTAccessor; 13 | import sun.lwawt.LWComponentPeer; 14 | import sun.lwawt.PlatformWindow; 15 | import sun.lwawt.macosx.CFRetainedResource; 16 | import sun.lwawt.macosx.CPlatformWindow; 17 | 18 | public class CefBrowserWindowMac implements CefBrowserWindow { 19 | @Override 20 | public long getWindowHandle(Component comp) { 21 | final long[] result = new long[1]; 22 | while (comp != null) { 23 | if (comp.isLightweight()) { 24 | comp = comp.getParent(); 25 | continue; 26 | } 27 | ComponentPeer peer = AWTAccessor.getComponentAccessor().getPeer(comp); 28 | if (peer instanceof LWComponentPeer) { 29 | @SuppressWarnings("rawtypes") 30 | PlatformWindow pWindow = ((LWComponentPeer) peer).getPlatformWindow(); 31 | if (pWindow instanceof CPlatformWindow) { 32 | ((CPlatformWindow) pWindow).execute(new CFRetainedResource.CFNativeAction() { 33 | @Override 34 | public void run(long l) { 35 | result[0] = l; 36 | } 37 | }); 38 | break; 39 | } 40 | } 41 | comp = comp.getParent(); 42 | } 43 | return result[0]; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /java/org/cef/callback/CefAuthCallback.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.callback; 6 | 7 | /** 8 | * Callback interface used for asynchronous continuation of authentication 9 | * requests. 10 | */ 11 | public interface CefAuthCallback { 12 | /** 13 | * Continue the authentication request. 14 | */ 15 | public void Continue(String username, String password); 16 | 17 | /** 18 | * Cancel the authentication request. 19 | */ 20 | public void cancel(); 21 | } 22 | -------------------------------------------------------------------------------- /java/org/cef/callback/CefAuthCallback_N.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.callback; 6 | 7 | class CefAuthCallback_N extends CefNativeAdapter implements CefAuthCallback { 8 | CefAuthCallback_N() {} 9 | 10 | @Override 11 | protected void finalize() throws Throwable { 12 | cancel(); 13 | super.finalize(); 14 | } 15 | 16 | @Override 17 | public void Continue(String username, String password) { 18 | try { 19 | N_Continue(getNativeRef(null), username, password); 20 | } catch (UnsatisfiedLinkError ule) { 21 | ule.printStackTrace(); 22 | } 23 | } 24 | 25 | @Override 26 | public void cancel() { 27 | try { 28 | N_Cancel(getNativeRef(null)); 29 | } catch (UnsatisfiedLinkError ule) { 30 | ule.printStackTrace(); 31 | } 32 | } 33 | 34 | private final native void N_Continue(long self, String username, String password); 35 | private final native void N_Cancel(long self); 36 | } 37 | -------------------------------------------------------------------------------- /java/org/cef/callback/CefBeforeDownloadCallback.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.callback; 6 | 7 | /** 8 | * Callback interface used to asynchronously continue a download. 9 | */ 10 | public interface CefBeforeDownloadCallback { 11 | /** 12 | * Call to continue the download. 13 | * @param downloadPath Set it to the full file path for the download 14 | * including the file name or leave blank to use the suggested name and 15 | * the default temp directory. 16 | * @param showDialog Set it to true if you do wish to show the default 17 | * "Save As" dialog. 18 | */ 19 | public void Continue(String downloadPath, boolean showDialog); 20 | } 21 | -------------------------------------------------------------------------------- /java/org/cef/callback/CefBeforeDownloadCallback_N.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.callback; 6 | 7 | class CefBeforeDownloadCallback_N extends CefNativeAdapter implements CefBeforeDownloadCallback { 8 | CefBeforeDownloadCallback_N() {} 9 | 10 | @Override 11 | protected void finalize() throws Throwable { 12 | Continue("", false); 13 | super.finalize(); 14 | } 15 | 16 | @Override 17 | public void Continue(String downloadPath, boolean showDialog) { 18 | try { 19 | N_Continue(getNativeRef(null), downloadPath, showDialog); 20 | } catch (UnsatisfiedLinkError ule) { 21 | ule.printStackTrace(); 22 | } 23 | } 24 | 25 | private final native void N_Continue(long self, String downloadPath, boolean showDialog); 26 | } 27 | -------------------------------------------------------------------------------- /java/org/cef/callback/CefCallback.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.callback; 6 | 7 | /** 8 | * Generic callback interface used for asynchronous continuation. 9 | */ 10 | public interface CefCallback { 11 | /** 12 | * Continue processing. 13 | */ 14 | void Continue(); 15 | 16 | /** 17 | * Cancel processing. 18 | */ 19 | void cancel(); 20 | } 21 | -------------------------------------------------------------------------------- /java/org/cef/callback/CefCallback_N.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.callback; 6 | 7 | class CefCallback_N extends CefNativeAdapter implements CefCallback { 8 | CefCallback_N() {} 9 | 10 | @Override 11 | protected void finalize() throws Throwable { 12 | cancel(); 13 | super.finalize(); 14 | } 15 | 16 | @Override 17 | public void Continue() { 18 | try { 19 | N_Continue(getNativeRef(null)); 20 | } catch (UnsatisfiedLinkError ule) { 21 | ule.printStackTrace(); 22 | } 23 | } 24 | 25 | @Override 26 | public void cancel() { 27 | try { 28 | N_Cancel(getNativeRef(null)); 29 | } catch (UnsatisfiedLinkError ule) { 30 | ule.printStackTrace(); 31 | } 32 | } 33 | 34 | private final native void N_Continue(long self); 35 | private final native void N_Cancel(long self); 36 | } 37 | -------------------------------------------------------------------------------- /java/org/cef/callback/CefCompletionCallback.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.callback; 6 | 7 | /** 8 | * Generic callback interface used for asynchronous completion. 9 | */ 10 | public interface CefCompletionCallback { 11 | /** 12 | * Method that will be called once the task is complete. 13 | */ 14 | public abstract void onComplete(); 15 | } 16 | -------------------------------------------------------------------------------- /java/org/cef/callback/CefCookieVisitor.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.callback; 6 | 7 | import org.cef.misc.BoolRef; 8 | import org.cef.network.CefCookie; 9 | 10 | /** 11 | * Interface to implement for visiting cookie values. The methods of this class 12 | * will always be called on the IO thread. 13 | */ 14 | public interface CefCookieVisitor { 15 | /** 16 | * Method that will be called once for each cookie. |count| is the 0-based 17 | * index for the current cookie. |total| is the total number of cookies. 18 | * Set |deleteCookie| to true to delete the cookie currently being visited. 19 | * Return false to stop visiting cookies. This method may never be called if 20 | * no cookies are found. 21 | */ 22 | public abstract boolean visit(CefCookie cookie, int count, int total, BoolRef delete); 23 | } 24 | -------------------------------------------------------------------------------- /java/org/cef/callback/CefDownloadItemCallback.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.callback; 6 | 7 | /** 8 | * Callback interface used to asynchronously modify download status. 9 | */ 10 | public interface CefDownloadItemCallback { 11 | /** 12 | * Call to cancel the download. 13 | */ 14 | public void cancel(); 15 | 16 | /** 17 | * Call to pause the download. 18 | */ 19 | public void pause(); 20 | 21 | /** 22 | * Call to resume the download. 23 | */ 24 | public void resume(); 25 | } 26 | -------------------------------------------------------------------------------- /java/org/cef/callback/CefDownloadItemCallback_N.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.callback; 6 | 7 | class CefDownloadItemCallback_N extends CefNativeAdapter implements CefDownloadItemCallback { 8 | CefDownloadItemCallback_N() {} 9 | 10 | @Override 11 | protected void finalize() throws Throwable { 12 | try { 13 | N_Dispose(getNativeRef(null)); 14 | } catch (UnsatisfiedLinkError ule) { 15 | ule.printStackTrace(); 16 | } 17 | super.finalize(); 18 | } 19 | 20 | @Override 21 | public void cancel() { 22 | try { 23 | N_Cancel(getNativeRef(null)); 24 | } catch (UnsatisfiedLinkError ule) { 25 | ule.printStackTrace(); 26 | } 27 | } 28 | 29 | @Override 30 | public void pause() { 31 | try { 32 | N_Pause(getNativeRef(null)); 33 | } catch (UnsatisfiedLinkError ule) { 34 | ule.printStackTrace(); 35 | } 36 | } 37 | 38 | @Override 39 | public void resume() { 40 | try { 41 | N_Resume(getNativeRef(null)); 42 | } catch (UnsatisfiedLinkError ule) { 43 | ule.printStackTrace(); 44 | } 45 | } 46 | 47 | private final native void N_Dispose(long self); 48 | private final native void N_Cancel(long self); 49 | private final native void N_Pause(long self); 50 | private final native void N_Resume(long self); 51 | } 52 | -------------------------------------------------------------------------------- /java/org/cef/callback/CefFileDialogCallback.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.callback; 6 | 7 | import java.util.Vector; 8 | 9 | /** 10 | * Callback interface for asynchronous continuation of file dialog requests. 11 | */ 12 | public interface CefFileDialogCallback { 13 | /** 14 | * Continue the file selection with the specified file_paths. This may be 15 | * a single value or a list of values depending on the dialog mode. An empty 16 | * value is treated the same as calling Cancel(). 17 | * 18 | * @param filePaths list of selected file paths or an empty list. 19 | */ 20 | public void Continue(Vector filePaths); 21 | 22 | /** 23 | * Cancel the file selection. 24 | */ 25 | public void Cancel(); 26 | } 27 | -------------------------------------------------------------------------------- /java/org/cef/callback/CefFileDialogCallback_N.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.callback; 6 | 7 | import java.util.Vector; 8 | 9 | class CefFileDialogCallback_N extends CefNativeAdapter implements CefFileDialogCallback { 10 | CefFileDialogCallback_N() {} 11 | 12 | @Override 13 | protected void finalize() throws Throwable { 14 | Cancel(); 15 | super.finalize(); 16 | } 17 | 18 | @Override 19 | public void Continue(Vector filePaths) { 20 | try { 21 | N_Continue(getNativeRef(null), filePaths); 22 | } catch (UnsatisfiedLinkError ule) { 23 | ule.printStackTrace(); 24 | } 25 | } 26 | 27 | @Override 28 | public void Cancel() { 29 | try { 30 | N_Cancel(getNativeRef(null)); 31 | } catch (UnsatisfiedLinkError ule) { 32 | ule.printStackTrace(); 33 | } 34 | } 35 | 36 | private final native void N_Continue(long self, Vector filePaths); 37 | private final native void N_Cancel(long self); 38 | } 39 | -------------------------------------------------------------------------------- /java/org/cef/callback/CefJSDialogCallback.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.callback; 6 | 7 | /** 8 | * Callback interface used for asynchronous continuation of JavaScript dialog 9 | * requests. 10 | */ 11 | public interface CefJSDialogCallback { 12 | /** 13 | * Continue the JS dialog request. 14 | * 15 | * @param success Set to true if the OK button was pressed. 16 | * @param user_input The value should be specified for prompt dialogs. 17 | */ 18 | public void Continue(boolean success, String user_input); 19 | } 20 | -------------------------------------------------------------------------------- /java/org/cef/callback/CefJSDialogCallback_N.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.callback; 6 | 7 | class CefJSDialogCallback_N extends CefNativeAdapter implements CefJSDialogCallback { 8 | CefJSDialogCallback_N() {} 9 | 10 | @Override 11 | protected void finalize() throws Throwable { 12 | Continue(false, ""); 13 | super.finalize(); 14 | } 15 | 16 | @Override 17 | public void Continue(boolean success, String user_input) { 18 | try { 19 | N_Continue(getNativeRef(null), success, user_input); 20 | } catch (UnsatisfiedLinkError ule) { 21 | ule.printStackTrace(); 22 | } 23 | } 24 | 25 | private final native void N_Continue(long self, boolean success, String user_input); 26 | } 27 | -------------------------------------------------------------------------------- /java/org/cef/callback/CefNative.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.callback; 6 | 7 | /** 8 | * The methods of this interface are triggered by the native code 9 | * to store and get the JNI counterparts of the JCEF implementation. 10 | */ 11 | public interface CefNative { 12 | /** 13 | * Method is called by the native code to store a reference 14 | * to an implemented native JNI counterpart. 15 | * 16 | * @param identifer The name of the interface class (e.g. CefFocusHandler). 17 | * @param nativeRef The reference to the native code. 18 | */ 19 | public void setNativeRef(String identifer, long nativeRef); 20 | 21 | /** 22 | * Method is called by the native code to get the reference 23 | * to an previous stored identifier. 24 | * 25 | * @param identifer The name of the interface class (e.g. CefFocusHandler). 26 | * @return The stored reference value of the native code. 27 | */ 28 | public long getNativeRef(String identifer); 29 | } 30 | -------------------------------------------------------------------------------- /java/org/cef/callback/CefNativeAdapter.java: -------------------------------------------------------------------------------- 1 | package org.cef.callback; 2 | 3 | public class CefNativeAdapter implements CefNative { 4 | // Used internally to store a pointer to the CEF object. 5 | private long N_CefHandle = 0; 6 | 7 | @Override 8 | public void setNativeRef(String identifer, long nativeRef) { 9 | N_CefHandle = nativeRef; 10 | } 11 | 12 | @Override 13 | public long getNativeRef(String identifer) { 14 | return N_CefHandle; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /java/org/cef/callback/CefPdfPrintCallback.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.callback; 6 | 7 | /** 8 | * Callback interface for CefBrowser.PrintToPDF(). The methods of this class 9 | * will be called on the browser process UI thread. 10 | */ 11 | public interface CefPdfPrintCallback { 12 | /** 13 | * Method that will be executed when the PDF printing has completed. |path| 14 | * is the output path. |ok| will be true if the printing completed 15 | * successfully or false otherwise. 16 | * @param path The path of the PDF file that was written. 17 | * @param ok True if printing completed or false otherwise. 18 | */ 19 | public abstract void onPdfPrintFinished(String path, boolean ok); 20 | } 21 | -------------------------------------------------------------------------------- /java/org/cef/callback/CefPrintDialogCallback.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.callback; 6 | 7 | import org.cef.misc.CefPrintSettings; 8 | 9 | /** 10 | * Callback interface for asynchronous continuation of print dialog requests. 11 | */ 12 | public interface CefPrintDialogCallback { 13 | /** 14 | * Continue printing with the specified |settings|. 15 | */ 16 | void Continue(CefPrintSettings settings); 17 | 18 | /** 19 | * Cancel the printing. 20 | */ 21 | void cancel(); 22 | } 23 | -------------------------------------------------------------------------------- /java/org/cef/callback/CefPrintDialogCallback_N.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.callback; 6 | 7 | import org.cef.misc.CefPrintSettings; 8 | 9 | class CefPrintDialogCallback_N extends CefNativeAdapter implements CefPrintDialogCallback { 10 | CefPrintDialogCallback_N() {} 11 | 12 | @Override 13 | protected void finalize() throws Throwable { 14 | cancel(); 15 | super.finalize(); 16 | } 17 | 18 | @Override 19 | public void Continue(CefPrintSettings settings) { 20 | try { 21 | N_Continue(getNativeRef(null), settings); 22 | } catch (UnsatisfiedLinkError ule) { 23 | ule.printStackTrace(); 24 | } 25 | } 26 | 27 | @Override 28 | public void cancel() { 29 | try { 30 | N_Cancel(getNativeRef(null)); 31 | } catch (UnsatisfiedLinkError ule) { 32 | ule.printStackTrace(); 33 | } 34 | } 35 | 36 | private final native void N_Continue(long self, CefPrintSettings settings); 37 | private final native void N_Cancel(long self); 38 | } 39 | -------------------------------------------------------------------------------- /java/org/cef/callback/CefPrintJobCallback.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.callback; 6 | 7 | /** 8 | * Callback interface for asynchronous continuation of print job requests. 9 | */ 10 | public interface CefPrintJobCallback { 11 | /** 12 | * Indicate completion of the print job. 13 | */ 14 | void Continue(); 15 | } 16 | -------------------------------------------------------------------------------- /java/org/cef/callback/CefPrintJobCallback_N.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.callback; 6 | 7 | class CefPrintJobCallback_N extends CefNativeAdapter implements CefPrintJobCallback { 8 | CefPrintJobCallback_N() {} 9 | 10 | @Override 11 | protected void finalize() throws Throwable { 12 | Continue(); 13 | super.finalize(); 14 | } 15 | 16 | @Override 17 | public void Continue() { 18 | try { 19 | N_Continue(getNativeRef(null)); 20 | } catch (UnsatisfiedLinkError ule) { 21 | ule.printStackTrace(); 22 | } 23 | } 24 | 25 | private final native void N_Continue(long self); 26 | } 27 | -------------------------------------------------------------------------------- /java/org/cef/callback/CefQueryCallback.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.callback; 6 | 7 | /** 8 | * Interface representing a query callback. 9 | */ 10 | public interface CefQueryCallback { 11 | /** 12 | * Notify the associated JavaScript onSuccess callback that the query has 13 | * completed successfully. 14 | * @param response Response passed to JavaScript. 15 | */ 16 | public void success(String response); 17 | 18 | /** 19 | * Notify the associated JavaScript onFailure callback that the query has 20 | * failed. 21 | * @param error_code Error code passed to JavaScript. 22 | * @param error_message Error message passed to JavaScript. 23 | */ 24 | public void failure(int error_code, String error_message); 25 | } 26 | -------------------------------------------------------------------------------- /java/org/cef/callback/CefQueryCallback_N.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.callback; 6 | 7 | class CefQueryCallback_N extends CefNativeAdapter implements CefQueryCallback { 8 | CefQueryCallback_N() {} 9 | 10 | @Override 11 | protected void finalize() throws Throwable { 12 | failure(-1, "Unexpected call to CefQueryCallback_N::finalize()"); 13 | super.finalize(); 14 | } 15 | 16 | @Override 17 | public void success(String response) { 18 | try { 19 | N_Success(getNativeRef(null), response); 20 | } catch (UnsatisfiedLinkError ule) { 21 | ule.printStackTrace(); 22 | } 23 | } 24 | 25 | @Override 26 | public void failure(int error_code, String error_message) { 27 | try { 28 | N_Failure(getNativeRef(null), error_code, error_message); 29 | } catch (UnsatisfiedLinkError ule) { 30 | ule.printStackTrace(); 31 | } 32 | } 33 | 34 | private final native void N_Success(long self, String response); 35 | private final native void N_Failure(long self, int error_code, String error_message); 36 | } 37 | -------------------------------------------------------------------------------- /java/org/cef/callback/CefRunFileDialogCallback.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.callback; 6 | 7 | import org.cef.browser.CefBrowser; 8 | 9 | import java.util.Vector; 10 | 11 | /** 12 | * Callback interface for CefBrowserHost::RunFileDialog. The methods of this 13 | * class will be called on the browser process UI thread. 14 | */ 15 | public interface CefRunFileDialogCallback { 16 | /** 17 | * Called asynchronously after the file dialog is dismissed. If the selection 18 | * was successful filePaths will be a single value or a list of values 19 | * depending on the dialog mode. If the selection was cancelled filePaths 20 | * will be empty. 21 | * 22 | * @param filePaths list of file paths or empty list. 23 | */ 24 | void onFileDialogDismissed(Vector filePaths); 25 | } 26 | -------------------------------------------------------------------------------- /java/org/cef/callback/CefSchemeHandlerFactory.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.callback; 6 | 7 | import org.cef.browser.CefBrowser; 8 | import org.cef.browser.CefFrame; 9 | import org.cef.handler.CefResourceHandler; 10 | import org.cef.network.CefRequest; 11 | 12 | /** 13 | * Class that creates CefResourceHandler instances for handling scheme requests. 14 | * The methods of this class will always be called on the IO thread. 15 | */ 16 | public interface CefSchemeHandlerFactory { 17 | /** 18 | * Return a new resource handler instance to handle the request or NULL to allow default 19 | * handling of the request. 20 | * 21 | * @param browser The corresponding browser, or NULL if the request did not originate from a 22 | * browser window (for example, if the request came from CefURLRequest). 23 | * @param frame The frame generating the event, or NULL if the request did not originate from a 24 | * browser window (for example, if the request came from CefURLRequest). Instance only 25 | * valid within the scope of this method. 26 | * @param schemeName Name of the scheme being created. 27 | * @param request The request itself. Cannot be modified in this callback. Instance only valid 28 | * within the scope of this method. 29 | */ 30 | public CefResourceHandler create( 31 | CefBrowser browser, CefFrame frame, String schemeName, CefRequest request); 32 | } 33 | -------------------------------------------------------------------------------- /java/org/cef/callback/CefSchemeRegistrar_N.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.callback; 6 | 7 | class CefSchemeRegistrar_N extends CefNativeAdapter implements CefSchemeRegistrar { 8 | @Override 9 | public boolean addCustomScheme(String schemeName, boolean isStandard, boolean isLocal, 10 | boolean isDisplayIsolated, boolean isSecure, boolean isCorsEnabled, 11 | boolean isCspBypassing, boolean isFetchEnabled) { 12 | try { 13 | return N_AddCustomScheme(schemeName, isStandard, isLocal, isDisplayIsolated, isSecure, 14 | isCorsEnabled, isCspBypassing, isFetchEnabled); 15 | } catch (UnsatisfiedLinkError err) { 16 | err.printStackTrace(); 17 | } 18 | return false; 19 | } 20 | 21 | private final native boolean N_AddCustomScheme(String schemeName, boolean isStandard, 22 | boolean isLocal, boolean isDisplayIsolated, boolean isSecure, boolean isCorsEnabled, 23 | boolean isCspBypassing, boolean isFetchEnabled); 24 | } 25 | -------------------------------------------------------------------------------- /java/org/cef/callback/CefStringVisitor.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.callback; 6 | 7 | /** 8 | * Public interface to receive string values asynchronously. 9 | */ 10 | public interface CefStringVisitor { 11 | /** 12 | * Called when the string is available. 13 | * @param string Requested string. 14 | */ 15 | void visit(String string); 16 | } 17 | -------------------------------------------------------------------------------- /java/org/cef/handler/CefContextMenuHandlerAdapter.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.handler; 6 | 7 | import org.cef.browser.CefBrowser; 8 | import org.cef.browser.CefFrame; 9 | import org.cef.callback.CefContextMenuParams; 10 | import org.cef.callback.CefMenuModel; 11 | 12 | /** 13 | * An abstract adapter class for receiving context menu events. 14 | * The methods in this class are empty. 15 | * This class exists as convenience for creating handler objects. 16 | */ 17 | public abstract class CefContextMenuHandlerAdapter implements CefContextMenuHandler { 18 | @Override 19 | public void onBeforeContextMenu( 20 | CefBrowser browser, CefFrame frame, CefContextMenuParams params, CefMenuModel model) {} 21 | 22 | @Override 23 | public boolean onContextMenuCommand(CefBrowser browser, CefFrame frame, 24 | CefContextMenuParams params, int commandId, int eventFlags) { 25 | return false; 26 | } 27 | 28 | @Override 29 | public void onContextMenuDismissed(CefBrowser browser, CefFrame frame) {} 30 | } 31 | -------------------------------------------------------------------------------- /java/org/cef/handler/CefCookieAccessFilterAdapter.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.handler; 6 | 7 | import org.cef.browser.CefBrowser; 8 | import org.cef.browser.CefFrame; 9 | import org.cef.network.CefCookie; 10 | import org.cef.network.CefRequest; 11 | import org.cef.network.CefResponse; 12 | 13 | /** 14 | * An abstract adapter class for cookie access filter events. 15 | * The methods in this class are empty. 16 | * This class exists as convenience for creating handler objects. 17 | */ 18 | public abstract class CefCookieAccessFilterAdapter implements CefCookieAccessFilter { 19 | @Override 20 | public boolean canSendCookie( 21 | CefBrowser browser, CefFrame frame, CefRequest request, CefCookie cookie) { 22 | return true; 23 | } 24 | 25 | @Override 26 | public boolean canSaveCookie(CefBrowser browser, CefFrame frame, CefRequest request, 27 | CefResponse response, CefCookie cookie) { 28 | return true; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /java/org/cef/handler/CefDisplayHandlerAdapter.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.handler; 6 | 7 | import org.cef.CefSettings; 8 | import org.cef.browser.CefBrowser; 9 | import org.cef.browser.CefFrame; 10 | 11 | /** 12 | * An abstract adapter class for receiving display events. 13 | * The methods in this class are empty. 14 | * This class exists as convenience for creating handler objects. 15 | */ 16 | public abstract class CefDisplayHandlerAdapter implements CefDisplayHandler { 17 | @Override 18 | public void onAddressChange(CefBrowser browser, CefFrame frame, String url) { 19 | return; 20 | } 21 | 22 | @Override 23 | public void onTitleChange(CefBrowser browser, String title) { 24 | return; 25 | } 26 | 27 | @Override 28 | public void onFullscreenModeChange(CefBrowser browser, boolean fullscreen) { 29 | return; 30 | } 31 | 32 | @Override 33 | public boolean onTooltip(CefBrowser browser, String text) { 34 | return false; 35 | } 36 | 37 | @Override 38 | public void onStatusMessage(CefBrowser browser, String value) { 39 | return; 40 | } 41 | 42 | @Override 43 | public boolean onConsoleMessage(CefBrowser browser, CefSettings.LogSeverity level, 44 | String message, String source, int line) { 45 | return false; 46 | } 47 | 48 | @Override 49 | public boolean onCursorChange(CefBrowser browser, int cursorType) { 50 | return false; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /java/org/cef/handler/CefDownloadHandlerAdapter.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.handler; 6 | 7 | import org.cef.browser.CefBrowser; 8 | import org.cef.callback.CefBeforeDownloadCallback; 9 | import org.cef.callback.CefDownloadItem; 10 | import org.cef.callback.CefDownloadItemCallback; 11 | 12 | /** 13 | * An abstract adapter class for receiving download events. 14 | * The methods in this class are empty. 15 | * This class exists as convenience for creating handler objects. 16 | */ 17 | public abstract class CefDownloadHandlerAdapter implements CefDownloadHandler { 18 | @Override 19 | public boolean onBeforeDownload(CefBrowser browser, CefDownloadItem downloadItem, 20 | String suggestedName, CefBeforeDownloadCallback callback) { 21 | return false; 22 | } 23 | 24 | @Override 25 | public void onDownloadUpdated( 26 | CefBrowser browser, CefDownloadItem downloadItem, CefDownloadItemCallback callback) {} 27 | } 28 | -------------------------------------------------------------------------------- /java/org/cef/handler/CefDragHandler.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.handler; 6 | 7 | import org.cef.browser.CefBrowser; 8 | import org.cef.callback.CefDragData; 9 | 10 | /** 11 | * Implement this interface to handle events related to dragging. The methods of 12 | * this class will be called on the UI thread. 13 | */ 14 | public interface CefDragHandler { 15 | /** 16 | * 17 | */ 18 | public static final class DragOperationMask { 19 | public static final int DRAG_OPERATION_NONE = 0; 20 | public static final int DRAG_OPERATION_COPY = 1; 21 | public static final int DRAG_OPERATION_LINK = 2; 22 | public static final int DRAG_OPERATION_GENERIC = 4; 23 | public static final int DRAG_OPERATION_PRIVATE = 8; 24 | public static final int DRAG_OPERATION_MOVE = 16; 25 | public static final int DRAG_OPERATION_DELETE = 32; 26 | public static final int DRAG_OPERATION_EVERY = Integer.MAX_VALUE; 27 | } 28 | 29 | /** 30 | * Called when an external drag event enters the browser window. 31 | * 32 | * @param browser The browser generating the event. 33 | * @param dragData Contains the drag event data. Instance only valid within the scope 34 | * of this method. 35 | * @param mask Represents the type of drag operation. See DragOperationMask for possible values. 36 | * @return False for default drag handling behavior or true to cancel the drag event. 37 | */ 38 | public boolean onDragEnter(CefBrowser browser, CefDragData dragData, int mask); 39 | } 40 | -------------------------------------------------------------------------------- /java/org/cef/handler/CefFocusHandlerAdapter.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.handler; 6 | 7 | import org.cef.browser.CefBrowser; 8 | 9 | /** 10 | * An abstract adapter class for receiving focus events. 11 | * The methods in this class are empty. 12 | * This class exists as convenience for creating handler objects. 13 | */ 14 | public abstract class CefFocusHandlerAdapter implements CefFocusHandler { 15 | @Override 16 | public void onTakeFocus(CefBrowser browser, boolean next) { 17 | return; 18 | } 19 | 20 | @Override 21 | public boolean onSetFocus(CefBrowser browser, FocusSource source) { 22 | return false; 23 | } 24 | 25 | @Override 26 | public void onGotFocus(CefBrowser browser) {} 27 | } 28 | -------------------------------------------------------------------------------- /java/org/cef/handler/CefJSDialogHandlerAdapter.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.handler; 6 | 7 | import org.cef.browser.CefBrowser; 8 | import org.cef.callback.CefJSDialogCallback; 9 | import org.cef.misc.BoolRef; 10 | 11 | /** 12 | * An abstract adapter class for receiving javascript dialog requests. 13 | * The methods in this class are empty. 14 | * This class exists as convenience for creating handler objects. 15 | */ 16 | public abstract class CefJSDialogHandlerAdapter implements CefJSDialogHandler { 17 | @Override 18 | public boolean onJSDialog(CefBrowser browser, String origin_url, JSDialogType dialog_type, 19 | String message_text, String default_prompt_text, CefJSDialogCallback callback, 20 | BoolRef suppress_message) { 21 | return false; 22 | } 23 | 24 | @Override 25 | public boolean onBeforeUnloadDialog(CefBrowser browser, String message_text, boolean is_reload, 26 | CefJSDialogCallback callback) { 27 | return false; 28 | } 29 | 30 | @Override 31 | public void onResetDialogState(CefBrowser browser) {} 32 | 33 | @Override 34 | public void onDialogClosed(CefBrowser browser) {} 35 | } 36 | -------------------------------------------------------------------------------- /java/org/cef/handler/CefKeyboardHandlerAdapter.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.handler; 6 | 7 | import org.cef.browser.CefBrowser; 8 | import org.cef.misc.BoolRef; 9 | 10 | /** 11 | * An abstract adapter class for receiving keyboard events. 12 | * The methods in this class are empty. 13 | * This class exists as convenience for creating handler objects. 14 | */ 15 | public abstract class CefKeyboardHandlerAdapter implements CefKeyboardHandler { 16 | @Override 17 | public boolean onPreKeyEvent( 18 | CefBrowser browser, CefKeyEvent event, BoolRef is_keyboard_shortcut) { 19 | return false; 20 | } 21 | 22 | @Override 23 | public boolean onKeyEvent(CefBrowser browser, CefKeyEvent event) { 24 | return false; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /java/org/cef/handler/CefLifeSpanHandlerAdapter.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.handler; 6 | 7 | import org.cef.browser.CefBrowser; 8 | import org.cef.browser.CefFrame; 9 | 10 | /** 11 | * An abstract adapter class for receiving life span events. 12 | * The methods in this class are empty. 13 | * This class exists as convenience for creating handler objects. 14 | */ 15 | public abstract class CefLifeSpanHandlerAdapter implements CefLifeSpanHandler { 16 | @Override 17 | public boolean onBeforePopup( 18 | CefBrowser browser, CefFrame frame, String target_url, String target_frame_name) { 19 | return false; 20 | } 21 | 22 | @Override 23 | public void onAfterCreated(CefBrowser browser) {} 24 | 25 | @Override 26 | public void onAfterParentChanged(CefBrowser browser) {} 27 | 28 | @Override 29 | public boolean doClose(CefBrowser browser) { 30 | return false; 31 | } 32 | 33 | @Override 34 | public void onBeforeClose(CefBrowser browser) {} 35 | } 36 | -------------------------------------------------------------------------------- /java/org/cef/handler/CefLoadHandlerAdapter.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.handler; 6 | 7 | import org.cef.browser.CefBrowser; 8 | import org.cef.browser.CefFrame; 9 | import org.cef.network.CefRequest.TransitionType; 10 | 11 | /** 12 | * An abstract adapter class for receiving load events. 13 | * The methods in this class are empty. 14 | * This class exists as convenience for creating handler objects. 15 | */ 16 | public abstract class CefLoadHandlerAdapter implements CefLoadHandler { 17 | @Override 18 | public void onLoadingStateChange( 19 | CefBrowser browser, boolean isLoading, boolean canGoBack, boolean canGoForward) {} 20 | 21 | @Override 22 | public void onLoadStart(CefBrowser browser, CefFrame frame, TransitionType transitionType) {} 23 | 24 | @Override 25 | public void onLoadEnd(CefBrowser browser, CefFrame frame, int httpStatusCode) {} 26 | 27 | @Override 28 | public void onLoadError(CefBrowser browser, CefFrame frame, ErrorCode errorCode, 29 | String errorText, String failedUrl) {} 30 | } 31 | -------------------------------------------------------------------------------- /java/org/cef/handler/CefMessageRouterHandlerAdapter.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.handler; 6 | 7 | import org.cef.browser.CefBrowser; 8 | import org.cef.browser.CefFrame; 9 | import org.cef.callback.CefNativeAdapter; 10 | import org.cef.callback.CefQueryCallback; 11 | 12 | /** 13 | * An abstract adapter class for receiving message router events. 14 | * The methods in this class are empty. 15 | * This class exists as convenience for creating handler objects. 16 | */ 17 | public abstract class CefMessageRouterHandlerAdapter 18 | extends CefNativeAdapter implements CefMessageRouterHandler { 19 | @Override 20 | public boolean onQuery(CefBrowser browser, CefFrame frame, long queryId, String request, 21 | boolean persistent, CefQueryCallback callback) { 22 | return false; 23 | } 24 | 25 | @Override 26 | public void onQueryCanceled(CefBrowser browser, CefFrame frame, long queryId) { 27 | return; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /java/org/cef/handler/CefRequestContextHandlerAdapter.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.handler; 6 | 7 | import org.cef.browser.CefBrowser; 8 | import org.cef.browser.CefFrame; 9 | import org.cef.misc.BoolRef; 10 | import org.cef.network.CefRequest; 11 | 12 | /** 13 | * An abstract adapter class for receiving browser request context events. 14 | * The methods in this class are empty. 15 | * This class exists as convenience for creating handler objects. 16 | */ 17 | public abstract class CefRequestContextHandlerAdapter implements CefRequestContextHandler { 18 | @Override 19 | public CefResourceRequestHandler getResourceRequestHandler(CefBrowser browser, CefFrame frame, 20 | CefRequest request, boolean isNavigation, boolean isDownload, String requestInitiator, 21 | BoolRef disableDefaultHandling) { 22 | return null; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /java/org/cef/handler/CefResourceHandlerAdapter.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.handler; 6 | 7 | import org.cef.callback.CefCallback; 8 | import org.cef.misc.IntRef; 9 | import org.cef.misc.StringRef; 10 | import org.cef.network.CefCookie; 11 | import org.cef.network.CefRequest; 12 | import org.cef.network.CefResponse; 13 | 14 | /** 15 | * An abstract adapter class for receiving resource requests. 16 | * The methods in this class are empty. 17 | * This class exists as convenience for creating handler objects. 18 | */ 19 | public abstract class CefResourceHandlerAdapter implements CefResourceHandler { 20 | @Override 21 | public boolean processRequest(CefRequest request, CefCallback callback) { 22 | return false; 23 | } 24 | 25 | @Override 26 | public void getResponseHeaders( 27 | CefResponse response, IntRef responseLength, StringRef redirectUrl) {} 28 | 29 | @Override 30 | public boolean readResponse( 31 | byte[] dataOut, int bytesToRead, IntRef bytesRead, CefCallback callback) { 32 | return false; 33 | } 34 | 35 | @Override 36 | public void cancel() {} 37 | } 38 | -------------------------------------------------------------------------------- /java/org/cef/handler/CefScreenInfo.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.handler; 6 | 7 | import java.awt.Rectangle; 8 | 9 | /** 10 | * 11 | * @author shannah 12 | */ 13 | public class CefScreenInfo { 14 | public double device_scale_factor; 15 | public int depth; 16 | public int depth_per_component; 17 | public boolean is_monochrome; 18 | public int x, y, width, height; 19 | public int available_x, available_y, available_width, available_height; 20 | 21 | public void Set(double device_scale_factor, int depth, int depth_per_component, 22 | boolean is_monochrome, Rectangle rect, Rectangle availableRect) { 23 | this.device_scale_factor = device_scale_factor; 24 | this.depth = depth; 25 | this.depth_per_component = depth_per_component; 26 | this.is_monochrome = is_monochrome; 27 | this.x = rect.x; 28 | this.y = rect.y; 29 | this.width = rect.width; 30 | this.height = rect.height; 31 | this.available_x = availableRect.x; 32 | this.available_y = availableRect.y; 33 | this.available_width = availableRect.width; 34 | this.available_height = availableRect.height; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /java/org/cef/handler/CefWindowHandlerAdapter.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.handler; 6 | 7 | import org.cef.browser.CefBrowser; 8 | 9 | import java.awt.Rectangle; 10 | 11 | /** 12 | * An abstract adapter class for receiving windowed render events. 13 | * The methods in this class are empty. 14 | * This class exists as convenience for creating handler objects. 15 | */ 16 | public abstract class CefWindowHandlerAdapter implements CefWindowHandler { 17 | @Override 18 | public Rectangle getRect(CefBrowser browser) { 19 | return new Rectangle(0, 0, 0, 0); 20 | } 21 | 22 | @Override 23 | public void onMouseEvent( 24 | CefBrowser browser, int event, int screenX, int screenY, int modifier, int button) {} 25 | } 26 | -------------------------------------------------------------------------------- /java/org/cef/misc/BoolRef.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.misc; 6 | 7 | /** 8 | * Helper class for passing boolean values by reference. 9 | */ 10 | public class BoolRef { 11 | private boolean value_; 12 | 13 | public BoolRef() {} 14 | 15 | public BoolRef(boolean value) { 16 | value_ = value; 17 | } 18 | 19 | public void set(boolean value) { 20 | value_ = value; 21 | } 22 | 23 | public boolean get() { 24 | return value_; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /java/org/cef/misc/CefPageRange.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.misc; 6 | 7 | /** 8 | * Class representing a print job page range. 9 | */ 10 | public class CefPageRange { 11 | public int from; 12 | public int to; 13 | 14 | public CefPageRange() {} 15 | 16 | public CefPageRange(int from, int to) { 17 | this.from = from; 18 | this.to = to; 19 | } 20 | } -------------------------------------------------------------------------------- /java/org/cef/misc/EventFlags.java: -------------------------------------------------------------------------------- 1 | package org.cef.misc; 2 | 3 | /** 4 | * Supported event bit flags. 5 | */ 6 | public final class EventFlags { 7 | public final static int EVENTFLAG_NONE = 0; 8 | public final static int EVENTFLAG_CAPS_LOCK_ON = 1 << 0; 9 | public final static int EVENTFLAG_SHIFT_DOWN = 1 << 1; 10 | public final static int EVENTFLAG_CONTROL_DOWN = 1 << 2; 11 | public final static int EVENTFLAG_ALT_DOWN = 1 << 3; 12 | public final static int EVENTFLAG_LEFT_MOUSE_BUTTON = 1 << 4; 13 | public final static int EVENTFLAG_MIDDLE_MOUSE_BUTTON = 1 << 5; 14 | public final static int EVENTFLAG_RIGHT_MOUSE_BUTTON = 1 << 6; 15 | // Mac OS-X command key. 16 | public final static int EVENTFLAG_COMMAND_DOWN = 1 << 7; 17 | public final static int EVENTFLAG_NUM_LOCK_ON = 1 << 8; 18 | public final static int EVENTFLAG_IS_KEY_PAD = 1 << 9; 19 | public final static int EVENTFLAG_IS_LEFT = 1 << 10; 20 | public final static int EVENTFLAG_IS_RIGHT = 1 << 11; 21 | } 22 | -------------------------------------------------------------------------------- /java/org/cef/misc/IntRef.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.misc; 6 | 7 | /** 8 | * Helper class for passing int values by reference. 9 | */ 10 | public class IntRef { 11 | private int value_; 12 | 13 | public IntRef() {} 14 | 15 | public IntRef(int value) { 16 | value_ = value; 17 | } 18 | 19 | public void set(int value) { 20 | value_ = value; 21 | } 22 | 23 | public int get() { 24 | return value_; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /java/org/cef/misc/StringRef.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package org.cef.misc; 6 | 7 | /** 8 | * Helper class for passing String values by reference. 9 | */ 10 | public class StringRef { 11 | private String value_; 12 | 13 | public StringRef() {} 14 | 15 | public StringRef(String value) { 16 | value_ = value; 17 | } 18 | 19 | public void set(String value) { 20 | value_ = value; 21 | } 22 | 23 | public String get() { 24 | return value_; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /java/tests/detailed/dialog/CertErrorDialog.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package tests.detailed.dialog; 6 | 7 | import org.cef.callback.CefCallback; 8 | import org.cef.handler.CefLoadHandler.ErrorCode; 9 | 10 | import java.awt.Frame; 11 | 12 | import javax.swing.JOptionPane; 13 | 14 | public class CertErrorDialog implements Runnable { 15 | private final Frame owner_; 16 | private final ErrorCode cert_error_; 17 | private final String request_url_; 18 | private final CefCallback callback_; 19 | 20 | public CertErrorDialog( 21 | Frame owner, ErrorCode cert_error, String request_url, CefCallback callback) { 22 | owner_ = owner; 23 | cert_error_ = cert_error; 24 | request_url_ = request_url; 25 | callback_ = callback; 26 | } 27 | 28 | @Override 29 | public void run() { 30 | int dialogResult = JOptionPane.showConfirmDialog(owner_, 31 | "An certificate error (" + cert_error_ + ") occurreed " 32 | + "while requesting\n" + request_url_ + "\nDo you want to proceed anyway?", 33 | "Certificate error", JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE); 34 | if (dialogResult == JOptionPane.YES_OPTION) { 35 | callback_.Continue(); 36 | } else { 37 | callback_.cancel(); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /java/tests/detailed/dialog/DevToolsDialog.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package tests.detailed.dialog; 6 | 7 | import org.cef.browser.CefBrowser; 8 | 9 | import java.awt.BorderLayout; 10 | import java.awt.Frame; 11 | import java.awt.Point; 12 | import java.awt.event.ComponentAdapter; 13 | import java.awt.event.ComponentEvent; 14 | 15 | import javax.swing.JDialog; 16 | 17 | @SuppressWarnings("serial") 18 | public class DevToolsDialog extends JDialog { 19 | private final CefBrowser browser_; 20 | public DevToolsDialog(Frame owner, String title, CefBrowser browser) { 21 | this(owner, title, browser, null); 22 | } 23 | 24 | public DevToolsDialog(Frame owner, String title, CefBrowser browser, Point inspectAt) { 25 | super(owner, title, false); 26 | browser_ = browser; 27 | 28 | setLayout(new BorderLayout()); 29 | setSize(800, 600); 30 | setLocation(owner.getLocation().x + 20, owner.getLocation().y + 20); 31 | 32 | browser.openDevTools(inspectAt); 33 | 34 | addComponentListener(new ComponentAdapter() { 35 | @Override 36 | public void componentHidden(ComponentEvent e) { 37 | dispose(); 38 | } 39 | }); 40 | } 41 | 42 | @Override 43 | public void dispose() { 44 | browser_.closeDevTools(); 45 | super.dispose(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /java/tests/detailed/handler/DragHandler.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package tests.detailed.handler; 6 | 7 | import org.cef.browser.CefBrowser; 8 | import org.cef.callback.CefDragData; 9 | import org.cef.handler.CefDragHandler; 10 | 11 | public class DragHandler implements CefDragHandler { 12 | @Override 13 | public boolean onDragEnter(CefBrowser browser, CefDragData dragData, int mask) { 14 | System.out.println("DRAG:"); 15 | System.out.print(" flags:"); 16 | if ((mask & CefDragHandler.DragOperationMask.DRAG_OPERATION_COPY) != 0) 17 | System.out.print(" COPY"); 18 | if ((mask & CefDragHandler.DragOperationMask.DRAG_OPERATION_LINK) != 0) 19 | System.out.print(" LINK"); 20 | if ((mask & CefDragHandler.DragOperationMask.DRAG_OPERATION_GENERIC) != 0) 21 | System.out.print(" GENERIC"); 22 | if ((mask & CefDragHandler.DragOperationMask.DRAG_OPERATION_PRIVATE) != 0) 23 | System.out.print(" PRIVATE"); 24 | if ((mask & CefDragHandler.DragOperationMask.DRAG_OPERATION_MOVE) != 0) 25 | System.out.print(" MOVE"); 26 | if ((mask & CefDragHandler.DragOperationMask.DRAG_OPERATION_DELETE) != 0) 27 | System.out.print(" DELETE"); 28 | System.out.println("\n " + dragData); 29 | return false; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /java/tests/detailed/handler/JSDialogHandler.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package tests.detailed.handler; 6 | 7 | import org.cef.browser.CefBrowser; 8 | import org.cef.callback.CefJSDialogCallback; 9 | import org.cef.handler.CefJSDialogHandlerAdapter; 10 | import org.cef.misc.BoolRef; 11 | 12 | public class JSDialogHandler extends CefJSDialogHandlerAdapter { 13 | @Override 14 | public boolean onJSDialog(CefBrowser browser, String origin_url, JSDialogType dialog_type, 15 | String message_text, String default_prompt_text, CefJSDialogCallback callback, 16 | BoolRef suppress_message) { 17 | if (message_text.equalsIgnoreCase("Never displayed")) { 18 | suppress_message.set(true); 19 | System.out.println( 20 | "The " + dialog_type + " from origin \"" + origin_url + "\" was suppressed."); 21 | System.out.println( 22 | " The content of the suppressed dialog was: \"" + message_text + "\""); 23 | } 24 | return false; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /java/tests/detailed/handler/MessageRouterHandler.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package tests.detailed.handler; 6 | 7 | import org.cef.browser.CefBrowser; 8 | import org.cef.browser.CefFrame; 9 | import org.cef.callback.CefQueryCallback; 10 | import org.cef.handler.CefMessageRouterHandlerAdapter; 11 | 12 | public class MessageRouterHandler extends CefMessageRouterHandlerAdapter { 13 | @Override 14 | public boolean onQuery(CefBrowser browser, CefFrame frame, long query_id, String request, 15 | boolean persistent, CefQueryCallback callback) { 16 | if (request.indexOf("BindingTest:") == 0) { 17 | // Reverse the message and return it to the JavaScript caller. 18 | String msg = request.substring(12); 19 | callback.success(new StringBuilder(msg).reverse().toString()); 20 | return true; 21 | } 22 | // Not handled. 23 | return false; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/tests/detailed/handler/ResourceSetErrorHandler.java: -------------------------------------------------------------------------------- 1 | package tests.detailed.handler; 2 | 3 | import org.cef.callback.CefCallback; 4 | import org.cef.handler.CefLoadHandler.ErrorCode; 5 | import org.cef.handler.CefResourceHandlerAdapter; 6 | import org.cef.misc.IntRef; 7 | import org.cef.misc.StringRef; 8 | import org.cef.network.CefRequest; 9 | import org.cef.network.CefResponse; 10 | 11 | public class ResourceSetErrorHandler extends CefResourceHandlerAdapter { 12 | @Override 13 | public boolean processRequest(CefRequest request, CefCallback callback) { 14 | System.out.println("processRequest: " + request); 15 | callback.Continue(); 16 | return true; 17 | } 18 | 19 | @Override 20 | public void getResponseHeaders( 21 | CefResponse response, IntRef response_length, StringRef redirectUrl) { 22 | response.setError(ErrorCode.ERR_NOT_IMPLEMENTED); 23 | System.out.println("getResponseHeaders: " + response); 24 | } 25 | } -------------------------------------------------------------------------------- /java/tests/detailed/handler/binding_test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Binding Test 4 | 18 | 19 | 20 | 21 |

22 | Message: 23 |
24 |
You should see the reverse of your message below: 25 |
26 |
27 | 28 | 29 | -------------------------------------------------------------------------------- /java/tests/detailed/handler/localstorage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | Click the "Add Line" button to add a line or the "Clear" button to clear.
15 | This data will persist across sessions if a cache path was specified.
16 | 17 | 18 |
19 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /java/tests/detailed/handler/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chromiumembedded/java-cef/ca49ada5c7e3fc98cd7058b6253b59f967530a65/java/tests/detailed/handler/logo.png -------------------------------------------------------------------------------- /java/tests/detailed/handler/spellcheck.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Spellcheck Test 4 | 5 | 6 | 7 | The next paragraph contains some text to be validated against the spell-checker. 8 |
Click into the following box. To replace a misspelled word use the 9 | right-mouse-click.
10 |

11 | This is a misspelled paragrapph. Withh maany errors
Click into this bogx 12 | to ttest it.

13 | 14 | 15 | -------------------------------------------------------------------------------- /java/tests/detailed/ui/StatusPanel.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package tests.detailed.ui; 6 | 7 | import java.awt.Dimension; 8 | 9 | import javax.swing.Box; 10 | import javax.swing.BoxLayout; 11 | import javax.swing.JLabel; 12 | import javax.swing.JPanel; 13 | import javax.swing.JProgressBar; 14 | 15 | @SuppressWarnings("serial") 16 | public class StatusPanel extends JPanel { 17 | private final JProgressBar progressBar_; 18 | private final JLabel status_field_; 19 | 20 | public StatusPanel() { 21 | setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); 22 | 23 | add(Box.createHorizontalStrut(5)); 24 | add(Box.createHorizontalStrut(5)); 25 | 26 | progressBar_ = new JProgressBar(); 27 | Dimension progressBarSize = progressBar_.getMaximumSize(); 28 | progressBarSize.width = 100; 29 | progressBar_.setMinimumSize(progressBarSize); 30 | progressBar_.setMaximumSize(progressBarSize); 31 | add(progressBar_); 32 | add(Box.createHorizontalStrut(5)); 33 | 34 | status_field_ = new JLabel("Info"); 35 | status_field_.setAlignmentX(LEFT_ALIGNMENT); 36 | add(status_field_); 37 | add(Box.createHorizontalStrut(5)); 38 | add(Box.createVerticalStrut(21)); 39 | } 40 | 41 | public void setIsInProgress(boolean inProgress) { 42 | progressBar_.setIndeterminate(inProgress); 43 | } 44 | 45 | public void setStatusText(String text) { 46 | status_field_.setText(text); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /java/tests/detailed/util/DataUri.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package tests.detailed.util; 6 | 7 | /** 8 | * Utility class for creating data: URIs that can be passed to CefBrowser.loadURL. 9 | */ 10 | public class DataUri { 11 | public static String create(String mimeType, String contents) { 12 | return "data:" + mimeType + ";base64," 13 | + java.util.Base64.getEncoder().encodeToString(contents.getBytes()); 14 | } 15 | }; 16 | -------------------------------------------------------------------------------- /java/tests/junittests/TestSetupContext.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | package tests.junittests; 6 | 7 | import org.junit.jupiter.api.extension.ExtensionContext; 8 | 9 | import java.util.Optional; 10 | 11 | // Stores global test setup state for access from package classes. 12 | class TestSetupContext { 13 | private static boolean debugPrint_ = false; 14 | 15 | // Debug print statements may be enabled via `--config debugPrint=true`. 16 | static boolean debugPrint() { 17 | return debugPrint_; 18 | } 19 | 20 | // Initialize from global configuration parameters. 21 | static void initialize(ExtensionContext context) { 22 | Optional debugPrint = context.getConfigurationParameter("debugPrint"); 23 | if (debugPrint.isPresent() && debugPrint.get().equalsIgnoreCase("true")) { 24 | debugPrint_ = true; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /native/CefAuthCallback_N.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #include "CefAuthCallback_N.h" 6 | #include "include/cef_request_handler.h" 7 | #include "jni_scoped_helpers.h" 8 | #include "jni_util.h" 9 | 10 | namespace { 11 | 12 | CefRefPtr GetSelf(jlong self) { 13 | return reinterpret_cast(self); 14 | } 15 | 16 | void ClearSelf(JNIEnv* env, jobject obj) { 17 | // Clear the reference added in RequestHandler::GetAuthCredentials. 18 | SetCefForJNIObject(env, obj, nullptr, "CefAuthCallback"); 19 | } 20 | 21 | } // namespace 22 | 23 | JNIEXPORT void JNICALL 24 | Java_org_cef_callback_CefAuthCallback_1N_N_1Continue(JNIEnv* env, 25 | jobject obj, 26 | jlong self, 27 | jstring username, 28 | jstring password) { 29 | CefRefPtr callback = GetSelf(self); 30 | if (!callback) 31 | return; 32 | callback->Continue(GetJNIString(env, username), GetJNIString(env, password)); 33 | ClearSelf(env, obj); 34 | } 35 | 36 | JNIEXPORT void JNICALL 37 | Java_org_cef_callback_CefAuthCallback_1N_N_1Cancel(JNIEnv* env, 38 | jobject obj, 39 | jlong self) { 40 | CefRefPtr callback = GetSelf(self); 41 | if (!callback) 42 | return; 43 | callback->Cancel(); 44 | ClearSelf(env, obj); 45 | } 46 | -------------------------------------------------------------------------------- /native/CefAuthCallback_N.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class org_cef_callback_CefAuthCallback_N */ 4 | 5 | #ifndef _Included_org_cef_callback_CefAuthCallback_N 6 | #define _Included_org_cef_callback_CefAuthCallback_N 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: org_cef_callback_CefAuthCallback_N 12 | * Method: N_Continue 13 | * Signature: (JLjava/lang/String;Ljava/lang/String;)V 14 | */ 15 | JNIEXPORT void JNICALL 16 | Java_org_cef_callback_CefAuthCallback_1N_N_1Continue(JNIEnv*, 17 | jobject, 18 | jlong, 19 | jstring, 20 | jstring); 21 | 22 | /* 23 | * Class: org_cef_callback_CefAuthCallback_N 24 | * Method: N_Cancel 25 | * Signature: (J)V 26 | */ 27 | JNIEXPORT void JNICALL 28 | Java_org_cef_callback_CefAuthCallback_1N_N_1Cancel(JNIEnv*, jobject, jlong); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | #endif 34 | -------------------------------------------------------------------------------- /native/CefBeforeDownloadCallback_N.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #include "CefBeforeDownloadCallback_N.h" 6 | #include "include/cef_download_handler.h" 7 | #include "jni_scoped_helpers.h" 8 | #include "jni_util.h" 9 | 10 | namespace { 11 | 12 | CefRefPtr GetSelf(jlong self) { 13 | return reinterpret_cast(self); 14 | } 15 | 16 | void ClearSelf(JNIEnv* env, jobject obj) { 17 | // Clear the reference added in DownloadHandler::OnBeforeDownload. 18 | SetCefForJNIObject(env, obj, nullptr, 19 | "CefBeforeDownloadCallback"); 20 | } 21 | 22 | } // namespace 23 | 24 | JNIEXPORT void JNICALL 25 | Java_org_cef_callback_CefBeforeDownloadCallback_1N_N_1Continue( 26 | JNIEnv* env, 27 | jobject obj, 28 | jlong self, 29 | jstring jdownloadPath, 30 | jboolean jshowDialog) { 31 | CefRefPtr callback = GetSelf(self); 32 | if (!callback) 33 | return; 34 | callback->Continue(GetJNIString(env, jdownloadPath), 35 | jshowDialog != JNI_FALSE); 36 | ClearSelf(env, obj); 37 | } 38 | -------------------------------------------------------------------------------- /native/CefBeforeDownloadCallback_N.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class org_cef_callback_CefBeforeDownloadCallback_N */ 4 | 5 | #ifndef _Included_org_cef_callback_CefBeforeDownloadCallback_N 6 | #define _Included_org_cef_callback_CefBeforeDownloadCallback_N 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: org_cef_callback_CefBeforeDownloadCallback_N 12 | * Method: N_Continue 13 | * Signature: (JLjava/lang/String;Z)V 14 | */ 15 | JNIEXPORT void JNICALL 16 | Java_org_cef_callback_CefBeforeDownloadCallback_1N_N_1Continue(JNIEnv*, 17 | jobject, 18 | jlong, 19 | jstring, 20 | jboolean); 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | #endif 26 | -------------------------------------------------------------------------------- /native/CefCallback_N.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #include "CefCallback_N.h" 6 | #include "include/cef_callback.h" 7 | #include "jni_scoped_helpers.h" 8 | 9 | namespace { 10 | 11 | CefRefPtr GetSelf(jlong self) { 12 | return reinterpret_cast(self); 13 | } 14 | 15 | void ClearSelf(JNIEnv* env, jobject obj) { 16 | // Clear the reference added in ResourceHandler. 17 | SetCefForJNIObject(env, obj, nullptr, "CefCallback"); 18 | } 19 | 20 | } // namespace 21 | 22 | JNIEXPORT void JNICALL 23 | Java_org_cef_callback_CefCallback_1N_N_1Continue(JNIEnv* env, 24 | jobject obj, 25 | jlong self) { 26 | CefRefPtr callback = GetSelf(self); 27 | if (!callback) 28 | return; 29 | callback->Continue(); 30 | ClearSelf(env, obj); 31 | } 32 | 33 | JNIEXPORT void JNICALL 34 | Java_org_cef_callback_CefCallback_1N_N_1Cancel(JNIEnv* env, 35 | jobject obj, 36 | jlong self) { 37 | CefRefPtr callback = GetSelf(self); 38 | if (!callback) 39 | return; 40 | callback->Cancel(); 41 | ClearSelf(env, obj); 42 | } 43 | -------------------------------------------------------------------------------- /native/CefCallback_N.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class org_cef_callback_CefCallback_N */ 4 | 5 | #ifndef _Included_org_cef_callback_CefCallback_N 6 | #define _Included_org_cef_callback_CefCallback_N 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: org_cef_callback_CefCallback_N 12 | * Method: N_Continue 13 | * Signature: (J)V 14 | */ 15 | JNIEXPORT void JNICALL Java_org_cef_callback_CefCallback_1N_N_1Continue(JNIEnv*, 16 | jobject, 17 | jlong); 18 | 19 | /* 20 | * Class: org_cef_callback_CefCallback_N 21 | * Method: N_Cancel 22 | * Signature: (J)V 23 | */ 24 | JNIEXPORT void JNICALL Java_org_cef_callback_CefCallback_1N_N_1Cancel(JNIEnv*, 25 | jobject, 26 | jlong); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | #endif 32 | -------------------------------------------------------------------------------- /native/CefFileDialogCallback_N.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class org_cef_callback_CefFileDialogCallback_N */ 4 | 5 | #ifndef _Included_org_cef_callback_CefFileDialogCallback_N 6 | #define _Included_org_cef_callback_CefFileDialogCallback_N 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: org_cef_callback_CefFileDialogCallback_N 12 | * Method: N_Continue 13 | * Signature: (JLjava/util/Vector;)V 14 | */ 15 | JNIEXPORT void JNICALL 16 | Java_org_cef_callback_CefFileDialogCallback_1N_N_1Continue(JNIEnv*, 17 | jobject, 18 | jlong, 19 | jobject); 20 | 21 | /* 22 | * Class: org_cef_callback_CefFileDialogCallback_N 23 | * Method: N_Cancel 24 | * Signature: (J)V 25 | */ 26 | JNIEXPORT void JNICALL 27 | Java_org_cef_callback_CefFileDialogCallback_1N_N_1Cancel(JNIEnv*, 28 | jobject, 29 | jlong); 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | #endif 35 | -------------------------------------------------------------------------------- /native/CefJSDialogCallback_N.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #include "CefJSDialogCallback_N.h" 6 | #include "include/cef_jsdialog_handler.h" 7 | #include "jni_scoped_helpers.h" 8 | #include "jni_util.h" 9 | 10 | namespace { 11 | 12 | CefRefPtr GetSelf(jlong self) { 13 | return reinterpret_cast(self); 14 | } 15 | 16 | void ClearSelf(JNIEnv* env, jobject obj) { 17 | // Clear the reference added in JSDialogHandler::OnJSDialog and 18 | // JSDialogHandler::OnBeforeUnloadDialog. 19 | SetCefForJNIObject(env, obj, nullptr, 20 | "CefJSDialogCallback"); 21 | } 22 | 23 | } // namespace 24 | 25 | JNIEXPORT void JNICALL 26 | Java_org_cef_callback_CefJSDialogCallback_1N_N_1Continue(JNIEnv* env, 27 | jobject obj, 28 | jlong self, 29 | jboolean jsuccess, 30 | jstring juser_input) { 31 | CefRefPtr callback = GetSelf(self); 32 | if (!callback) 33 | return; 34 | callback->Continue((jsuccess != JNI_FALSE), GetJNIString(env, juser_input)); 35 | ClearSelf(env, obj); 36 | } 37 | -------------------------------------------------------------------------------- /native/CefJSDialogCallback_N.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class org_cef_callback_CefJSDialogCallback_N */ 4 | 5 | #ifndef _Included_org_cef_callback_CefJSDialogCallback_N 6 | #define _Included_org_cef_callback_CefJSDialogCallback_N 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: org_cef_callback_CefJSDialogCallback_N 12 | * Method: N_Continue 13 | * Signature: (JZLjava/lang/String;)V 14 | */ 15 | JNIEXPORT void JNICALL 16 | Java_org_cef_callback_CefJSDialogCallback_1N_N_1Continue(JNIEnv*, 17 | jobject, 18 | jlong, 19 | jboolean, 20 | jstring); 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | #endif 26 | -------------------------------------------------------------------------------- /native/CefPrintDialogCallback_N.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class org_cef_callback_CefPrintDialogCallback_N */ 4 | 5 | #ifndef _Included_org_cef_callback_CefPrintDialogCallback_N 6 | #define _Included_org_cef_callback_CefPrintDialogCallback_N 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: org_cef_callback_CefPrintDialogCallback_N 12 | * Method: N_Continue 13 | * Signature: (JLorg/cef/misc/CefPrintSettings;)V 14 | */ 15 | JNIEXPORT void JNICALL 16 | Java_org_cef_callback_CefPrintDialogCallback_1N_N_1Continue(JNIEnv*, 17 | jobject, 18 | jlong, 19 | jobject); 20 | 21 | /* 22 | * Class: org_cef_callback_CefPrintDialogCallback_N 23 | * Method: N_Cancel 24 | * Signature: (J)V 25 | */ 26 | JNIEXPORT void JNICALL 27 | Java_org_cef_callback_CefPrintDialogCallback_1N_N_1Cancel(JNIEnv*, 28 | jobject, 29 | jlong); 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | #endif 35 | -------------------------------------------------------------------------------- /native/CefPrintJobCallback_N.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #include "CefPrintJobCallback_N.h" 6 | #include "jni_scoped_helpers.h" 7 | 8 | #include "include/cef_print_handler.h" 9 | 10 | namespace { 11 | 12 | CefRefPtr GetSelf(jlong self) { 13 | return reinterpret_cast(self); 14 | } 15 | 16 | void ClearSelf(JNIEnv* env, jobject obj) { 17 | // Clear the reference added in PrintJobHandler::OnPrintJob. 18 | SetCefForJNIObject(env, obj, nullptr, 19 | "CefPrintJobCallback"); 20 | } 21 | 22 | } // namespace 23 | 24 | JNIEXPORT void JNICALL 25 | Java_org_cef_callback_CefPrintJobCallback_1N_N_1Continue(JNIEnv* env, 26 | jobject obj, 27 | jlong self) { 28 | CefRefPtr callback = GetSelf(self); 29 | if (!callback) 30 | return; 31 | callback->Continue(); 32 | ClearSelf(env, obj); 33 | } 34 | -------------------------------------------------------------------------------- /native/CefPrintJobCallback_N.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class org_cef_callback_CefPrintJobCallback_N */ 4 | 5 | #ifndef _Included_org_cef_callback_CefPrintJobCallback_N 6 | #define _Included_org_cef_callback_CefPrintJobCallback_N 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: org_cef_callback_CefPrintJobCallback_N 12 | * Method: N_Continue 13 | * Signature: (J)V 14 | */ 15 | JNIEXPORT void JNICALL 16 | Java_org_cef_callback_CefPrintJobCallback_1N_N_1Continue(JNIEnv*, 17 | jobject, 18 | jlong); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | #endif 24 | -------------------------------------------------------------------------------- /native/CefQueryCallback_N.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class org_cef_callback_CefQueryCallback_N */ 4 | 5 | #ifndef _Included_org_cef_callback_CefQueryCallback_N 6 | #define _Included_org_cef_callback_CefQueryCallback_N 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: org_cef_callback_CefQueryCallback_N 12 | * Method: N_Success 13 | * Signature: (JLjava/lang/String;)V 14 | */ 15 | JNIEXPORT void JNICALL 16 | Java_org_cef_callback_CefQueryCallback_1N_N_1Success(JNIEnv*, 17 | jobject, 18 | jlong, 19 | jstring); 20 | 21 | /* 22 | * Class: org_cef_callback_CefQueryCallback_N 23 | * Method: N_Failure 24 | * Signature: (JILjava/lang/String;)V 25 | */ 26 | JNIEXPORT void JNICALL 27 | Java_org_cef_callback_CefQueryCallback_1N_N_1Failure(JNIEnv*, 28 | jobject, 29 | jlong, 30 | jint, 31 | jstring); 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | #endif 37 | -------------------------------------------------------------------------------- /native/CefRegistration_N.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #include "CefRegistration_N.h" 6 | #include "include/cef_registration.h" 7 | #include "jni_scoped_helpers.h" 8 | 9 | JNIEXPORT void JNICALL 10 | Java_org_cef_browser_CefRegistration_1N_N_1Dispose(JNIEnv* env, 11 | jobject obj, 12 | jlong self) { 13 | SetCefForJNIObject(env, obj, NULL, "CefRegistration"); 14 | } 15 | -------------------------------------------------------------------------------- /native/CefRegistration_N.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class org_cef_browser_CefRegistration_N */ 4 | 5 | #ifndef _Included_org_cef_browser_CefRegistration_N 6 | #define _Included_org_cef_browser_CefRegistration_N 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: org_cef_browser_CefRegistration_N 12 | * Method: N_Dispose 13 | * Signature: (J)V 14 | */ 15 | JNIEXPORT void JNICALL 16 | Java_org_cef_browser_CefRegistration_1N_N_1Dispose(JNIEnv*, jobject, jlong); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | #endif 22 | -------------------------------------------------------------------------------- /native/CefRequestContext_N.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class org_cef_browser_CefRequestContext_N */ 4 | 5 | #ifndef _Included_org_cef_browser_CefRequestContext_N 6 | #define _Included_org_cef_browser_CefRequestContext_N 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: org_cef_browser_CefRequestContext_N 12 | * Method: N_GetGlobalContext 13 | * Signature: ()Lorg/cef/browser/CefRequestContext_N; 14 | */ 15 | JNIEXPORT jobject JNICALL 16 | Java_org_cef_browser_CefRequestContext_1N_N_1GetGlobalContext(JNIEnv*, jclass); 17 | 18 | /* 19 | * Class: org_cef_browser_CefRequestContext_N 20 | * Method: N_CreateContext 21 | * Signature: 22 | * (Lorg/cef/handler/CefRequestContextHandler;)Lorg/cef/browser/CefRequestContext_N; 23 | */ 24 | JNIEXPORT jobject JNICALL 25 | Java_org_cef_browser_CefRequestContext_1N_N_1CreateContext(JNIEnv*, 26 | jclass, 27 | jobject); 28 | 29 | /* 30 | * Class: org_cef_browser_CefRequestContext_N 31 | * Method: N_IsGlobal 32 | * Signature: ()Z 33 | */ 34 | JNIEXPORT jboolean JNICALL 35 | Java_org_cef_browser_CefRequestContext_1N_N_1IsGlobal(JNIEnv*, jobject); 36 | 37 | /* 38 | * Class: org_cef_browser_CefRequestContext_N 39 | * Method: N_CefRequestContext_DTOR 40 | * Signature: ()V 41 | */ 42 | JNIEXPORT void JNICALL 43 | Java_org_cef_browser_CefRequestContext_1N_N_1CefRequestContext_1DTOR(JNIEnv*, 44 | jobject); 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | #endif 50 | -------------------------------------------------------------------------------- /native/CefSchemeRegistrar_N.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class org_cef_callback_CefSchemeRegistrar_N */ 4 | 5 | #ifndef _Included_org_cef_callback_CefSchemeRegistrar_N 6 | #define _Included_org_cef_callback_CefSchemeRegistrar_N 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: org_cef_callback_CefSchemeRegistrar_N 12 | * Method: N_AddCustomScheme 13 | * Signature: (Ljava/lang/String;ZZZZZZZ)Z 14 | */ 15 | JNIEXPORT jboolean JNICALL 16 | Java_org_cef_callback_CefSchemeRegistrar_1N_N_1AddCustomScheme(JNIEnv*, 17 | jobject, 18 | jstring, 19 | jboolean, 20 | jboolean, 21 | jboolean, 22 | jboolean, 23 | jboolean, 24 | jboolean, 25 | jboolean); 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | #endif 31 | -------------------------------------------------------------------------------- /native/client_app.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef JCEF_NATIVE_CLIENT_APP_H_ 6 | #define JCEF_NATIVE_CLIENT_APP_H_ 7 | #pragma once 8 | 9 | #include 10 | 11 | #include "include/cef_app.h" 12 | 13 | #include "browser_process_handler.h" 14 | #include "jni_scoped_helpers.h" 15 | 16 | // ClientApp implementation. 17 | class ClientApp : public CefApp { 18 | public: 19 | ClientApp(const std::string& cache_path, 20 | JNIEnv* env, 21 | const jobject app_handler); 22 | 23 | // CefApp methods: 24 | void OnBeforeCommandLineProcessing( 25 | const CefString& process_type, 26 | CefRefPtr command_line) override; 27 | void OnRegisterCustomSchemes( 28 | CefRawPtr registrar) override; 29 | CefRefPtr GetBrowserProcessHandler() override; 30 | 31 | #if defined(OS_MACOSX) 32 | // Used to continue termination handling in Java. 33 | bool HandleTerminate(); 34 | #endif 35 | 36 | // Used to manage the lifespan of temporary files. 37 | static void registerTempFile(const std::string& tmpFile); 38 | static void eraseTempFiles(); 39 | 40 | protected: 41 | const std::string cache_path_; 42 | ScopedJNIObjectGlobal handle_; 43 | CefRefPtr process_handler_; 44 | 45 | // Include the default reference counting implementation. 46 | IMPLEMENT_REFCOUNTING(ClientApp); 47 | }; 48 | 49 | #endif // JCEF_NATIVE_CLIENT_APP_H_ 50 | -------------------------------------------------------------------------------- /native/compatibility.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /native/completion_callback.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #include "completion_callback.h" 6 | 7 | #include "jni_scoped_helpers.h" 8 | #include "jni_util.h" 9 | #include "util.h" 10 | 11 | CompletionCallback::CompletionCallback(JNIEnv* env, jobject jhandler) 12 | : handle_(env, jhandler) {} 13 | 14 | void CompletionCallback::OnComplete() { 15 | ScopedJNIEnv env; 16 | if (!env) 17 | return; 18 | JNI_CALL_VOID_METHOD(env, handle_, "onComplete", "()V"); 19 | } 20 | -------------------------------------------------------------------------------- /native/completion_callback.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef JCEF_NATIVE_COMPLETION_CALLBACK_H_ 6 | #define JCEF_NATIVE_COMPLETION_CALLBACK_H_ 7 | #pragma once 8 | 9 | #include 10 | 11 | #include "include/cef_callback.h" 12 | 13 | #include "jni_scoped_helpers.h" 14 | 15 | // CompletionCallback implementation. 16 | class CompletionCallback : public CefCompletionCallback { 17 | public: 18 | CompletionCallback(JNIEnv* env, jobject jhandler); 19 | 20 | // CompletionCallback methods 21 | virtual void OnComplete() override; 22 | 23 | protected: 24 | ScopedJNIObjectGlobal handle_; 25 | 26 | // Include the default reference counting implementation. 27 | IMPLEMENT_REFCOUNTING(CompletionCallback); 28 | }; 29 | 30 | #endif // JCEF_NATIVE_COMPLETION_CALLBACK_H_ 31 | -------------------------------------------------------------------------------- /native/context.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef JCEF_NATIVE_CONTEXT_H_ 6 | #define JCEF_NATIVE_CONTEXT_H_ 7 | #pragma once 8 | 9 | #include 10 | 11 | #include "include/base/cef_macros.h" 12 | #include "include/base/cef_thread_checker.h" 13 | 14 | #include "temp_window.h" 15 | 16 | #if defined(OS_MACOSX) 17 | #include "include/wrapper/cef_library_loader.h" 18 | #endif 19 | 20 | class Context { 21 | public: 22 | static void Create(); 23 | static void Destroy(); 24 | 25 | // Returns the singleton instance of this object. 26 | static Context* GetInstance(); 27 | 28 | bool PreInitialize(JNIEnv* env, jobject c); 29 | bool Initialize(JNIEnv* env, 30 | jobject c, 31 | jobject appHandler, 32 | jobject jsettings); 33 | void OnContextInitialized(); 34 | void DoMessageLoopWork(); 35 | void Shutdown(); 36 | 37 | private: 38 | Context(); 39 | ~Context(); 40 | 41 | bool external_message_pump_; 42 | base::ThreadChecker thread_checker_; 43 | 44 | std::unique_ptr temp_window_; 45 | 46 | DISALLOW_COPY_AND_ASSIGN(Context); 47 | }; 48 | 49 | #endif // JCEF_NATIVE_CONTEXT_H_ 50 | -------------------------------------------------------------------------------- /native/context_menu_handler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef JCEF_NATIVE_CONTEXT_MENU_HANDLER_H_ 6 | #define JCEF_NATIVE_CONTEXT_MENU_HANDLER_H_ 7 | #pragma once 8 | 9 | #include 10 | #include "include/cef_context_menu_handler.h" 11 | 12 | #include "jni_scoped_helpers.h" 13 | 14 | // ContextMenuHandler implementation. 15 | class ContextMenuHandler : public CefContextMenuHandler { 16 | public: 17 | ContextMenuHandler(JNIEnv* env, jobject handler); 18 | 19 | // CefContextMenuHandler methods 20 | void OnBeforeContextMenu(CefRefPtr browser, 21 | CefRefPtr frame, 22 | CefRefPtr params, 23 | CefRefPtr model) override; 24 | bool OnContextMenuCommand(CefRefPtr browser, 25 | CefRefPtr frame, 26 | CefRefPtr params, 27 | int command_id, 28 | EventFlags event_flags) override; 29 | void OnContextMenuDismissed(CefRefPtr browser, 30 | CefRefPtr frame) override; 31 | 32 | protected: 33 | ScopedJNIObjectGlobal handle_; 34 | 35 | // Include the default reference counting implementation. 36 | IMPLEMENT_REFCOUNTING(ContextMenuHandler); 37 | }; 38 | 39 | #endif // JCEF_NATIVE_CONTEXT_MENU_HANDLER_H_ 40 | -------------------------------------------------------------------------------- /native/cookie_access_filter.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef JCEF_NATIVE_COOKIE_ACCESS_FILTER_H_ 6 | #define JCEF_NATIVE_COOKIE_ACCESS_FILTER_H_ 7 | #pragma once 8 | 9 | #include 10 | #include "include/cef_resource_request_handler.h" 11 | 12 | #include "jni_scoped_helpers.h" 13 | 14 | // CookieAccessFilter implementation. 15 | class CookieAccessFilter : public CefCookieAccessFilter { 16 | public: 17 | CookieAccessFilter(JNIEnv* env, jobject handler); 18 | 19 | // CefCookieAccessFilter methods: 20 | bool CanSendCookie(CefRefPtr browser, 21 | CefRefPtr frame, 22 | CefRefPtr request, 23 | const CefCookie& cookie) override; 24 | bool CanSaveCookie(CefRefPtr browser, 25 | CefRefPtr frame, 26 | CefRefPtr request, 27 | CefRefPtr response, 28 | const CefCookie& cookie) override; 29 | 30 | protected: 31 | ScopedJNIObjectGlobal handle_; 32 | 33 | // Include the default reference counting implementation. 34 | IMPLEMENT_REFCOUNTING(CookieAccessFilter); 35 | }; 36 | 37 | #endif // JCEF_NATIVE_COOKIE_ACCESS_FILTER_H_ 38 | -------------------------------------------------------------------------------- /native/cookie_visitor.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #include "cookie_visitor.h" 6 | 7 | #include "jni_scoped_helpers.h" 8 | #include "jni_util.h" 9 | #include "util.h" 10 | 11 | CookieVisitor::CookieVisitor(JNIEnv* env, jobject jvisitor) 12 | : handle_(env, jvisitor) {} 13 | 14 | bool CookieVisitor::Visit(const CefCookie& cookie, 15 | int count, 16 | int total, 17 | bool& deleteCookie) { 18 | ScopedJNIEnv env; 19 | if (!env) 20 | return false; 21 | 22 | ScopedJNICookie jcookie(env, cookie); 23 | ScopedJNIBoolRef jdeleteCookie(env, deleteCookie); 24 | jboolean jresult = JNI_FALSE; 25 | 26 | JNI_CALL_METHOD(env, handle_, "visit", 27 | "(Lorg/cef/network/CefCookie;IILorg/cef/misc/BoolRef;)Z", 28 | Boolean, jresult, jcookie.get(), (jint)count, (jint)total, 29 | jdeleteCookie.get()); 30 | 31 | deleteCookie = jdeleteCookie; 32 | return (jresult != JNI_FALSE); 33 | } 34 | -------------------------------------------------------------------------------- /native/cookie_visitor.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef JCEF_NATIVE_COOKIE_VISITOR_H_ 6 | #define JCEF_NATIVE_COOKIE_VISITOR_H_ 7 | #pragma once 8 | 9 | #include 10 | 11 | #include "include/cef_cookie.h" 12 | 13 | #include "jni_scoped_helpers.h" 14 | 15 | // CookieVisitor implementation. 16 | class CookieVisitor : public CefCookieVisitor { 17 | public: 18 | CookieVisitor(JNIEnv* env, jobject jvisitor); 19 | 20 | // CookieVisitor methods 21 | virtual bool Visit(const CefCookie& cookie, 22 | int count, 23 | int total, 24 | bool& deleteCookie) override; 25 | 26 | protected: 27 | ScopedJNIObjectGlobal handle_; 28 | 29 | // Include the default reference counting implementation. 30 | IMPLEMENT_REFCOUNTING(CookieVisitor); 31 | }; 32 | 33 | #endif // JCEF_NATIVE_COOKIE_VISITOR_H_ 34 | -------------------------------------------------------------------------------- /native/critical_wait.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef JCEF_NATIVE_CRITICAL_WAIT_H_ 6 | #define JCEF_NATIVE_CRITICAL_WAIT_H_ 7 | #pragma once 8 | 9 | #include "include/cef_task.h" 10 | 11 | #if defined(OS_WIN) 12 | #include 13 | #define WAIT_MUTEX HANDLE 14 | #define WAIT_COND HANDLE 15 | #else 16 | #include 17 | #define WAIT_MUTEX pthread_mutex_t 18 | #define WAIT_COND pthread_cond_t 19 | #endif 20 | 21 | class CriticalLock { 22 | public: 23 | CriticalLock(); 24 | ~CriticalLock(); 25 | 26 | void Lock(); 27 | void Unlock(); 28 | 29 | private: 30 | friend class CriticalWait; 31 | WAIT_MUTEX lock_; 32 | }; 33 | 34 | class CriticalWait { 35 | public: 36 | explicit CriticalWait(CriticalLock* lock); 37 | ~CriticalWait(); 38 | 39 | void Wait(); 40 | bool Wait(unsigned int maxWaitMs); 41 | void WakeUp(); 42 | 43 | CriticalLock* lock() { return lock_; } 44 | 45 | private: 46 | WAIT_COND cond_; 47 | CriticalLock* lock_; 48 | }; 49 | 50 | #endif // JCEF_NATIVE_CRITICAL_WAIT_H_ 51 | -------------------------------------------------------------------------------- /native/critical_wait_posix.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #include "critical_wait.h" 6 | 7 | #include 8 | 9 | // CriticalLock 10 | 11 | CriticalLock::CriticalLock() { 12 | pthread_mutex_init(&lock_, nullptr); 13 | } 14 | 15 | CriticalLock::~CriticalLock() { 16 | pthread_mutex_destroy(&lock_); 17 | } 18 | 19 | void CriticalLock::Lock() { 20 | pthread_mutex_lock(&lock_); 21 | } 22 | 23 | void CriticalLock::Unlock() { 24 | pthread_mutex_unlock(&lock_); 25 | } 26 | 27 | // CriticalWait 28 | 29 | CriticalWait::CriticalWait(CriticalLock* lock) : lock_(lock) { 30 | pthread_cond_init(&cond_, nullptr); 31 | } 32 | 33 | CriticalWait::~CriticalWait() { 34 | pthread_cond_destroy(&cond_); 35 | } 36 | 37 | void CriticalWait::Wait() { 38 | pthread_cond_wait(&cond_, &lock_->lock_); 39 | } 40 | 41 | bool CriticalWait::Wait(unsigned int maxWaitMs) { 42 | int sec = (int)(maxWaitMs / 1000); 43 | int nsec = (maxWaitMs - sec * 1000) * 1000000; // convert to nsec 44 | struct timeval tv; 45 | struct timespec ts; 46 | 47 | gettimeofday(&tv, nullptr); 48 | ts.tv_sec = tv.tv_sec + sec; 49 | ts.tv_nsec = nsec; 50 | 51 | int res = pthread_cond_timedwait(&cond_, &lock_->lock_, &ts); 52 | return res == 0; 53 | } 54 | 55 | void CriticalWait::WakeUp() { 56 | pthread_cond_signal(&cond_); 57 | } 58 | -------------------------------------------------------------------------------- /native/critical_wait_win.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #include "critical_wait.h" 6 | 7 | // CriticalLock 8 | 9 | CriticalLock::CriticalLock() { 10 | lock_ = CreateMutex(nullptr, FALSE, nullptr); 11 | } 12 | 13 | CriticalLock::~CriticalLock() { 14 | CloseHandle(lock_); 15 | } 16 | 17 | void CriticalLock::Lock() { 18 | WaitForSingleObject(lock_, INFINITE); 19 | } 20 | 21 | void CriticalLock::Unlock() { 22 | ReleaseMutex(lock_); 23 | } 24 | 25 | // CriticalWait 26 | 27 | CriticalWait::CriticalWait(CriticalLock* lock) : lock_(lock) { 28 | cond_ = CreateEvent(nullptr, FALSE, FALSE, nullptr); 29 | } 30 | 31 | CriticalWait::~CriticalWait() { 32 | CloseHandle(cond_); 33 | } 34 | 35 | void CriticalWait::Wait() { 36 | lock_->Unlock(); 37 | WaitForSingleObject(cond_, INFINITE); 38 | lock_->Lock(); 39 | } 40 | 41 | bool CriticalWait::Wait(unsigned int maxWaitMs) { 42 | lock_->Unlock(); 43 | DWORD result = WaitForSingleObject(cond_, (DWORD)maxWaitMs); 44 | lock_->Lock(); 45 | return result != WAIT_FAILED; 46 | } 47 | 48 | void CriticalWait::WakeUp() { 49 | SetEvent(cond_); 50 | } 51 | -------------------------------------------------------------------------------- /native/devtools_message_observer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef JCEF_NATIVE_DEVTOOLS_MESSAGE_OBSERVER_H_ 6 | #define JCEF_NATIVE_DEVTOOLS_MESSAGE_OBSERVER_H_ 7 | #pragma once 8 | 9 | #include 10 | #include "include/cef_devtools_message_observer.h" 11 | 12 | #include "jni_scoped_helpers.h" 13 | 14 | // DevToolsMessageObserver implementation. 15 | class DevToolsMessageObserver : public CefDevToolsMessageObserver { 16 | public: 17 | DevToolsMessageObserver(JNIEnv* env, jobject observer); 18 | 19 | // CefDevToolsMessageObserver methods 20 | virtual void OnDevToolsMethodResult(CefRefPtr browser, 21 | int message_id, 22 | bool success, 23 | const void* result, 24 | size_t result_size) override; 25 | virtual void OnDevToolsEvent(CefRefPtr browser, 26 | const CefString& method, 27 | const void* params, 28 | size_t params_size) override; 29 | 30 | protected: 31 | ScopedJNIObjectGlobal handle_; 32 | 33 | // Include the default reference counting implementation. 34 | IMPLEMENT_REFCOUNTING(DevToolsMessageObserver); 35 | }; 36 | 37 | #endif // JCEF_NATIVE_DEVTOOLS_MESSAGE_OBSERVER_H_ 38 | -------------------------------------------------------------------------------- /native/dialog_handler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef JCEF_NATIVE_DIALOG_HANDLER_H_ 6 | #define JCEF_NATIVE_DIALOG_HANDLER_H_ 7 | #pragma once 8 | 9 | #include 10 | #include "include/cef_dialog_handler.h" 11 | 12 | #include "jni_scoped_helpers.h" 13 | 14 | // DialogHandler implementation. 15 | class DialogHandler : public CefDialogHandler { 16 | public: 17 | DialogHandler(JNIEnv* env, jobject handler); 18 | 19 | // CefDialogHandler methods 20 | virtual bool OnFileDialog(CefRefPtr browser, 21 | FileDialogMode mode, 22 | const CefString& title, 23 | const CefString& default_file_path, 24 | const std::vector& accept_filters, 25 | const std::vector& accept_extensions, 26 | const std::vector& accept_descriptions, 27 | CefRefPtr callback) override; 28 | 29 | protected: 30 | ScopedJNIObjectGlobal handle_; 31 | 32 | // Include the default reference counting implementation. 33 | IMPLEMENT_REFCOUNTING(DialogHandler); 34 | }; 35 | 36 | #endif // JCEF_NATIVE_DIALOG_HANDLER_H_ 37 | -------------------------------------------------------------------------------- /native/download_handler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef JCEF_NATIVE_DOWNLOAD_HANDLER_H_ 6 | #define JCEF_NATIVE_DOWNLOAD_HANDLER_H_ 7 | #pragma once 8 | 9 | #include 10 | #include "include/cef_download_handler.h" 11 | 12 | #include "jni_scoped_helpers.h" 13 | 14 | // DownloadHandler implementation. 15 | class DownloadHandler : public CefDownloadHandler { 16 | public: 17 | DownloadHandler(JNIEnv* env, jobject handler); 18 | 19 | // CefDownloadHandler methods 20 | virtual bool OnBeforeDownload( 21 | CefRefPtr browser, 22 | CefRefPtr download_item, 23 | const CefString& suggested_name, 24 | CefRefPtr callback) override; 25 | 26 | virtual void OnDownloadUpdated( 27 | CefRefPtr browser, 28 | CefRefPtr download_item, 29 | CefRefPtr callback) override; 30 | 31 | protected: 32 | ScopedJNIObjectGlobal handle_; 33 | 34 | // Include the default reference counting implementation. 35 | IMPLEMENT_REFCOUNTING(DownloadHandler); 36 | }; 37 | 38 | #endif // JCEF_NATIVE_DOWNLOAD_HANDLER_H_ 39 | -------------------------------------------------------------------------------- /native/drag_handler.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #include "drag_handler.h" 6 | 7 | #include "jni_util.h" 8 | 9 | DragHandler::DragHandler(JNIEnv* env, jobject handler) 10 | : handle_(env, handler) {} 11 | 12 | bool DragHandler::OnDragEnter(CefRefPtr browser, 13 | CefRefPtr dragData, 14 | CefDragHandler::DragOperationsMask mask) { 15 | ScopedJNIEnv env; 16 | if (!env) 17 | return false; 18 | 19 | ScopedJNIBrowser jbrowser(env, browser); 20 | ScopedJNIDragData jdragData(env, dragData); 21 | jdragData.SetTemporary(); 22 | jboolean result = JNI_FALSE; 23 | 24 | JNI_CALL_METHOD( 25 | env, handle_, "onDragEnter", 26 | "(Lorg/cef/browser/CefBrowser;Lorg/cef/callback/CefDragData;I)Z", Boolean, 27 | result, jbrowser.get(), jdragData.get(), (jint)mask); 28 | 29 | return (result != JNI_FALSE); 30 | } 31 | -------------------------------------------------------------------------------- /native/drag_handler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef JCEF_NATIVE_DRAG_HANDLER_H_ 6 | #define JCEF_NATIVE_DRAG_HANDLER_H_ 7 | #pragma once 8 | 9 | #include 10 | 11 | #include "include/cef_drag_handler.h" 12 | 13 | #include "jni_scoped_helpers.h" 14 | 15 | // DragHandler implementation. 16 | class DragHandler : public CefDragHandler { 17 | public: 18 | DragHandler(JNIEnv* env, jobject handler); 19 | 20 | // CefDragHandler methods 21 | bool OnDragEnter(CefRefPtr browser, 22 | CefRefPtr dragData, 23 | CefDragHandler::DragOperationsMask mask) override; 24 | 25 | protected: 26 | ScopedJNIObjectGlobal handle_; 27 | 28 | // Include the default reference counting implementation. 29 | IMPLEMENT_REFCOUNTING(DragHandler); 30 | }; 31 | 32 | #endif // JCEF_NATIVE_DRAG_HANDLER_H_ 33 | -------------------------------------------------------------------------------- /native/focus_handler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef JCEF_NATIVE_FOCUS_HANDLER_H_ 6 | #define JCEF_NATIVE_FOCUS_HANDLER_H_ 7 | #pragma once 8 | 9 | #include 10 | 11 | #include "include/cef_focus_handler.h" 12 | 13 | #include "jni_scoped_helpers.h" 14 | 15 | // FocusHandler implementation. 16 | class FocusHandler : public CefFocusHandler { 17 | public: 18 | FocusHandler(JNIEnv* env, jobject handler); 19 | 20 | // CefFocusHandler methods 21 | virtual void OnTakeFocus(CefRefPtr browser, bool next) override; 22 | virtual bool OnSetFocus(CefRefPtr browser, 23 | FocusSource source) override; 24 | virtual void OnGotFocus(CefRefPtr browser) override; 25 | 26 | protected: 27 | ScopedJNIObjectGlobal handle_; 28 | 29 | // Include the default reference counting implementation. 30 | IMPLEMENT_REFCOUNTING(FocusHandler); 31 | }; 32 | 33 | #endif // JCEF_NATIVE_FOCUS_HANDLER_H_ 34 | -------------------------------------------------------------------------------- /native/int_callback.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #include "int_callback.h" 6 | 7 | #include "jni_scoped_helpers.h" 8 | #include "jni_util.h" 9 | #include "util.h" 10 | 11 | IntCallback::IntCallback(JNIEnv* env, jobject jcallback) 12 | : handle_(env, jcallback) {} 13 | 14 | void IntCallback::onComplete(int value) { 15 | ScopedJNIEnv env; 16 | if (!env) 17 | return; 18 | 19 | JNI_CALL_VOID_METHOD(env, handle_, "onComplete", "(I)V", (jint)value); 20 | } 21 | -------------------------------------------------------------------------------- /native/int_callback.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef JCEF_NATIVE_INT_CALLBACK_H_ 6 | #define JCEF_NATIVE_INT_CALLBACK_H_ 7 | #pragma once 8 | 9 | #include 10 | 11 | #include "jni_scoped_helpers.h" 12 | 13 | // Callback for returning int primatives. The methods of 14 | // this class will be called on the browser process UI thread. 15 | class IntCallback : public virtual CefBaseRefCounted { 16 | public: 17 | IntCallback(JNIEnv* env, jobject jcallback); 18 | 19 | virtual void onComplete(int value); 20 | 21 | protected: 22 | ScopedJNIObjectGlobal handle_; 23 | 24 | // Include the default reference counting implementation. 25 | IMPLEMENT_REFCOUNTING(IntCallback); 26 | }; 27 | 28 | #endif // JCEF_NATIVE_INT_CALLBACK_H_ 29 | -------------------------------------------------------------------------------- /native/jcef.dll.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /native/jcef_helper.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /native/jni_util_linux.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #include "jni_util.h" 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | unsigned long GetDrawableOfCanvas(jobject canvas, JNIEnv* env) { 12 | JAWT awt; 13 | JAWT_DrawingSurface* ds; 14 | JAWT_DrawingSurfaceInfo* dsi; 15 | JAWT_X11DrawingSurfaceInfo* dsi_x11; 16 | jint lock; 17 | 18 | // Get the AWT. 19 | awt.version = JAWT_VERSION_1_4; 20 | JAWT_GetAWT(env, &awt); 21 | 22 | // Get the drawing surface. 23 | ds = awt.GetDrawingSurface(env, canvas); 24 | assert(ds != nullptr); 25 | 26 | // Lock the drawing surface. 27 | // May fail during shutdown. 28 | lock = ds->Lock(ds); 29 | if (lock & JAWT_LOCK_ERROR) { 30 | return 0; 31 | } 32 | 33 | // Get the drawing surface info. 34 | dsi = ds->GetDrawingSurfaceInfo(ds); 35 | if (dsi == nullptr) { 36 | // Unlock the drawing surface 37 | ds->Unlock(ds); 38 | return 0; 39 | } 40 | 41 | // Get the platform-specific drawing info. 42 | dsi_x11 = (JAWT_X11DrawingSurfaceInfo*)dsi->platformInfo; 43 | Drawable result = dsi_x11->drawable; 44 | 45 | // Free the drawing surface info 46 | ds->FreeDrawingSurfaceInfo(dsi); 47 | // Unlock the drawing surface 48 | ds->Unlock(ds); 49 | // Free the drawing surface 50 | awt.FreeDrawingSurface(ds); 51 | 52 | return result; 53 | } 54 | -------------------------------------------------------------------------------- /native/jni_util_win.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #include "jni_util.h" 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | HWND GetHwndOfCanvas(jobject canvas, JNIEnv* env) { 12 | JAWT awt; 13 | JAWT_DrawingSurface* ds; 14 | JAWT_DrawingSurfaceInfo* dsi; 15 | JAWT_Win32DrawingSurfaceInfo* dsi_win; 16 | jboolean bGetAwt; 17 | jint lock; 18 | 19 | // Get the AWT. 20 | awt.version = JAWT_VERSION_1_4; 21 | bGetAwt = JAWT_GetAWT(env, &awt); 22 | assert(bGetAwt != JNI_FALSE); 23 | 24 | // Get the drawing surface. 25 | ds = awt.GetDrawingSurface(env, canvas); 26 | assert(ds != nullptr); 27 | 28 | // Lock the drawing surface. 29 | // May fail during shutdown. 30 | lock = ds->Lock(ds); 31 | if (lock & JAWT_LOCK_ERROR) { 32 | return 0; 33 | } 34 | 35 | // Get the drawing surface info. 36 | dsi = ds->GetDrawingSurfaceInfo(ds); 37 | if (dsi == nullptr) { 38 | // Unlock the drawing surface 39 | ds->Unlock(ds); 40 | return 0; 41 | } 42 | 43 | // Get the platform-specific drawing info. 44 | dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo; 45 | HWND result = dsi_win->hwnd; 46 | 47 | // Free the drawing surface info 48 | ds->FreeDrawingSurfaceInfo(dsi); 49 | // Unlock the drawing surface 50 | ds->Unlock(ds); 51 | // Free the drawing surface 52 | awt.FreeDrawingSurface(ds); 53 | 54 | return result; 55 | } 56 | -------------------------------------------------------------------------------- /native/jsdialog_handler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef JCEF_NATIVE_JSDIALOG_HANDLER_H_ 6 | #define JCEF_NATIVE_JSDIALOG_HANDLER_H_ 7 | #pragma once 8 | 9 | #include 10 | #include "include/cef_jsdialog_handler.h" 11 | 12 | #include "jni_scoped_helpers.h" 13 | 14 | // JSDialogHandler implementation. 15 | class JSDialogHandler : public CefJSDialogHandler { 16 | public: 17 | JSDialogHandler(JNIEnv* env, jobject handler); 18 | 19 | // CefJSDialogHandler methods 20 | virtual bool OnJSDialog(CefRefPtr browser, 21 | const CefString& origin_url, 22 | JSDialogType dialog_type, 23 | const CefString& message_text, 24 | const CefString& default_prompt_text, 25 | CefRefPtr callback, 26 | bool& suppress_message) override; 27 | 28 | virtual bool OnBeforeUnloadDialog( 29 | CefRefPtr browser, 30 | const CefString& message_text, 31 | bool is_reload, 32 | CefRefPtr callback) override; 33 | 34 | virtual void OnResetDialogState(CefRefPtr browser) override; 35 | virtual void OnDialogClosed(CefRefPtr browser) override; 36 | 37 | protected: 38 | ScopedJNIObjectGlobal handle_; 39 | 40 | // Include the default reference counting implementation. 41 | IMPLEMENT_REFCOUNTING(JSDialogHandler); 42 | }; 43 | 44 | #endif // JCEF_NATIVE_JSDIALOG_HANDLER_H_ 45 | -------------------------------------------------------------------------------- /native/keyboard_handler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef JCEF_NATIVE_KEYBOARD_HANDLER_H_ 6 | #define JCEF_NATIVE_KEYBOARD_HANDLER_H_ 7 | #pragma once 8 | 9 | #include 10 | 11 | #include "include/cef_keyboard_handler.h" 12 | 13 | #include "jni_scoped_helpers.h" 14 | 15 | // KeyboardHandler implementation. 16 | class KeyboardHandler : public CefKeyboardHandler { 17 | public: 18 | KeyboardHandler(JNIEnv* env, jobject handler); 19 | 20 | // CefKeyboardHandler methods 21 | virtual bool OnPreKeyEvent(CefRefPtr browser, 22 | const CefKeyEvent& event, 23 | CefEventHandle os_event, 24 | bool* is_keyboard_shortcut) override; 25 | 26 | virtual bool OnKeyEvent(CefRefPtr browser, 27 | const CefKeyEvent& event, 28 | CefEventHandle os_event) override; 29 | 30 | protected: 31 | ScopedJNIObjectGlobal handle_; 32 | 33 | // Include the default reference counting implementation. 34 | IMPLEMENT_REFCOUNTING(KeyboardHandler); 35 | }; 36 | 37 | #endif // JCEF_NATIVE_KEYBOARD_HANDLER_H_ 38 | -------------------------------------------------------------------------------- /native/load_handler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef JCEF_NATIVE_LOAD_HANDLER_H_ 6 | #define JCEF_NATIVE_LOAD_HANDLER_H_ 7 | #pragma once 8 | 9 | #include 10 | 11 | #include "include/cef_load_handler.h" 12 | 13 | #include "jni_scoped_helpers.h" 14 | 15 | // LoadHandler implementation. 16 | class LoadHandler : public CefLoadHandler { 17 | public: 18 | LoadHandler(JNIEnv* env, jobject handler); 19 | 20 | // CefLoadHandler methods 21 | void OnLoadingStateChange(CefRefPtr browser, 22 | bool isLoading, 23 | bool canGoBack, 24 | bool canGoForward) override; 25 | void OnLoadStart(CefRefPtr browser, 26 | CefRefPtr frame, 27 | TransitionType transition_type) override; 28 | void OnLoadEnd(CefRefPtr browser, 29 | CefRefPtr frame, 30 | int httpStatusCode) override; 31 | void OnLoadError(CefRefPtr browser, 32 | CefRefPtr frame, 33 | ErrorCode errorCode, 34 | const CefString& errorText, 35 | const CefString& failedUrl) override; 36 | 37 | protected: 38 | ScopedJNIObjectGlobal handle_; 39 | 40 | // Include the default reference counting implementation. 41 | IMPLEMENT_REFCOUNTING(LoadHandler); 42 | }; 43 | 44 | #endif // JCEF_NATIVE_LOAD_HANDLER_H_ 45 | -------------------------------------------------------------------------------- /native/message_router_handler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef JCEF_NATIVE_MESSAGE_ROUTER_HANDLER_H_ 6 | #define JCEF_NATIVE_MESSAGE_ROUTER_HANDLER_H_ 7 | #pragma once 8 | 9 | #include 10 | 11 | #include "include/wrapper/cef_message_router.h" 12 | 13 | #include "jni_scoped_helpers.h" 14 | 15 | // MessageRouterHandler implementation. 16 | class MessageRouterHandler : public CefMessageRouterBrowserSide::Handler, 17 | public CefBaseRefCounted { 18 | public: 19 | MessageRouterHandler(JNIEnv* env, jobject handler); 20 | 21 | // CefMessageRouterHandler methods 22 | virtual bool OnQuery(CefRefPtr browser, 23 | CefRefPtr frame, 24 | int64_t query_id, 25 | const CefString& request, 26 | bool persistent, 27 | CefRefPtr callback) override; 28 | virtual void OnQueryCanceled(CefRefPtr browser, 29 | CefRefPtr frame, 30 | int64_t query_id) override; 31 | 32 | protected: 33 | ScopedJNIObjectGlobal handle_; 34 | 35 | // Include the default reference counting implementation. 36 | IMPLEMENT_REFCOUNTING(MessageRouterHandler); 37 | }; 38 | 39 | #endif // JCEF_NATIVE_MESSAGE_ROUTER_HANDLER_H_ 40 | -------------------------------------------------------------------------------- /native/pdf_print_callback.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #include "pdf_print_callback.h" 6 | 7 | #include "jni_scoped_helpers.h" 8 | #include "jni_util.h" 9 | #include "util.h" 10 | 11 | PdfPrintCallback::PdfPrintCallback(JNIEnv* env, jobject jcallback) 12 | : handle_(env, jcallback) {} 13 | 14 | void PdfPrintCallback::OnPdfPrintFinished(const CefString& path, bool ok) { 15 | ScopedJNIEnv env; 16 | if (!env) 17 | return; 18 | 19 | ScopedJNIString jpath(env, path); 20 | JNI_CALL_VOID_METHOD(env, handle_, "onPdfPrintFinished", 21 | "(Ljava/lang/String;Z)V", jpath.get(), (jboolean)ok); 22 | } 23 | -------------------------------------------------------------------------------- /native/pdf_print_callback.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef JCEF_NATIVE_PDF_PRINT_CALLBACK_H_ 6 | #define JCEF_NATIVE_PDF_PRINT_CALLBACK_H_ 7 | #pragma once 8 | 9 | #include 10 | 11 | #include "include/cef_browser.h" 12 | 13 | #include "jni_scoped_helpers.h" 14 | 15 | // PdfPrintCallback implementation. 16 | class PdfPrintCallback : public CefPdfPrintCallback { 17 | public: 18 | PdfPrintCallback(JNIEnv* env, jobject jcallback); 19 | 20 | // PdfPrintCallback methods 21 | virtual void OnPdfPrintFinished(const CefString& path, bool ok) override; 22 | 23 | protected: 24 | ScopedJNIObjectGlobal handle_; 25 | 26 | // Include the default reference counting implementation. 27 | IMPLEMENT_REFCOUNTING(PdfPrintCallback); 28 | }; 29 | 30 | #endif // JCEF_NATIVE_PDF_PRINT_CALLBACK_H_ 31 | -------------------------------------------------------------------------------- /native/request_context_handler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef JCEF_NATIVE_STRING_VISITOR_H_ 6 | #define JCEF_NATIVE_STRING_VISITOR_H_ 7 | #pragma once 8 | 9 | #include 10 | #include "include/cef_request_context_handler.h" 11 | 12 | #include "jni_scoped_helpers.h" 13 | 14 | // RequestContextHandler implementation. 15 | class RequestContextHandler : public CefRequestContextHandler { 16 | public: 17 | RequestContextHandler(JNIEnv* env, jobject jhandler); 18 | 19 | // RequestContextHandler methods 20 | CefRefPtr GetResourceRequestHandler( 21 | CefRefPtr browser, 22 | CefRefPtr frame, 23 | CefRefPtr request, 24 | bool is_navigation, 25 | bool is_download, 26 | const CefString& request_initiator, 27 | bool& disable_default_handling) override; 28 | 29 | protected: 30 | ScopedJNIObjectGlobal handle_; 31 | 32 | // Include the default reference counting implementation. 33 | IMPLEMENT_REFCOUNTING(RequestContextHandler); 34 | }; 35 | 36 | #endif // JCEF_NATIVE_STRING_VISITOR_H_ 37 | -------------------------------------------------------------------------------- /native/resource_handler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef JCEF_NATIVE_RESOURCE_HANDLER_H_ 6 | #define JCEF_NATIVE_RESOURCE_HANDLER_H_ 7 | #pragma once 8 | 9 | #include 10 | 11 | #include "include/cef_resource_handler.h" 12 | 13 | #include "jni_scoped_helpers.h" 14 | 15 | // ResourceHandler implementation. 16 | class ResourceHandler : public CefResourceHandler { 17 | public: 18 | ResourceHandler(JNIEnv* env, jobject handler); 19 | 20 | // CefResourceHandler methods: 21 | bool ProcessRequest(CefRefPtr request, 22 | CefRefPtr callback) override; 23 | void GetResponseHeaders(CefRefPtr response, 24 | int64_t& response_length, 25 | CefString& redirectUrl) override; 26 | bool ReadResponse(void* data_out, 27 | int bytes_to_read, 28 | int& bytes_read, 29 | CefRefPtr callback) override; 30 | void Cancel() override; 31 | 32 | protected: 33 | ScopedJNIObjectGlobal handle_; 34 | 35 | // Include the default reference counting implementation. 36 | IMPLEMENT_REFCOUNTING(ResourceHandler); 37 | }; 38 | 39 | #endif // JCEF_NATIVE_RESOURCE_HANDLER_H_ 40 | -------------------------------------------------------------------------------- /native/resources/jcef-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${EXECUTABLE_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | org.jcef.jcef.helper${BUNDLE_ID_SUFFIX} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleSignature 20 | ???? 21 | LSEnvironment 22 | 23 | MallocNanoZone 24 | 0 25 | 26 | LSFileQuarantineEnabled 27 | 28 | LSMinimumSystemVersion 29 | 10.11.0 30 | LSUIElement 31 | 1 32 | NSSupportsAutomaticGraphicsSwitching 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /native/run_file_dialog_callback.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #include "run_file_dialog_callback.h" 6 | 7 | #include "jni_scoped_helpers.h" 8 | #include "jni_util.h" 9 | #include "util.h" 10 | 11 | RunFileDialogCallback::RunFileDialogCallback(JNIEnv* env, jobject jcallback) 12 | : handle_(env, jcallback) {} 13 | 14 | void RunFileDialogCallback::OnFileDialogDismissed( 15 | const std::vector& file_paths) { 16 | ScopedJNIEnv env; 17 | if (!env) 18 | return; 19 | 20 | ScopedJNIObjectLocal jfilePaths(env, NewJNIStringVector(env, file_paths)); 21 | JNI_CALL_VOID_METHOD(env, handle_, "onFileDialogDismissed", 22 | "(Ljava/util/Vector;)V", jfilePaths.get()); 23 | } 24 | -------------------------------------------------------------------------------- /native/run_file_dialog_callback.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef JCEF_NATIVE_RUN_FILE_DIALOG_CALLBACK_H_ 6 | #define JCEF_NATIVE_RUN_FILE_DIALOG_CALLBACK_H_ 7 | #pragma once 8 | 9 | #include 10 | 11 | #include "include/cef_browser.h" 12 | 13 | #include "jni_scoped_helpers.h" 14 | 15 | // RunFileDialogCallback implementation. 16 | class RunFileDialogCallback : public CefRunFileDialogCallback { 17 | public: 18 | RunFileDialogCallback(JNIEnv* env, jobject jcallback); 19 | 20 | // RunFileDialogCallback methods 21 | virtual void OnFileDialogDismissed( 22 | const std::vector& file_paths) override; 23 | 24 | protected: 25 | ScopedJNIObjectGlobal handle_; 26 | 27 | // Include the default reference counting implementation. 28 | IMPLEMENT_REFCOUNTING(RunFileDialogCallback); 29 | }; 30 | 31 | #endif // JCEF_NATIVE_RUN_FILE_DIALOG_CALLBACK_H_ 32 | -------------------------------------------------------------------------------- /native/scheme_handler_factory.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #include "scheme_handler_factory.h" 6 | 7 | #include "jni_util.h" 8 | #include "resource_handler.h" 9 | 10 | SchemeHandlerFactory::SchemeHandlerFactory(JNIEnv* env, jobject jfactory) 11 | : handle_(env, jfactory) {} 12 | 13 | CefRefPtr SchemeHandlerFactory::Create( 14 | CefRefPtr browser, 15 | CefRefPtr frame, 16 | const CefString& scheme_name, 17 | CefRefPtr request) { 18 | ScopedJNIEnv env; 19 | if (!env) 20 | return nullptr; 21 | 22 | ScopedJNIBrowser jbrowser(env, browser); 23 | ScopedJNIFrame jframe(env, frame); 24 | jframe.SetTemporary(); 25 | ScopedJNIString jschemeName(env, scheme_name); 26 | ScopedJNIRequest jrequest(env, request); 27 | jrequest.SetTemporary(); 28 | ScopedJNIObjectResult jresult(env); 29 | 30 | JNI_CALL_METHOD(env, handle_, "create", 31 | "(Lorg/cef/browser/CefBrowser;Lorg/cef/browser/" 32 | "CefFrame;Ljava/lang/String;Lorg/cef/" 33 | "network/CefRequest;)Lorg/cef/handler/CefResourceHandler;", 34 | Object, jresult, jbrowser.get(), jframe.get(), 35 | jschemeName.get(), jrequest.get()); 36 | 37 | if (jresult) 38 | return new ResourceHandler(env, jresult); 39 | return nullptr; 40 | } 41 | -------------------------------------------------------------------------------- /native/scheme_handler_factory.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef JCEF_NATIVE_SCHEME_HANDLER_FACTORY_H_ 6 | #define JCEF_NATIVE_SCHEME_HANDLER_FACTORY_H_ 7 | #pragma once 8 | 9 | #include 10 | 11 | #include "include/cef_scheme.h" 12 | 13 | #include "jni_scoped_helpers.h" 14 | 15 | // StringVisitor implementation. 16 | class SchemeHandlerFactory : public CefSchemeHandlerFactory { 17 | public: 18 | SchemeHandlerFactory(JNIEnv* env, jobject jfactory); 19 | 20 | // CefSchemeHandlerFactory methods 21 | CefRefPtr Create(CefRefPtr browser, 22 | CefRefPtr frame, 23 | const CefString& scheme_name, 24 | CefRefPtr request) override; 25 | 26 | protected: 27 | ScopedJNIObjectGlobal handle_; 28 | 29 | // Include the default reference counting implementation. 30 | IMPLEMENT_REFCOUNTING(SchemeHandlerFactory); 31 | }; 32 | 33 | #endif // JCEF_NATIVE_SCHEME_HANDLER_FACTORY_H_ 34 | -------------------------------------------------------------------------------- /native/string_visitor.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #include "string_visitor.h" 6 | 7 | #include "jni_scoped_helpers.h" 8 | #include "jni_util.h" 9 | #include "util.h" 10 | 11 | StringVisitor::StringVisitor(JNIEnv* env, jobject jvisitor) 12 | : handle_(env, jvisitor) {} 13 | 14 | void StringVisitor::Visit(const CefString& string) { 15 | ScopedJNIEnv env; 16 | if (!env) 17 | return; 18 | 19 | ScopedJNIString jstring(env, string); 20 | JNI_CALL_VOID_METHOD(env, handle_, "visit", "(Ljava/lang/String;)V", 21 | jstring.get()); 22 | } 23 | -------------------------------------------------------------------------------- /native/string_visitor.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef JCEF_NATIVE_STRING_VISITOR_H_ 6 | #define JCEF_NATIVE_STRING_VISITOR_H_ 7 | #pragma once 8 | 9 | #include 10 | 11 | #include "include/cef_string_visitor.h" 12 | 13 | #include "jni_scoped_helpers.h" 14 | 15 | // StringVisitor implementation. 16 | class StringVisitor : public CefStringVisitor { 17 | public: 18 | StringVisitor(JNIEnv* env, jobject jvisitor); 19 | 20 | // StringVisitor methods 21 | virtual void Visit(const CefString& string) override; 22 | 23 | protected: 24 | ScopedJNIObjectGlobal handle_; 25 | 26 | // Include the default reference counting implementation. 27 | IMPLEMENT_REFCOUNTING(StringVisitor); 28 | }; 29 | 30 | #endif // JCEF_NATIVE_STRING_VISITOR_H_ 31 | -------------------------------------------------------------------------------- /native/temp_window.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef JCEF_NATIVE_TEMP_WINDOW_H_ 6 | #define JCEF_NATIVE_TEMP_WINDOW_H_ 7 | #pragma once 8 | 9 | #if defined(OS_WIN) 10 | #include "temp_window_win.h" 11 | #elif defined(OS_LINUX) 12 | #include "temp_window_x11.h" 13 | #elif defined(OS_MACOSX) 14 | #include "temp_window_mac.h" 15 | #endif 16 | 17 | #if defined(OS_WIN) 18 | typedef TempWindowWin TempWindow; 19 | #elif defined(OS_LINUX) 20 | typedef TempWindowX11 TempWindow; 21 | #elif defined(OS_MACOSX) 22 | typedef TempWindowMac TempWindow; 23 | #endif 24 | 25 | #endif // JCEF_NATIVE_TEMP_WINDOW_H_ 26 | -------------------------------------------------------------------------------- /native/temp_window_mac.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef JCEF_NATIVE_TEMP_WINDOW_MAC_H_ 6 | #define JCEF_NATIVE_TEMP_WINDOW_MAC_H_ 7 | #pragma once 8 | 9 | #include "include/cef_base.h" 10 | 11 | #ifdef __OBJC__ 12 | @class NSWindow; 13 | #else 14 | class NSWindow; 15 | #endif 16 | 17 | // Represents a singleton hidden window that acts as a temporary parent for 18 | // popup browsers. 19 | class TempWindowMac { 20 | public: 21 | // Returns the singleton window handle. 22 | static CefWindowHandle GetWindowHandle(); 23 | 24 | static NSWindow* GetWindow(); 25 | 26 | private: 27 | // A single instance will be created/owned by Context. 28 | friend class Context; 29 | // Allow deletion via std::unique_ptr only. 30 | friend std::default_delete; 31 | 32 | TempWindowMac(); 33 | ~TempWindowMac(); 34 | 35 | NSWindow* window_; 36 | 37 | DISALLOW_COPY_AND_ASSIGN(TempWindowMac); 38 | }; 39 | 40 | #endif // JCEF_NATIVE_TEMP_WINDOW_MAC_H_ 41 | -------------------------------------------------------------------------------- /native/temp_window_mac.mm: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #include "temp_window_mac.h" 6 | 7 | #include 8 | 9 | #include "include/base/cef_logging.h" 10 | #include "include/cef_app.h" 11 | 12 | namespace { 13 | 14 | TempWindowMac* g_temp_window = nullptr; 15 | 16 | } // namespace 17 | 18 | TempWindowMac::TempWindowMac() : window_(nil) { 19 | DCHECK(!g_temp_window); 20 | g_temp_window = this; 21 | 22 | // Create a borderless non-visible 1x1 window. 23 | window_ = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 1, 1) 24 | styleMask:NSWindowStyleMaskBorderless 25 | backing:NSBackingStoreBuffered 26 | defer:NO]; 27 | CHECK(window_); 28 | } 29 | 30 | TempWindowMac::~TempWindowMac() { 31 | g_temp_window = nullptr; 32 | DCHECK(window_); 33 | 34 | [window_ close]; 35 | } 36 | 37 | // static 38 | CefWindowHandle TempWindowMac::GetWindowHandle() { 39 | DCHECK(g_temp_window); 40 | return [g_temp_window->window_ contentView]; 41 | } 42 | 43 | // static 44 | NSWindow* TempWindowMac::GetWindow() { 45 | DCHECK(g_temp_window); 46 | return g_temp_window->window_; 47 | } 48 | -------------------------------------------------------------------------------- /native/temp_window_win.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #include "temp_window_win.h" 6 | 7 | #include 8 | 9 | #include "include/base/cef_logging.h" 10 | 11 | namespace { 12 | 13 | const wchar_t kWndClass[] = L"Client_TempWindow"; 14 | 15 | // Create the temp window. 16 | HWND CreateTempWindow() { 17 | HINSTANCE hInstance = ::GetModuleHandle(nullptr); 18 | 19 | WNDCLASSEX wc = {0}; 20 | wc.cbSize = sizeof(wc); 21 | wc.lpfnWndProc = DefWindowProc; 22 | wc.hInstance = hInstance; 23 | wc.lpszClassName = kWndClass; 24 | RegisterClassEx(&wc); 25 | 26 | // Create a 1x1 pixel hidden window. 27 | return CreateWindow(kWndClass, 0, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, 0, 0, 28 | 1, 1, nullptr, nullptr, hInstance, nullptr); 29 | } 30 | 31 | TempWindowWin* g_temp_window = nullptr; 32 | 33 | } // namespace 34 | 35 | TempWindowWin::TempWindowWin() : hwnd_(nullptr) { 36 | DCHECK(!g_temp_window); 37 | g_temp_window = this; 38 | 39 | hwnd_ = CreateTempWindow(); 40 | CHECK(hwnd_); 41 | } 42 | 43 | TempWindowWin::~TempWindowWin() { 44 | g_temp_window = nullptr; 45 | DCHECK(hwnd_); 46 | DestroyWindow(hwnd_); 47 | } 48 | 49 | // static 50 | CefWindowHandle TempWindowWin::GetWindowHandle() { 51 | if (!g_temp_window) 52 | return kNullWindowHandle; 53 | return g_temp_window->hwnd_; 54 | } 55 | -------------------------------------------------------------------------------- /native/temp_window_win.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef JCEF_NATIVE_TEMP_WINDOW_WIN_H_ 6 | #define JCEF_NATIVE_TEMP_WINDOW_WIN_H_ 7 | #pragma once 8 | 9 | #include "include/cef_base.h" 10 | 11 | // Represents a singleton hidden window that acts as a temporary parent for 12 | // popup browsers. 13 | class TempWindowWin { 14 | public: 15 | // Returns the singleton window handle. 16 | static CefWindowHandle GetWindowHandle(); 17 | 18 | private: 19 | // A single instance will be created/owned by Context. 20 | friend class Context; 21 | // Allow deletion via std::unique_ptr only. 22 | friend std::default_delete; 23 | 24 | TempWindowWin(); 25 | ~TempWindowWin(); 26 | 27 | CefWindowHandle hwnd_; 28 | 29 | DISALLOW_COPY_AND_ASSIGN(TempWindowWin); 30 | }; 31 | 32 | #endif // JCEF_NATIVE_TEMP_WINDOW_WIN_H_ 33 | -------------------------------------------------------------------------------- /native/temp_window_x11.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef JCEF_NATIVE_TEMP_WINDOW_X11_H_ 6 | #define JCEF_NATIVE_TEMP_WINDOW_X11_H_ 7 | #pragma once 8 | 9 | #include "include/cef_base.h" 10 | 11 | // Represents a singleton hidden window that acts as a temporary parent for 12 | // popup browsers. 13 | class TempWindowX11 { 14 | public: 15 | // Returns the singleton window handle. 16 | static CefWindowHandle GetWindowHandle(); 17 | 18 | static void* GetDisplay(); 19 | 20 | private: 21 | // A single instance will be created/owned by Context. 22 | friend class Context; 23 | // Allow deletion via std::unique_ptr only. 24 | friend std::default_delete; 25 | 26 | TempWindowX11(); 27 | ~TempWindowX11(); 28 | 29 | CefWindowHandle xwindow_; 30 | 31 | DISALLOW_COPY_AND_ASSIGN(TempWindowX11); 32 | }; 33 | 34 | #endif // JCEF_NATIVE_TEMP_WINDOW_X11_H_ 35 | -------------------------------------------------------------------------------- /native/util_mac.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef JCEF_NATIVE_UTIL_MAC_H_ 6 | #define JCEF_NATIVE_UTIL_MAC_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include "include/cef_app.h" 12 | #include "include/cef_base.h" 13 | 14 | #include "client_app.h" 15 | 16 | #ifdef __OBJC__ 17 | @class NSView; 18 | @class NSWindow; 19 | #else 20 | struct NSView; 21 | class NSWindow; 22 | #endif // __OBJC__ 23 | 24 | namespace util_mac { 25 | 26 | // Converts a relative path to an absolute path. 27 | std::string GetAbsPath(const std::string& path); 28 | 29 | // Returns true if |ptr| is an NSView instance. 30 | bool IsNSView(void* ptr); 31 | 32 | CefWindowHandle CreateBrowserContentView(NSWindow* window, CefRect& orig); 33 | void TranslateRect(CefWindowHandle view, CefRect& orig); 34 | 35 | bool CefInitializeOnMainThread(const CefMainArgs& args, 36 | const CefSettings& settings, 37 | CefRefPtr application); 38 | 39 | void CefShutdownOnMainThread(); 40 | 41 | void CefDoMessageLoopWorkOnMainThread(); 42 | 43 | void SetVisibility(CefWindowHandle handle, bool isVisible); 44 | 45 | void UpdateView(CefWindowHandle handle, 46 | CefRect contentRect, 47 | CefRect browserRect); 48 | 49 | } // namespace util_mac 50 | 51 | #endif // JCEF_NATIVE_UTIL_MAC_H_ 52 | -------------------------------------------------------------------------------- /native/util_posix.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #include "util.h" 6 | 7 | #include 8 | #include 9 | 10 | #include "include/cef_path_util.h" 11 | 12 | namespace util { 13 | 14 | int GetPid() { 15 | return getpid(); 16 | } 17 | 18 | int GetParentPid() { 19 | return getppid(); 20 | } 21 | 22 | std::string GetTempFileName(const std::string& identifer, bool useParentId) { 23 | std::stringstream tmpName; 24 | CefString tmpPath; 25 | if (!CefGetPath(PK_DIR_TEMP, tmpPath)) 26 | tmpPath = "/tmp/"; 27 | tmpName << tmpPath.ToString().c_str(); 28 | tmpName << "jcef-p" << (useParentId ? util::GetParentPid() : util::GetPid()); 29 | tmpName << (identifer.empty() ? "" : "_") << identifer.c_str() << ".tmp"; 30 | return tmpName.str(); 31 | } 32 | 33 | } // namespace util 34 | -------------------------------------------------------------------------------- /native/window_handler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef JCEF_NATIVE_WINDOW_HANDLER_H_ 6 | #define JCEF_NATIVE_WINDOW_HANDLER_H_ 7 | #pragma once 8 | 9 | #include 10 | 11 | #include "include/cef_base.h" 12 | #include "include/cef_browser.h" 13 | 14 | #include "jni_scoped_helpers.h" 15 | 16 | // WindowHandler implementation. 17 | class WindowHandler : public CefBaseRefCounted { 18 | public: 19 | WindowHandler(JNIEnv* env, jobject handler); 20 | 21 | // WindowHandler methods 22 | bool GetRect(CefRefPtr browser, CefRect& rect); 23 | bool GetRect(jobject browser, CefRect& rect); 24 | void OnMouseEvent(CefRefPtr browser, 25 | int mouseEvent, 26 | int absX, 27 | int absY, 28 | int modifier, 29 | int button); 30 | 31 | protected: 32 | ScopedJNIObjectGlobal handle_; 33 | 34 | // Include the default reference counting implementation. 35 | IMPLEMENT_REFCOUNTING(WindowHandler); 36 | }; 37 | 38 | #endif // JCEF_NATIVE_WINDOW_HANDLER_H_ 39 | -------------------------------------------------------------------------------- /native/write_handler.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #include "write_handler.h" 6 | 7 | #include "jni_util.h" 8 | #include "util.h" 9 | 10 | WriteHandler::WriteHandler(JNIEnv* env, jobject jOutputStream) 11 | : handle_(env, jOutputStream) {} 12 | 13 | WriteHandler::~WriteHandler() { 14 | ScopedJNIEnv env; 15 | if (!env) 16 | return; 17 | 18 | if (handle_) { 19 | JNI_CALL_VOID_METHOD(env, handle_, "close", "()V"); 20 | } 21 | } 22 | 23 | size_t WriteHandler::Write(const void* ptr, size_t size, size_t n) { 24 | base::AutoLock lock_scope(lock_); 25 | size_t rv = n; 26 | 27 | ScopedJNIEnv env; 28 | if (!env) 29 | return rv; 30 | 31 | jbyteArray jbyteArray = env->NewByteArray((jsize)(size * n)); 32 | env->SetByteArrayRegion(jbyteArray, 0, (jsize)(size * n), (const jbyte*)ptr); 33 | 34 | JNI_CALL_VOID_METHOD_EX(env, handle_, "write", "([B)V", jbyteArray); 35 | if (env->ExceptionOccurred()) { 36 | env->ExceptionClear(); 37 | rv = 0; 38 | } 39 | offset_ += (rv * size); 40 | env->DeleteLocalRef(jbyteArray); 41 | 42 | return rv; 43 | } 44 | 45 | int WriteHandler::Seek(int64_t offset, int whence) { 46 | // not supported by Javas OutputStream 47 | return -1; 48 | } 49 | 50 | int64_t WriteHandler::Tell() { 51 | return offset_; 52 | } 53 | 54 | int WriteHandler::Flush() { 55 | ScopedJNIEnv env; 56 | if (env) { 57 | JNI_CALL_VOID_METHOD(env, handle_, "flush", "()V"); 58 | } 59 | return 0; 60 | } 61 | 62 | bool WriteHandler::MayBlock() { 63 | return false; 64 | } 65 | -------------------------------------------------------------------------------- /native/write_handler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef JCEF_NATIVE_WRITE_HANDLER_H_ 6 | #define JCEF_NATIVE_WRITE_HANDLER_H_ 7 | #pragma once 8 | 9 | #include 10 | 11 | #include "include/base/cef_lock.h" 12 | #include "include/cef_stream.h" 13 | 14 | #include "jni_scoped_helpers.h" 15 | 16 | // WriteHandler implementation. 17 | class WriteHandler : public CefWriteHandler { 18 | public: 19 | WriteHandler(JNIEnv* env, jobject jOutputStream); 20 | virtual ~WriteHandler(); 21 | 22 | // CefWriteHandler methods 23 | virtual size_t Write(const void* ptr, size_t size, size_t n) override; 24 | virtual int Seek(int64_t offset, int whence) override; 25 | virtual int64_t Tell() override; 26 | virtual int Flush() override; 27 | virtual bool MayBlock() override; 28 | 29 | protected: 30 | ScopedJNIObjectGlobal handle_; 31 | size_t offset_ = 0; 32 | 33 | base::Lock lock_; 34 | 35 | // Include the default reference counting implementation. 36 | IMPLEMENT_REFCOUNTING(WriteHandler); 37 | }; 38 | 39 | #endif // JCEF_NATIVE_WRITE_HANDLER_H_ 40 | -------------------------------------------------------------------------------- /third_party/appbundler/README.jcef: -------------------------------------------------------------------------------- 1 | Name: Java Application Bundler 2 | Short Name: appbundler 3 | URL: https://github.com/TheInfiniteKind/appbundler/ 4 | Version: 1.0 (commit ad6782ea) 5 | License: GPL-2.0 6 | 7 | Description: 8 | Packages a Java application as Mac app bundle. 9 | 10 | See the project URL for related documentation. 11 | 12 | Local Modifications: 13 | 1. Clone the repo using Git. 14 | 2. Apply the Apple Silicon support patch from 15 | https://github.com/TheInfiniteKind/appbundler/issues/75 16 | 3. Run `ant` from the top-level directory. 17 | 4. Copy the resulting /appbundler/bin/appbundler-1.0ea.jar file to this directory. 18 | -------------------------------------------------------------------------------- /third_party/appbundler/appbundler-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chromiumembedded/java-cef/ca49ada5c7e3fc98cd7058b6253b59f967530a65/third_party/appbundler/appbundler-1.0.jar -------------------------------------------------------------------------------- /third_party/cef/README.jcef: -------------------------------------------------------------------------------- 1 | Name: Chromium Embedded Framework 2 | Short Name: cef 3 | URL: https://bitbucket.org/chromiumembedded/cef 4 | License: BSD 5 | 6 | Description: 7 | CEF binary distribution. Downloaded during CMake configuration. 8 | See the top-level CMakeLists.txt file for usage. 9 | 10 | Local Modifications: 11 | None. 12 | -------------------------------------------------------------------------------- /third_party/cef/res/CefIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chromiumembedded/java-cef/ca49ada5c7e3fc98cd7058b6253b59f967530a65/third_party/cef/res/CefIcon.icns -------------------------------------------------------------------------------- /third_party/jogamp/README.jcef: -------------------------------------------------------------------------------- 1 | Name: Java™ libraries for 3D Graphics, Multimedia and Processing 2 | Short Name: jogamp 3 | URL: http://jogamp.org/ 4 | Version: jogl-2.4-b1506-20200306, gluegen-2.4-b937-20200306 5 | License: Mixed (see LICENSE.txt files) 6 | 7 | Description: 8 | This library is used to provide OpenGL bindings. Download the platform 7z 9 | files from https://jogamp.org/deployment/autobuilds/master/ and extract the 10 | required jar files from the jar/ directory. 11 | 12 | See http://jogamp.org/wiki/index.php/Downloading_and_installing_JOGL for 13 | related documentation. 14 | 15 | Local Modifications: 16 | None. 17 | -------------------------------------------------------------------------------- /third_party/jogamp/jar/gluegen-rt-natives-linux-amd64.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chromiumembedded/java-cef/ca49ada5c7e3fc98cd7058b6253b59f967530a65/third_party/jogamp/jar/gluegen-rt-natives-linux-amd64.jar -------------------------------------------------------------------------------- /third_party/jogamp/jar/gluegen-rt-natives-linux-i586.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chromiumembedded/java-cef/ca49ada5c7e3fc98cd7058b6253b59f967530a65/third_party/jogamp/jar/gluegen-rt-natives-linux-i586.jar -------------------------------------------------------------------------------- /third_party/jogamp/jar/gluegen-rt-natives-macosx-universal.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chromiumembedded/java-cef/ca49ada5c7e3fc98cd7058b6253b59f967530a65/third_party/jogamp/jar/gluegen-rt-natives-macosx-universal.jar -------------------------------------------------------------------------------- /third_party/jogamp/jar/gluegen-rt-natives-windows-amd64.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chromiumembedded/java-cef/ca49ada5c7e3fc98cd7058b6253b59f967530a65/third_party/jogamp/jar/gluegen-rt-natives-windows-amd64.jar -------------------------------------------------------------------------------- /third_party/jogamp/jar/gluegen-rt-natives-windows-i586.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chromiumembedded/java-cef/ca49ada5c7e3fc98cd7058b6253b59f967530a65/third_party/jogamp/jar/gluegen-rt-natives-windows-i586.jar -------------------------------------------------------------------------------- /third_party/jogamp/jar/gluegen-rt.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chromiumembedded/java-cef/ca49ada5c7e3fc98cd7058b6253b59f967530a65/third_party/jogamp/jar/gluegen-rt.jar -------------------------------------------------------------------------------- /third_party/jogamp/jar/jogl-all-natives-linux-amd64.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chromiumembedded/java-cef/ca49ada5c7e3fc98cd7058b6253b59f967530a65/third_party/jogamp/jar/jogl-all-natives-linux-amd64.jar -------------------------------------------------------------------------------- /third_party/jogamp/jar/jogl-all-natives-linux-i586.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chromiumembedded/java-cef/ca49ada5c7e3fc98cd7058b6253b59f967530a65/third_party/jogamp/jar/jogl-all-natives-linux-i586.jar -------------------------------------------------------------------------------- /third_party/jogamp/jar/jogl-all-natives-macosx-universal.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chromiumembedded/java-cef/ca49ada5c7e3fc98cd7058b6253b59f967530a65/third_party/jogamp/jar/jogl-all-natives-macosx-universal.jar -------------------------------------------------------------------------------- /third_party/jogamp/jar/jogl-all-natives-windows-amd64.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chromiumembedded/java-cef/ca49ada5c7e3fc98cd7058b6253b59f967530a65/third_party/jogamp/jar/jogl-all-natives-windows-amd64.jar -------------------------------------------------------------------------------- /third_party/jogamp/jar/jogl-all-natives-windows-i586.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chromiumembedded/java-cef/ca49ada5c7e3fc98cd7058b6253b59f967530a65/third_party/jogamp/jar/jogl-all-natives-windows-i586.jar -------------------------------------------------------------------------------- /third_party/jogamp/jar/jogl-all.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chromiumembedded/java-cef/ca49ada5c7e3fc98cd7058b6253b59f967530a65/third_party/jogamp/jar/jogl-all.jar -------------------------------------------------------------------------------- /third_party/junit/README.jcef: -------------------------------------------------------------------------------- 1 | Name: JUnit 2 | Short Name: junit 3 | URL: https://junit.org/junit5/ 4 | Version: 5.4.2 5 | License: Mixed (see LICENSE.txt files in *.jar) 6 | 7 | Description: 8 | Command-line Java application for launching the JUnit Platform from the console. 9 | 10 | Local Modifications: 11 | None. 12 | -------------------------------------------------------------------------------- /third_party/junit/junit-platform-console-standalone-1.4.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chromiumembedded/java-cef/ca49ada5c7e3fc98cd7058b6253b59f967530a65/third_party/junit/junit-platform-console-standalone-1.4.2.jar -------------------------------------------------------------------------------- /tools/buildtools/LICENSE: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009 The Chromium Authors. All rights reserved. 2 | // 3 | // Redistribution and use in source and binary forms, with or without 4 | // modification, are permitted provided that the following conditions are 5 | // met: 6 | // 7 | // * Redistributions of source code must retain the above copyright 8 | // notice, this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above 10 | // copyright notice, this list of conditions and the following disclaimer 11 | // in the documentation and/or other materials provided with the 12 | // distribution. 13 | // * Neither the name of Google Inc. nor the names of its 14 | // contributors may be used to endorse or promote products derived from 15 | // this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /tools/buildtools/README.jcef: -------------------------------------------------------------------------------- 1 | Name: depot_tools 2 | Short Name: depot_tools 3 | URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git 4 | Date: 21 Sep 2022 5 | Revision: 08bb5c487f 6 | License: BSD 7 | License File: LICENSE 8 | 9 | Description: 10 | Select tools extracted from depot_tools. 11 | 12 | Local Modifications: 13 | - Remove dependency on vpython. 14 | -------------------------------------------------------------------------------- /tools/buildtools/linux64/clang-format.sha1: -------------------------------------------------------------------------------- 1 | dd736afb28430c9782750fc0fd5f0ed497399263 -------------------------------------------------------------------------------- /tools/buildtools/mac/clang-format.arm64.sha1: -------------------------------------------------------------------------------- 1 | f1424c44ee758922823d6b37de43705955c99d7e -------------------------------------------------------------------------------- /tools/buildtools/mac/clang-format.x64.sha1: -------------------------------------------------------------------------------- 1 | a1b33be85faf2578f3101d7806e443e1c0949498 -------------------------------------------------------------------------------- /tools/buildtools/win/clang-format.exe.sha1: -------------------------------------------------------------------------------- 1 | 66882fadbf9e99cc00b8677d8c1e7e8b3cfdf4fe -------------------------------------------------------------------------------- /tools/clang_util.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights 2 | # reserved. Use of this source code is governed by a BSD-style license that 3 | # can be found in the LICENSE file 4 | 5 | from __future__ import absolute_import 6 | from __future__ import print_function 7 | from exec_util import exec_cmd 8 | import os 9 | import sys 10 | 11 | # Script directory. 12 | script_dir = os.path.dirname(__file__) 13 | root_dir = os.path.join(script_dir, os.pardir) 14 | 15 | if sys.platform == 'win32': 16 | clang_format_exe = 'buildtools/win/clang-format.exe' 17 | elif sys.platform == 'darwin': 18 | clang_format_exe = 'buildtools/mac/clang-format' 19 | elif sys.platform.startswith('linux'): 20 | clang_format_exe = 'buildtools/linux64/clang-format' 21 | else: 22 | raise Exception("Unsupported platform: %s" % sys.platform) 23 | 24 | 25 | def clang_format(file_name, file_contents): 26 | # -assume-filename is necessary to find the .clang-format file and determine 27 | # the language when specifying contents via stdin. 28 | result = exec_cmd("%s -assume-filename=%s" % 29 | (os.path.join(script_dir, clang_format_exe), 30 | file_name), root_dir, file_contents.encode('utf-8')) 31 | if result['err'] != '': 32 | print("clang-format error: %s" % result['err']) 33 | if result['out'] != '': 34 | output = result['out'] 35 | if sys.platform == 'win32': 36 | # Convert to Unix line endings. 37 | output = output.replace("\r", "") 38 | return output 39 | return None 40 | -------------------------------------------------------------------------------- /tools/compile.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | :: Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights 3 | :: reserved. Use of this source code is governed by a BSD-style license 4 | :: that can be found in the LICENSE file. 5 | 6 | set RETURNCODE= 7 | setlocal 8 | cd .. 9 | 10 | if "%1" == "" ( 11 | echo ERROR: Please specify a target platform: win32 or win64 12 | set ERRORLEVEL=1 13 | goto end 14 | ) 15 | 16 | set OUT_PATH=".\out\%1" 17 | set CLS_PATH=".\third_party\jogamp\jar\*;.\third_party\junit\*;.\java" 18 | 19 | if not exist %OUT_PATH% mkdir %OUT_PATH% 20 | javac -Xdiags:verbose -cp %CLS_PATH% -d %OUT_PATH% java/tests/detailed/*.java java/tests/junittests/*.java java/tests/simple/*.java java/org/cef/*.java java/org/cef/browser/*.java java/org/cef/callback/*.java java/org/cef/handler/*.java java/org/cef/misc/*.java java/org/cef/network/*.java 21 | 22 | :: Copy MANIFEST.MF 23 | xcopy /sfy .\java\manifest %OUT_PATH%\manifest\ 24 | 25 | :: Copy resource files. 26 | xcopy /sfy .\java\tests\detailed\handler\*.html %OUT_PATH%\tests\detailed\handler\ 27 | xcopy /sfy .\java\tests\detailed\handler\*.png %OUT_PATH%\tests\detailed\handler\ 28 | 29 | :end 30 | endlocal & set RETURNCODE=%ERRORLEVEL% 31 | goto omega 32 | 33 | :returncode 34 | exit /B %RETURNCODE% 35 | 36 | :omega 37 | call :returncode %RETURNCODE% 38 | -------------------------------------------------------------------------------- /tools/compile.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights 3 | # reserved. Use of this source code is governed by a BSD-style license 4 | # that can be found in the LICENSE file. 5 | 6 | if [ -z "$1" ]; then 7 | echo "ERROR: Please specify a target platform: linux32 or linux64" 8 | else 9 | DIR="$( cd "$( dirname "$0" )" && cd .. && pwd )" 10 | OUT_PATH="${DIR}/out/$1" 11 | JAVA_PATH="${DIR}/java" 12 | CLS_PATH="${DIR}/third_party/jogamp/jar/*:${DIR}/third_party/junit/*:${JAVA_PATH}" 13 | 14 | if [ ! -d "$OUT_PATH" ]; then 15 | mkdir -p "$OUT_PATH" 16 | fi 17 | 18 | javac -Xdiags:verbose -cp "$CLS_PATH" -d "$OUT_PATH" "${JAVA_PATH}"/tests/detailed/*.java "${JAVA_PATH}"/tests/junittests/*.java "${JAVA_PATH}"/tests/simple/*.java "${JAVA_PATH}"/org/cef/*.java "${JAVA_PATH}"/org/cef/browser/*.java "${JAVA_PATH}"/org/cef/callback/*.java "${JAVA_PATH}"/org/cef/handler/*.java "${JAVA_PATH}"/org/cef/misc/*.java "${JAVA_PATH}"/org/cef/network/*.java 19 | 20 | # Copy MANIFEST.MF 21 | rsync -a "${JAVA_PATH}"/manifest/MANIFEST.MF $OUT_PATH/manifest/ 22 | 23 | # Copy resource files. 24 | cp -f "${JAVA_PATH}"/tests/detailed/handler/*.html "$OUT_PATH/tests/detailed/handler" 25 | cp -f "${JAVA_PATH}"/tests/detailed/handler/*.png "$OUT_PATH/tests/detailed/handler" 26 | fi 27 | 28 | -------------------------------------------------------------------------------- /tools/date_util.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights 2 | # reserved. Use of this source code is governed by a BSD-style license that 3 | # can be found in the LICENSE file. 4 | 5 | from __future__ import absolute_import 6 | import datetime 7 | 8 | 9 | def get_year(): 10 | """ Returns the current year. """ 11 | return str(datetime.datetime.now().year) 12 | 13 | 14 | def get_date(): 15 | """ Returns the current date. """ 16 | return datetime.datetime.now().strftime('%B %d, %Y') 17 | -------------------------------------------------------------------------------- /tools/distrib/EXCLUDE_FILES.txt: -------------------------------------------------------------------------------- 1 | README.redistrib.txt 2 | README.standard.txt 3 | -------------------------------------------------------------------------------- /tools/distrib/README.footer.txt: -------------------------------------------------------------------------------- 1 | LICENSING 2 | --------- 3 | 4 | The JCEF project is BSD licensed. Please read the LICENSE.txt files included with 5 | this binary distribution for licensing terms and conditions. Other software 6 | included in this distribution is provided under other licenses. Please visit 7 | "about:credits" in a JCEF-based application for complete Chromium and third-party 8 | licensing information. 9 | -------------------------------------------------------------------------------- /tools/distrib/README.header.txt: -------------------------------------------------------------------------------- 1 | Java Chromium Embedded Framework (JCEF) Binary Distribution for $PLATFORM$ 2 | ------------------------------------------------------------------------------- 3 | 4 | Date: $DATE$ 5 | 6 | JCEF Version: $JCEF_VER$ 7 | JCEF URL: $JCEF_URL$ 8 | @$JCEF_REV$ 9 | 10 | CEF Version: $CEF_VER$ 11 | CEF URL: $CEF_URL$ 12 | 13 | Chromium Verison: $CHROMIUM_VER$ 14 | Chromium URL: $CHROMIUM_URL$ 15 | 16 | This distribution contains all components necessary to build and distribute a 17 | Java application using JCEF on the $PLATFORM$ platform. Please see the LICENSING 18 | section of this document for licensing terms and conditions. 19 | -------------------------------------------------------------------------------- /tools/distrib/linux32/README.standard.txt: -------------------------------------------------------------------------------- 1 | CONTENTS 2 | -------- 3 | 4 | bin Contains Java archives, native library files and the MainFrame 5 | sample application. 6 | 7 | docs Contains documentation for the org.cef package. 8 | 9 | 10 | USAGE 11 | ----- 12 | 13 | 1. Install a 32-bit version of the Oracle Java 7 runtime. 14 | 2. Execute the run.sh script to run the MainFrame sample application. 15 | 3. Optionally recompile the sample application and update jcef-tests.jar 16 | by running the compile.sh script. 17 | 18 | Please visit the JCEF Website for additional usage information. 19 | 20 | https://bitbucket.org/chromiumembedded/java-cef 21 | -------------------------------------------------------------------------------- /tools/distrib/linux32/compile.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 3 | # reserved. Use of this source code is governed by a BSD-style license 4 | # that can be found in the LICENSE file. 5 | 6 | # Determine the absolute path to the current directory. 7 | DIR="$( cd "$( dirname "$0" )" && pwd )" 8 | BIN_DIR="${DIR}/bin" 9 | 10 | # Compile the test program. 11 | javac -cp "${BIN_DIR}:${BIN_DIR}/*" "${BIN_DIR}"/tests/detailed/*.java "${BIN_DIR}"/tests/detailed/dialog/*.java "${BIN_DIR}"/tests/detailed/handler/*.java "${BIN_DIR}"/tests/detailed/ui/*.java "${BIN_DIR}"/tests/simple/*.java 12 | 13 | # Create the test JAR file. 14 | jar -cf "${BIN_DIR}"/jcef-tests.jar -C "${BIN_DIR}" tests 15 | -------------------------------------------------------------------------------- /tools/distrib/linux32/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights 3 | # reserved. Use of this source code is governed by a BSD-style license 4 | # that can be found in the LICENSE file. 5 | 6 | # Determine the absolute path to the current directory. 7 | DIR="$( cd "$( dirname "$0" )" && pwd )" 8 | LIB_PATH="$DIR/bin/lib/linux32" 9 | 10 | if [ -z "$1" ]; then 11 | EXAMPLE="detailed" 12 | else 13 | EXAMPLE="$1" 14 | fi 15 | 16 | # Necessary for libjcef.so to find libjawt.so. 17 | JAVA_PATH="$(readlink -f $(which java))" 18 | JAVA_LIB_PATH="$(dirname ${JAVA_PATH})/../lib" 19 | if [ ! -d "$JAVA_LIB_PATH" ]; then 20 | echo "ERROR: Java lib path does not exist" 21 | exit 1 22 | fi 23 | 24 | LIB_PATH="${LIB_PATH}:${JAVA_LIB_PATH}" 25 | 26 | # Necessary for jcef_helper to find libcef.so. 27 | if [ -n "$LD_LIBRARY_PATH" ]; then 28 | LD_LIBRARY_PATH="$LIB_PATH:${LD_LIBRARY_PATH}" 29 | else 30 | LD_LIBRARY_PATH="$LIB_PATH" 31 | fi 32 | export LD_LIBRARY_PATH 33 | 34 | # Preload libcef.so to avoid crashes. 35 | LD_PRELOAD=libcef.so java -cp "${DIR}/bin:${DIR}/bin/*" -Djava.library.path="$LIB_PATH" tests.${EXAMPLE}.MainFrame "$@" 36 | -------------------------------------------------------------------------------- /tools/distrib/linux64/README.standard.txt: -------------------------------------------------------------------------------- 1 | CONTENTS 2 | -------- 3 | 4 | bin Contains Java archives, native library files and the MainFrame 5 | sample application. 6 | 7 | docs Contains documentation for the org.cef package. 8 | 9 | 10 | USAGE 11 | ----- 12 | 13 | 1. Install a 64-bit version of the Oracle Java 7 runtime. 14 | 2. Execute the run.sh script to run the MainFrame sample application. 15 | 3. Optionally recompile the sample application and update jcef-tests.jar 16 | by running the compile.sh script. 17 | 18 | Please visit the JCEF Website for additional usage information. 19 | 20 | https://bitbucket.org/chromiumembedded/java-cef 21 | -------------------------------------------------------------------------------- /tools/distrib/linux64/compile.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 3 | # reserved. Use of this source code is governed by a BSD-style license 4 | # that can be found in the LICENSE file. 5 | 6 | # Determine the absolute path to the current directory. 7 | DIR="$( cd "$( dirname "$0" )" && pwd )" 8 | BIN_DIR="${DIR}/bin" 9 | 10 | # Compile the test program. 11 | javac -cp "${BIN_DIR}:${BIN_DIR}/*" "${BIN_DIR}"/tests/detailed/*.java "${BIN_DIR}"/tests/detailed/dialog/*.java "${BIN_DIR}"/tests/detailed/handler/*.java "${BIN_DIR}"/tests/detailed/ui/*.java "${BIN_DIR}"/tests/simple/*.java 12 | 13 | # Create the test JAR file. 14 | jar -cf "${BIN_DIR}"/jcef-tests.jar -C "${BIN_DIR}" tests 15 | -------------------------------------------------------------------------------- /tools/distrib/linux64/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights 3 | # reserved. Use of this source code is governed by a BSD-style license 4 | # that can be found in the LICENSE file. 5 | 6 | # Determine the absolute path to the current directory. 7 | DIR="$( cd "$( dirname "$0" )" && pwd )" 8 | LIB_PATH="$DIR/bin/lib/linux64" 9 | 10 | if [ -z "$1" ]; then 11 | EXAMPLE="detailed" 12 | else 13 | EXAMPLE="$1" 14 | fi 15 | 16 | # Necessary for libjcef.so to find libjawt.so. 17 | JAVA_PATH="$(readlink -f $(which java))" 18 | JAVA_LIB_PATH="$(dirname ${JAVA_PATH})/../lib" 19 | if [ ! -d "$JAVA_LIB_PATH" ]; then 20 | echo "ERROR: Java lib path does not exist" 21 | exit 1 22 | fi 23 | 24 | LIB_PATH="${LIB_PATH}:${JAVA_LIB_PATH}" 25 | 26 | # Necessary for jcef_helper to find libcef.so. 27 | if [ -n "$LD_LIBRARY_PATH" ]; then 28 | LD_LIBRARY_PATH="$LIB_PATH:${LD_LIBRARY_PATH}" 29 | else 30 | LD_LIBRARY_PATH="$LIB_PATH" 31 | fi 32 | export LD_LIBRARY_PATH 33 | 34 | # Preload libcef.so to avoid crashes. 35 | LD_PRELOAD=libcef.so java -cp "${DIR}/bin:${DIR}/bin/*" -Djava.library.path="$LIB_PATH" tests.${EXAMPLE}.MainFrame "$@" 36 | -------------------------------------------------------------------------------- /tools/distrib/macosx64/README.standard.txt: -------------------------------------------------------------------------------- 1 | CONTENTS 2 | -------- 3 | 4 | bin Contains the jcef_app whose contents include Java archives and 5 | native library files. 6 | 7 | docs Contains documentation for the org.cef package. 8 | 9 | tests Contains the MainFrame sample application. 10 | 11 | USAGE 12 | ----- 13 | 14 | 1. Install a 64-bit version of the Oracle Java 7 runtime. 15 | 2. Launch jcef_app to run the MainFrame sample application. 16 | 3. Optionally recompile the sample application and update jcef-tests.jar 17 | in the jcef_app bundle by running the compile.sh script. 18 | 19 | Please visit the JCEF Website for additional usage information. 20 | 21 | https://bitbucket.org/chromiumembedded/java-cef 22 | -------------------------------------------------------------------------------- /tools/distrib/macosx64/compile.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 3 | # reserved. Use of this source code is governed by a BSD-style license 4 | # that can be found in the LICENSE file. 5 | 6 | # Compile the test program. 7 | javac -cp "./bin/jcef_app.app/Contents/Java/*":"." ./tests/detailed/*.java 8 | 9 | # Create the test JAR file. 10 | jar -cf tests/jcef-tests.jar tests/detailed/*.class tests/detailed/dialog/*.class tests/detailed/handler/*.class tests/detailed/ui/*.class 11 | 12 | # Insert the test JAR file into the app bundle. 13 | cp -f tests/jcef-tests.jar "./bin/jcef_app.app/Contents/Java/" 14 | -------------------------------------------------------------------------------- /tools/distrib/win32/README.standard.txt: -------------------------------------------------------------------------------- 1 | CONTENTS 2 | -------- 3 | 4 | bin Contains Java archives, native library files and the MainFrame 5 | sample application. 6 | 7 | docs Contains documentation for the org.cef package. 8 | 9 | 10 | USAGE 11 | ----- 12 | 13 | 1. Install a 32-bit version of the Java 7 runtime. 14 | 2. Add the Java bin folder to your system PATH. 15 | 3. Execute the run.bat script to run the MainFrame sample application. 16 | 4. Optionally recompile the sample application and update jcef-tests.jar 17 | by running the compile.bat script. 18 | 19 | Please visit the JCEF Website for additional usage information. 20 | 21 | https://bitbucket.org/chromiumembedded/java-cef 22 | -------------------------------------------------------------------------------- /tools/distrib/win32/compile.bat: -------------------------------------------------------------------------------- 1 | :: Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | :: reserved. Use of this source code is governed by a BSD-style license 3 | :: that can be found in the LICENSE file. 4 | 5 | :: Compile the test program. 6 | javac -cp "./bin;./bin/*" ./bin/tests/detailed/*.java ./bin/tests/detailed/dialog/*.java ./bin/tests/detailed/handler/*.java ./bin/tests/detailed/ui/*.java ./bin/tests/simple/*.java 7 | 8 | :: Create the test JAR file. 9 | cd bin 10 | jar -cf jcef-tests.jar tests/detailed/*.class tests/detailed/dialog/*.class tests/detailed/handler/*.class tests/detailed/ui/*.class tests/simple/*.java 11 | cd .. -------------------------------------------------------------------------------- /tools/distrib/win32/run.bat: -------------------------------------------------------------------------------- 1 | :: Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights 2 | :: reserved. Use of this source code is governed by a BSD-style license 3 | :: that can be found in the LICENSE file. 4 | 5 | java -cp "./bin;./bin/*" -Djava.library.path=./bin/lib/win32 tests.detailed.MainFrame 6 | -------------------------------------------------------------------------------- /tools/distrib/win64/README.standard.txt: -------------------------------------------------------------------------------- 1 | CONTENTS 2 | -------- 3 | 4 | bin Contains Java archives, native library files and the MainFrame 5 | sample application. 6 | 7 | docs Contains documentation for the org.cef package. 8 | 9 | 10 | USAGE 11 | ----- 12 | 13 | 1. Install a 64-bit version of the Java 7 runtime. 14 | 2. Add the Java bin folder to your system PATH. 15 | 3. Execute the run.bat script to run the MainFrame sample application. 16 | 4. Optionally recompile the sample application and update jcef-tests.jar 17 | by running the compile.bat script. 18 | 19 | Please visit the JCEF Website for additional usage information. 20 | 21 | https://bitbucket.org/chromiumembedded/java-cef 22 | -------------------------------------------------------------------------------- /tools/distrib/win64/compile.bat: -------------------------------------------------------------------------------- 1 | :: Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | :: reserved. Use of this source code is governed by a BSD-style license 3 | :: that can be found in the LICENSE file. 4 | 5 | :: Compile the test program. 6 | javac -cp "./bin;./bin/*" ./bin/tests/detailed/*.java ./bin/tests/detailed/dialog/*.java ./bin/tests/detailed/handler/*.java ./bin/tests/detailed/ui/*.java ./bin/tests/simple/*.java 7 | 8 | :: Create the test JAR file. 9 | cd bin 10 | jar -cf jcef-tests.jar tests/detailed/*.class tests/detailed/dialog/*.class tests/detailed/handler/*.class tests/detailed/ui/*.class tests/simple/*.java 11 | cd .. -------------------------------------------------------------------------------- /tools/distrib/win64/run.bat: -------------------------------------------------------------------------------- 1 | :: Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights 2 | :: reserved. Use of this source code is governed by a BSD-style license 3 | :: that can be found in the LICENSE file. 4 | 5 | java -cp "./bin;./bin/*" -Djava.library.path=./bin/lib/win64 tests.detailed.MainFrame 6 | -------------------------------------------------------------------------------- /tools/exec_util.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | # reserved. Use of this source code is governed by a BSD-style license that 3 | # can be found in the LICENSE file 4 | 5 | from __future__ import absolute_import 6 | from subprocess import Popen, PIPE 7 | import sys 8 | 9 | 10 | def exec_cmd(cmd, path, input_string=None): 11 | """ Execute the specified command and return the result. """ 12 | out = '' 13 | err = '' 14 | ret = -1 15 | parts = cmd.split() 16 | try: 17 | if input_string is None: 18 | process = Popen( 19 | parts, 20 | cwd=path, 21 | stdout=PIPE, 22 | stderr=PIPE, 23 | shell=(sys.platform == 'win32')) 24 | out, err = process.communicate() 25 | ret = process.returncode 26 | else: 27 | process = Popen( 28 | parts, 29 | cwd=path, 30 | stdin=PIPE, 31 | stdout=PIPE, 32 | stderr=PIPE, 33 | shell=(sys.platform == 'win32')) 34 | out, err = process.communicate(input=input_string) 35 | ret = process.returncode 36 | except IOError as e: 37 | (errno, strerror) = e.args 38 | raise 39 | except: 40 | raise 41 | return {'out': out.decode('utf-8'), 'err': err.decode('utf-8'), 'ret': ret} 42 | -------------------------------------------------------------------------------- /tools/fix_style.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | python tools\fix_style.py %* 3 | -------------------------------------------------------------------------------- /tools/fix_style.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | python3 tools/fix_style.py $@ 3 | -------------------------------------------------------------------------------- /tools/make_docs.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | :: Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights 3 | :: reserved. Use of this source code is governed by a BSD-style license 4 | :: that can be found in the LICENSE file. 5 | 6 | set RETURNCODE= 7 | setlocal 8 | 9 | cd ..\java 10 | 11 | set OUT_PATH="..\out\docs" 12 | 13 | if not exist %OUT_PATH% mkdir %OUT_PATH% 14 | javadoc -Xdoclint:none -windowtitle "CEF3 Java API Docs" -footer "
Chromium Embedded Framework (CEF) Copyright © 2013 Marshall A. Greenblatt
" -nodeprecated -d %OUT_PATH% -link http://docs.oracle.com/javase/7/docs/api/ -subpackages org.cef 15 | 16 | :end 17 | endlocal & set RETURNCODE=%ERRORLEVEL% 18 | goto omega 19 | 20 | :returncode 21 | exit /B %RETURNCODE% 22 | 23 | :omega 24 | call :returncode %RETURNCODE% 25 | -------------------------------------------------------------------------------- /tools/make_docs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights 3 | # reserved. Use of this source code is governed by a BSD-style license 4 | # that can be found in the LICENSE file. 5 | 6 | DIR="$( cd "$( dirname "$0" )" && cd .. && pwd )" 7 | OUT_PATH="${DIR}/out/docs" 8 | 9 | javadoc --ignore-source-errors -Xdoclint:none -windowtitle "CEF3 Java API Docs" -footer "
Chromium Embedded Framework (CEF) Copyright © 2013 Marshall A. Greenblatt
" -nodeprecated -d "$OUT_PATH" -sourcepath "${DIR}/java" -link http://docs.oracle.com/javase/7/docs/api/ -subpackages org.cef 10 | 11 | -------------------------------------------------------------------------------- /tools/make_jar.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | :: Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights 3 | :: reserved. Use of this source code is governed by a BSD-style license 4 | :: that can be found in the LICENSE file. 5 | 6 | set RETURNCODE= 7 | setlocal 8 | 9 | if "%1" == "" ( 10 | echo ERROR: Please specify a build target: win32 or win64 11 | set ERRORLEVEL=1 12 | goto end 13 | ) 14 | cd ..\out\%1 15 | jar -cmf manifest\MANIFEST.MF jcef.jar org/cef/*.class org/cef/browser/*.class org/cef/callback/*.class org/cef/handler/*.class org/cef/misc/*.class org/cef/network/*.class 16 | jar -cf jcef-tests.jar tests/detailed/*.class tests/detailed/dialog/*.class tests/detailed/handler/* tests/detailed/ui/*.class 17 | 18 | :end 19 | endlocal & set RETURNCODE=%ERRORLEVEL% 20 | goto omega 21 | 22 | :returncode 23 | exit /B %RETURNCODE% 24 | 25 | :omega 26 | call :returncode %RETURNCODE% 27 | -------------------------------------------------------------------------------- /tools/make_jar.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights 3 | # reserved. Use of this source code is governed by a BSD-style license 4 | # that can be found in the LICENSE file. 5 | 6 | if [ -z "$1" ]; then 7 | echo "ERROR: Please specify a build target: linux32 or linux64" 8 | else 9 | DIR="$( cd "$( dirname "$0" )" && cd .. && pwd )" 10 | OUT_DIR="${DIR}/out/$1" 11 | jar -cmf "${OUT_DIR}"/manifest/MANIFEST.MF "${OUT_DIR}"/jcef.jar -C "${OUT_DIR}" org 12 | jar -cf "${OUT_DIR}"/jcef-tests.jar -C "${OUT_DIR}" tests 13 | fi 14 | -------------------------------------------------------------------------------- /tools/make_jni_header.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | :: Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights 3 | :: reserved. Use of this source code is governed by a BSD-style license 4 | :: that can be found in the LICENSE file. 5 | 6 | set RETURNCODE= 7 | setlocal 8 | 9 | cd .. 10 | 11 | if "%1" == "" ( 12 | echo ERROR: Please specify a target platform: win32 or win64 13 | set ERRORLEVEL=1 14 | goto end 15 | ) 16 | 17 | if "%2" == "" ( 18 | echo ERROR: Please specify a class name 19 | set ERRORLEVEL=1 20 | goto end 21 | ) 22 | 23 | set OUT_PATH=".\native" 24 | set CLS_PATH=".\third_party\jogamp\jar\*;.\out\%1" 25 | set CLS_NAME="" 26 | 27 | SET TMP="%2" 28 | :loop 29 | for /F "tokens=1,* delims=." %%F in (%TMP%) DO ( 30 | set CLS_NAME="%%F" 31 | set TMP="%%G" 32 | goto loop 33 | ) 34 | 35 | call javah.exe -force -classpath %CLS_PATH% -o %OUT_PATH%/%CLS_NAME%.h %2 36 | 37 | :end 38 | endlocal & set RETURNCODE=%ERRORLEVEL% 39 | goto omega 40 | 41 | :returncode 42 | exit /B %RETURNCODE% 43 | 44 | :omega 45 | call :returncode %RETURNCODE% 46 | -------------------------------------------------------------------------------- /tools/make_jni_header.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights 3 | # reserved. Use of this source code is governed by a BSD-style license 4 | # that can be found in the LICENSE file. 5 | 6 | if [ -z "$1" ]; then 7 | echo "ERROR: Please specify a target platform: linux32, linux64 or macosx64" 8 | else 9 | if [ -z "$2" ]; then 10 | echo "ERROR: Please specify a class name" 11 | else 12 | DIR="$( cd "$( dirname "$0" )" && cd .. && pwd )" 13 | if [ $1 == "macosx64" ]; then 14 | CLS_OUT_PATH="${DIR}/jcef_build/native/Release" 15 | if [ ! -d "$CLS_OUT_PATH" ]; then 16 | CLS_OUT_PATH="${DIR}/jcef_build/native/Debug" 17 | fi 18 | else 19 | CLS_OUT_PATH="${DIR}/out/$1" 20 | fi 21 | 22 | HEADER_PATH="${DIR}/native" 23 | CLS_PATH="${DIR}/third_party/jogamp/jar/*:${CLS_OUT_PATH}" 24 | CLS_NAME="${2##*.}" 25 | 26 | javah -force -classpath "$CLS_PATH" -o "$HEADER_PATH/$CLS_NAME.h" $2 27 | fi 28 | fi 29 | 30 | -------------------------------------------------------------------------------- /tools/make_readme.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | :: Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 3 | :: reserved. Use of this source code is governed by a BSD-style license 4 | :: that can be found in the LICENSE file. 5 | 6 | set RETURNCODE= 7 | setlocal 8 | 9 | cd .. 10 | if "%1" == "" ( 11 | echo ERROR: Please specify a target platform: win32 or win64 12 | set ERRORLEVEL=1 13 | goto end 14 | ) 15 | 16 | set DISTRIB_PATH=".\binary_distrib\%1" 17 | if not exist %DISTRIB_PATH% mkdir %DISTRIB_PATH% 18 | 19 | :: Create README.txt 20 | call python tools\make_readme.py --output-dir %DISTRIB_PATH%\ --platform %1 21 | 22 | :end 23 | endlocal & set RETURNCODE=%ERRORLEVEL% 24 | goto omega 25 | 26 | :returncode 27 | exit /B %RETURNCODE% 28 | 29 | :omega 30 | call :returncode %RETURNCODE% 31 | -------------------------------------------------------------------------------- /tools/make_readme.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 3 | # reserved. Use of this source code is governed by a BSD-style license 4 | # that can be found in the LICENSE file. 5 | 6 | if [ -z "$1" ]; then 7 | echo "ERROR: Please specify a target platform: linux32, linux64 or macosx64" 8 | else 9 | DIR="$( cd "$( dirname "$0" )" && cd .. && pwd )" 10 | DISTRIB_PATH="${DIR}/binary_distrib/$1" 11 | if [ ! -d "$DISTRIB_PATH" ]; then 12 | mkdir -p "$DISTRIB_PATH" 13 | fi 14 | 15 | # Create README.txt 16 | python "${DIR}"/tools/make_readme.py --output-dir "$DISTRIB_PATH/" --platform $1 17 | fi 18 | -------------------------------------------------------------------------------- /tools/readme_util.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | from file_util import read_file 3 | 4 | 5 | def read_readme_file(file, args): 6 | """ Read a README.txt and try to parse its containing version numbers """ 7 | lines = read_file(file).split("\n") 8 | for line in lines: 9 | parts = line.split(':', 1) 10 | if len(parts) != 2: 11 | continue 12 | if parts[0].startswith('CEF Version'): 13 | args['CEF_VER'] = parts[1].strip() 14 | subparts = parts[1].split('+') 15 | if len(subparts) != 3: 16 | raise Exception('Failed to parse CEF Version: %s' % parts[1]) 17 | verparts = subparts[0].strip().split('.') 18 | if len(verparts) >= 3: 19 | args['CEF_MAJOR'] = verparts[0] 20 | args['CEF_MINOR'] = verparts[1] 21 | args['CEF_PATCH'] = verparts[2] 22 | elif parts[0].startswith('CEF URL'): 23 | args['CEF_URL'] = parts[1].strip() 24 | elif parts[0].startswith('Chromium Version'): 25 | args['CHROMIUM_VER'] = parts[1].strip() 26 | elif parts[0].startswith('Chromium URL'): 27 | args['CHROMIUM_URL'] = parts[1].strip() 28 | -------------------------------------------------------------------------------- /tools/run.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | :: Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights 3 | :: reserved. Use of this source code is governed by a BSD-style license 4 | :: that can be found in the LICENSE file. 5 | 6 | set RETURNCODE= 7 | setlocal 8 | 9 | cd .. 10 | 11 | if "%1" == "" ( 12 | echo ERROR: Please specify a target platform: win32 or win64 13 | set ERRORLEVEL=1 14 | goto end 15 | ) 16 | 17 | if "%2" == "" ( 18 | echo ERROR: Please specify a build type: Debug or Release 19 | set ERRORLEVEL=1 20 | goto end 21 | ) 22 | 23 | if "%3" == "" ( 24 | echo ERROR: Please specify a run type: detailed or simple 25 | set ERRORLEVEL=1 26 | goto end 27 | ) 28 | 29 | set OUT_PATH=.\out\%~1 30 | 31 | set LIB_PATH=.\jcef_build\native\%~2 32 | if not exist %LIB_PATH% ( 33 | echo ERROR: Native build output path does not exist 34 | goto end 35 | ) 36 | 37 | set CLS_PATH=.\third_party\jogamp\jar\*;%OUT_PATH% 38 | set RUN_TYPE=%~3 39 | 40 | :: Remove the first three params (%1, %2 and %3) and pass the rest to java. 41 | set RESTVAR= 42 | shift 43 | shift 44 | shift 45 | :loop1 46 | if "%1"=="" goto after_loop 47 | set RESTVAR=%RESTVAR% %1 48 | shift 49 | goto loop1 50 | :after_loop 51 | 52 | java -cp %CLS_PATH% -Djava.library.path=%LIB_PATH% tests.%RUN_TYPE%.MainFrame %RESTVAR% 53 | 54 | :end 55 | endlocal & set RETURNCODE=%ERRORLEVEL% 56 | goto omega 57 | 58 | :returncode 59 | exit /B %RETURNCODE% 60 | 61 | :omega 62 | call :returncode %RETURNCODE% 63 | -------------------------------------------------------------------------------- /tools/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights 3 | # reserved. Use of this source code is governed by a BSD-style license 4 | # that can be found in the LICENSE file. 5 | 6 | if [ -z "$1" ]; then 7 | echo "ERROR: Please specify a target platform: linux32 or linux64" 8 | else 9 | if [ -z "$2" ]; then 10 | echo "ERROR: Please specify a build type: Debug or Release" 11 | elif [ -z "$3" ]; then 12 | echo "ERROR: Please specify a run type: detailed or simple" 13 | else 14 | DIR="$( cd "$( dirname "$0" )" && cd .. && pwd )" 15 | OUT_PATH="${DIR}/out/$1" 16 | 17 | LIB_PATH="${DIR}/jcef_build/native/$2" 18 | if [ ! -d "$LIB_PATH" ]; then 19 | echo "ERROR: Native build output path does not exist" 20 | exit 1 21 | fi 22 | 23 | # Necessary for libjcef.so to find libjawt.so. 24 | JAVA_PATH="$(readlink -f $(which java))" 25 | JAVA_LIB_PATH="$(dirname ${JAVA_PATH})/../lib" 26 | if [ ! -d "$JAVA_LIB_PATH" ]; then 27 | echo "ERROR: Java lib path does not exist" 28 | exit 1 29 | fi 30 | 31 | LIB_PATH="${LIB_PATH}:${JAVA_LIB_PATH}" 32 | 33 | CLS_PATH="${DIR}/third_party/jogamp/jar/*:$OUT_PATH" 34 | RUN_TYPE="$3" 35 | 36 | # Necessary for jcef_helper to find libcef.so. 37 | if [ -n "$LD_LIBRARY_PATH" ]; then 38 | LD_LIBRARY_PATH="$LIB_PATH:${LD_LIBRARY_PATH}" 39 | else 40 | LD_LIBRARY_PATH="$LIB_PATH" 41 | fi 42 | export LD_LIBRARY_PATH 43 | 44 | # Remove the first three params ($1, $2 and $3) and pass the rest to java. 45 | shift 46 | shift 47 | shift 48 | 49 | LD_PRELOAD=libcef.so java -cp "$CLS_PATH" -Djava.library.path="$LIB_PATH" tests.$RUN_TYPE.MainFrame "$@" 50 | fi 51 | fi 52 | 53 | -------------------------------------------------------------------------------- /tools/run_tests.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | :: Copyright (c) 2019 The Chromium Embedded Framework Authors. All rights 3 | :: reserved. Use of this source code is governed by a BSD-style license 4 | :: that can be found in the LICENSE file. 5 | 6 | set RETURNCODE= 7 | setlocal 8 | 9 | cd .. 10 | 11 | if "%1" == "" ( 12 | echo ERROR: Please specify a target platform: win32 or win64 13 | set ERRORLEVEL=1 14 | goto end 15 | ) 16 | 17 | if "%2" == "" ( 18 | echo ERROR: Please specify a build type: Debug or Release 19 | set ERRORLEVEL=1 20 | goto end 21 | ) 22 | 23 | if "%JAVA_HOME%" == "" ( 24 | echo ERROR: Please set the JAVA_HOME environment variable 25 | set ERRORLEVEL=1 26 | goto end 27 | ) 28 | 29 | set OUT_PATH=.\out\%~1 30 | 31 | set LIB_PATH=.\jcef_build\native\%~2 32 | if not exist %LIB_PATH% ( 33 | echo ERROR: Native build output path does not exist 34 | goto end 35 | ) 36 | 37 | set CLS_PATH=.\third_party\jogamp\jar\*;%OUT_PATH% 38 | 39 | :: Remove the first two params (%1 and %2) and pass the rest to java. 40 | set RESTVAR= 41 | shift 42 | shift 43 | :loop1 44 | if "%1"=="" goto after_loop 45 | set RESTVAR=%RESTVAR% %1 46 | shift 47 | goto loop1 48 | :after_loop 49 | 50 | :: JUnit can fail to load JVM DLLs if you don't explicitly set the PATH. 51 | set PATH="%JAVA_HOME%\bin" 52 | 53 | java -Djava.library.path=%LIB_PATH% -jar .\third_party\junit\junit-platform-console-standalone-1.4.2.jar -cp %OUT_PATH% --disable-ansi-colors --select-package tests.junittests %RESTVAR% 54 | 55 | :end 56 | endlocal & set RETURNCODE=%ERRORLEVEL% 57 | goto omega 58 | 59 | :returncode 60 | exit /B %RETURNCODE% 61 | 62 | :omega 63 | call :returncode %RETURNCODE% 64 | -------------------------------------------------------------------------------- /tools/run_tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2019 The Chromium Embedded Framework Authors. All rights 3 | # reserved. Use of this source code is governed by a BSD-style license 4 | # that can be found in the LICENSE file. 5 | 6 | if [ -z "$1" ]; then 7 | echo "ERROR: Please specify a target platform: linux32 or linux64" 8 | else 9 | if [ -z "$2" ]; then 10 | echo "ERROR: Please specify a build type: Debug or Release" 11 | else 12 | DIR="$( cd "$( dirname "$0" )" && cd .. && pwd )" 13 | OUT_PATH="${DIR}/out/$1" 14 | 15 | LIB_PATH="${DIR}/jcef_build/native/$2" 16 | if [ ! -d "$LIB_PATH" ]; then 17 | echo "ERROR: Native build output path does not exist" 18 | exit 1 19 | fi 20 | 21 | CLS_PATH="${DIR}/third_party/jogamp/jar/*:$OUT_PATH" 22 | 23 | # Necessary for jcef_helper to find libcef.so. 24 | if [ -n "$LD_LIBRARY_PATH" ]; then 25 | LD_LIBRARY_PATH="$LIB_PATH:${LD_LIBRARY_PATH}" 26 | else 27 | LD_LIBRARY_PATH="$LIB_PATH" 28 | fi 29 | export LD_LIBRARY_PATH 30 | 31 | # Remove the first two params ($1 and $2) and pass the rest to java. 32 | shift 33 | shift 34 | 35 | LD_PRELOAD=libcef.so java -Djava.library.path="$LIB_PATH" -jar "${DIR}"/third_party/junit/junit-platform-console-standalone-*.jar -cp "$OUT_PATH" --select-package tests.junittests "$@" 36 | fi 37 | fi 38 | 39 | -------------------------------------------------------------------------------- /tools/yapf/README.cef: -------------------------------------------------------------------------------- 1 | Name: yapf 2 | Short Name: yapf 3 | URL: https://github.com/google/yapf 4 | Date: 28 May 2017 5 | Version: 0.16.2 6 | Revision: 9f168a12 7 | License: Apache 2.0 8 | License File: LICENSE 9 | 10 | Description: 11 | A formatter for Python files. 12 | 13 | Local Modifications: 14 | None 15 | -------------------------------------------------------------------------------- /tools/yapf/__main__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2015-2017 Google Inc. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | import yapf 15 | 16 | yapf.run_main() 17 | -------------------------------------------------------------------------------- /tools/yapf/yapf/yapflib/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2015-2017 Google Inc. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /tools/yapf/yapf/yapflib/errors.py: -------------------------------------------------------------------------------- 1 | # Copyright 2015-2017 Google Inc. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | """YAPF error object.""" 15 | 16 | 17 | class YapfError(Exception): 18 | """Parent class for user errors or input errors. 19 | 20 | Exceptions of this type are handled by the command line tool 21 | and result in clear error messages, as opposed to backtraces. 22 | """ 23 | pass 24 | -------------------------------------------------------------------------------- /tools/yapf_util.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights 2 | # reserved. Use of this source code is governed by a BSD-style license that 3 | # can be found in the LICENSE file 4 | 5 | from __future__ import absolute_import 6 | from __future__ import print_function 7 | from exec_util import exec_cmd 8 | import os 9 | import sys 10 | 11 | # Script directory. 12 | script_dir = os.path.dirname(__file__) 13 | root_dir = os.path.join(script_dir, os.pardir) 14 | 15 | 16 | def yapf_format(file_name, file_contents): 17 | # Reads .style.yapf in the root_dir when specifying contents via stdin. 18 | result = exec_cmd("%s %s/yapf" % (sys.executable, script_dir), root_dir, 19 | file_contents.encode('utf-8')) 20 | if result['err'] != '': 21 | print("yapf error: %s" % result['err']) 22 | if result['out'] != '': 23 | output = result['out'] 24 | if sys.platform == 'win32': 25 | # Convert to Unix line endings. 26 | output = output.replace("\r", "") 27 | return output 28 | return None 29 | --------------------------------------------------------------------------------