Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix IsEnablePDFExtension to work #245

Merged
merged 1 commit into from
Dec 4, 2024
Merged

Conversation

HashidaTKS
Copy link
Contributor

@HashidaTKS HashidaTKS commented Dec 3, 2024

Which issue(s) this PR fixes:

https://github.com/ThinBridge/Chronos-SG/issues/303

What this PR does / why we need it:

The disable-pdf-extension command line parameter is no longer supported on CEF 126.2.7+. CEF does the same behavior with specifying the preference plugins.always_open_pdf_externally on CEF 126+.

cefsharp/CefSharp#4880

Note that we can't use the preference plugins.always_open_pdf_externally on older versions, at least CEF119, because it does not exist.

How to verify the fixed issue:

The steps to verify:

  1. Check (Enable) "PDF表示を有効にする" in the setting dialog
  2. Restart Chronos
  3. Open any PDF file on Chronos.
    • Confirm that the PDF file opens in the window.
  4. Uncheck (disable) "PDF表示を有効にする" in the setting dialog
  5. Restart Chronos
  6. Open any PDF file on Chronos.
    • Confirm that a download dialog for the PDF file is opens.

The `disable-pdf-extension` command line parameter is no longer supported on CEF 126.2.7+.
CEF does the same behavior with specifying the preference `plugins.always_open_pdf_externally` on CEF 126+.

Note that we can't use the preference `plugins.always_open_pdf_externally` on older version, at least CEF119,
because it does not exist.
@HashidaTKS HashidaTKS requested a review from kenhys December 4, 2024 01:22
CefString error;
CefRefPtr<CefValue> value = CefValue::Create();
value->SetBool(true);
requestContext->SetPreference("plugins.always_open_pdf_externally", value, error);
Copy link
Contributor Author

@HashidaTKS HashidaTKS Dec 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CEFのバージョンによらず常にこのpreferenceを指定する方法で良いのではないかと思ったが、少なくともCEF119ではこのpreferenceが存在せず警告が出て正しく動かなかったので、バージョンによる分岐を設けている。

@HashidaTKS HashidaTKS marked this pull request as ready for review December 4, 2024 01:24
@HashidaTKS HashidaTKS changed the title draft: Fix IsEnablePDFExtension to work Fix IsEnablePDFExtension to work Dec 4, 2024
Copy link
Contributor

@kenhys kenhys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@kenhys kenhys merged commit 86b0225 into master Dec 4, 2024
3 checks passed
@kenhys kenhys deleted the fix-enable-pdf-extension-to-work branch December 4, 2024 02:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants