diff --git a/.github/workflows/build-linux-x86_64.yml b/.github/workflows/build-linux-x86_64.yml index e1e2dc0..34376fa 100644 --- a/.github/workflows/build-linux-x86_64.yml +++ b/.github/workflows/build-linux-x86_64.yml @@ -4,19 +4,19 @@ on: push: branches: [main] paths: - - '.github/workflows/build-linux-x86_64.yml' - - 'CMakeLists.txt' - - 'CefConfig.cmake' - - 'include/**' - - 'src/**' + - ".github/workflows/build-linux-x86_64.yml" + - "CMakeLists.txt" + - "CefConfig.cmake" + - "include/**" + - "src/**" pull_request: branches: [main] paths: - - 'CMakeLists.txt' - - 'CefConfig.cmake' - - 'include/**' - - 'src/**' + - "CMakeLists.txt" + - "CefConfig.cmake" + - "include/**" + - "src/**" env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) @@ -34,7 +34,7 @@ jobs: - name: Checkout Source uses: actions/checkout@v2 with: - submodules: 'true' + submodules: "true" - name: Cache CEF folders uses: actions/cache@v3 @@ -49,4 +49,4 @@ jobs: - name: Build # Build your program with the given configuration - run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} \ No newline at end of file + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} diff --git a/.github/workflows/build-macos-x86_64.yml b/.github/workflows/build-macos-x86_64.yml index 516ef5f..8c71a36 100644 --- a/.github/workflows/build-macos-x86_64.yml +++ b/.github/workflows/build-macos-x86_64.yml @@ -4,19 +4,19 @@ on: push: branches: [main] paths: - - '.github/workflows/build-macos-x86_64.yml' - - 'CMakeLists.txt' - - 'CefConfig.cmake' - - 'include/**' - - 'src/**' + - ".github/workflows/build-macos-x86_64.yml" + - "CMakeLists.txt" + - "CefConfig.cmake" + - "include/**" + - "src/**" pull_request: branches: [main] paths: - - 'CMakeLists.txt' - - 'CefConfig.cmake' - - 'include/**' - - 'src/**' + - "CMakeLists.txt" + - "CefConfig.cmake" + - "include/**" + - "src/**" env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) @@ -34,7 +34,7 @@ jobs: - name: Checkout Source uses: actions/checkout@v2 with: - submodules: 'true' + submodules: "true" - name: Cache CEF folders uses: actions/cache@v3 @@ -45,7 +45,7 @@ jobs: - name: Setup Xcode version uses: maxim-lobanov/setup-xcode@v1 with: - xcode-version: '14' + xcode-version: "15" - name: Configure CMake # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. diff --git a/.github/workflows/build-windows-x86_64.yml b/.github/workflows/build-windows-x86_64.yml index 46bd64d..c250225 100644 --- a/.github/workflows/build-windows-x86_64.yml +++ b/.github/workflows/build-windows-x86_64.yml @@ -4,19 +4,19 @@ on: push: branches: [main] paths: - - '.github/workflows/build-windows-x86_64.yml' - - 'CMakeLists.txt' - - 'CefConfig.cmake' - - 'include/**' - - 'src/**' + - ".github/workflows/build-windows-x86_64.yml" + - "CMakeLists.txt" + - "CefConfig.cmake" + - "include/**" + - "src/**" pull_request: branches: [main] paths: - - 'CMakeLists.txt' - - 'CefConfig.cmake' - - 'include/**' - - 'src/**' + - "CMakeLists.txt" + - "CefConfig.cmake" + - "include/**" + - "src/**" env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) @@ -34,14 +34,14 @@ jobs: - name: Checkout Source uses: actions/checkout@v2 with: - submodules: 'true' + submodules: "true" - name: Cache CEF folders uses: actions/cache@v3 with: path: ${{github.workspace}}/dep key: ${{ runner.os }}-dep-cef - + - name: Configure CMake # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type @@ -49,4 +49,4 @@ jobs: - name: Build # Build your program with the given configuration - run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} \ No newline at end of file + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} diff --git a/src/CefView/CefBrowserApp/CefViewBrowserClient_DownloadHandler.cpp b/src/CefView/CefBrowserApp/CefViewBrowserClient_DownloadHandler.cpp index 66e162f..b14511b 100644 --- a/src/CefView/CefBrowserApp/CefViewBrowserClient_DownloadHandler.cpp +++ b/src/CefView/CefBrowserApp/CefViewBrowserClient_DownloadHandler.cpp @@ -37,10 +37,18 @@ CefViewBrowserClient::OnBeforeDownload(CefRefPtr browser, CEF_REQUIRE_UI_THREAD(); auto delegate = client_delegate_.lock(); - if (delegate) + if (delegate) { delegate->onBeforeDownload(browser, download_item, suggested_name, callback); + } else { + // no delegate, just allow this download and then cancel it in OnDownloadUpdated + if (callback) { + callback->Continue("", false); + } + } - return false; + /// Return true and execute |callback| either asynchronously or in this method to continue or cancel the download. + /// Return false to proceed with default handling (cancel with Alloy style, download shelf with Chrome style) + return true; } #endif @@ -52,6 +60,12 @@ CefViewBrowserClient::OnDownloadUpdated(CefRefPtr browser, CEF_REQUIRE_UI_THREAD(); auto delegate = client_delegate_.lock(); - if (delegate) + if (delegate) { delegate->onDownloadUpdated(browser, download_item, callback); + } else { + // no delegate, just cancel this downloading + if (callback) { + callback->Cancel(); + } + } }