зеркало из https://github.com/electron/electron.git
fix: pdf viewer template strings (#24913)
This commit is contained in:
Родитель
47d451ae52
Коммит
7ded768743
|
@ -55,6 +55,7 @@ template("electron_extra_paks") {
|
|||
output = "${invoker.output_dir}/resources.pak"
|
||||
sources = [
|
||||
"$root_gen_dir/chrome/dev_ui_browser_resources.pak",
|
||||
"$root_gen_dir/chrome/print_preview_pdf_resources.pak",
|
||||
"$root_gen_dir/components/components_resources.pak",
|
||||
"$root_gen_dir/content/browser/resources/media/media_internals_resources.pak",
|
||||
"$root_gen_dir/content/browser/tracing/tracing_resources.pak",
|
||||
|
@ -70,6 +71,7 @@ template("electron_extra_paks") {
|
|||
]
|
||||
deps = [
|
||||
"//chrome/browser:dev_ui_browser_resources",
|
||||
"//chrome/browser/resources:print_preview_pdf_resources",
|
||||
"//components/resources",
|
||||
"//content:content_resources",
|
||||
"//content:dev_ui_content_resources",
|
||||
|
|
|
@ -209,7 +209,7 @@ void CommonWebContentsDelegate::InitWithWebContents(
|
|||
web_contents, std::make_unique<ElectronPDFWebContentsHelperClient>());
|
||||
#endif
|
||||
|
||||
// Determien whether the WebContents is offscreen.
|
||||
// Determine whether the WebContents is offscreen.
|
||||
auto* web_preferences = WebContentsPreferences::From(web_contents);
|
||||
offscreen_ =
|
||||
web_preferences && web_preferences->IsEnabled(options::kOffscreen);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "shell/browser/extensions/electron_component_extension_resource_manager.h"
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/path_service.h"
|
||||
|
@ -13,6 +14,12 @@
|
|||
#include "build/build_config.h"
|
||||
#include "chrome/common/chrome_paths.h"
|
||||
#include "chrome/grit/component_extension_resources_map.h"
|
||||
#include "electron/buildflags/buildflags.h"
|
||||
|
||||
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||
#include "chrome/browser/pdf/pdf_extension_util.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#endif
|
||||
|
||||
namespace extensions {
|
||||
|
||||
|
@ -20,6 +27,19 @@ ElectronComponentExtensionResourceManager::
|
|||
ElectronComponentExtensionResourceManager() {
|
||||
AddComponentResourceEntries(kComponentExtensionResources,
|
||||
kComponentExtensionResourcesSize);
|
||||
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||
// Register strings for the PDF viewer, so that $i18n{} replacements work.
|
||||
base::Value pdf_strings(base::Value::Type::DICTIONARY);
|
||||
pdf_extension_util::AddStrings(
|
||||
pdf_extension_util::PdfViewerContext::kPdfViewer, &pdf_strings);
|
||||
pdf_extension_util::AddAdditionalData(&pdf_strings);
|
||||
|
||||
ui::TemplateReplacements pdf_viewer_replacements;
|
||||
ui::TemplateReplacementsFromDictionaryValue(
|
||||
base::Value::AsDictionaryValue(pdf_strings), &pdf_viewer_replacements);
|
||||
extension_template_replacements_[extension_misc::kPdfExtensionId] =
|
||||
std::move(pdf_viewer_replacements);
|
||||
#endif
|
||||
}
|
||||
|
||||
ElectronComponentExtensionResourceManager::
|
||||
|
|
Загрузка…
Ссылка в новой задаче