chore: bump chromium to 105.0.5187.0 (main) (#34921)
* chore: bump chromium in DEPS to 105.0.5179.0 * chore: update patches * 3758224: Reland^2 "[flags] Enable freezing of flags"3758224
* chore: bump chromium in DEPS to 105.0.5181.0 * chore: update patches * chore: bump chromium in DEPS to 105.0.5183.0 * chore: bump chromium in DEPS to 105.0.5185.0 * chore: bump chromium in DEPS to 105.0.5187.0 * chore: update patches * 3723298: Pass RemoteFrame mojo channels through its creation messages.3723298
* 3737382: [Code Heath] Replace base::{ListValue,DictionaryValue} in skia et al3737382
* Pass RemoteFrame mojo channels through its creation messages.3723298
* Changed PrintRenderFrame.PrintWithParams mojo interface to use callback.3761203
* 3738183: [CSP] Add support for `DisableWasmEval`3738183
* 3740498: Move LinuxUI from //ui/views/linux_ui to //ui/linux3740498
* 3558277: Moves subsystem and semantics to enum class3558277
* chore: fix broken steps-electron-gn-check * 3749583: [arm64] Fix undefined symbol linker error3749583
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
parent
1b96a3aa1d
commit
9e0a3c44dd
78 changed files with 366 additions and 432 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <utility>
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "build/build_config.h"
|
||||
#include "components/printing/browser/print_to_pdf/pdf_print_utils.h"
|
||||
#include "printing/mojom/print.mojom.h"
|
||||
|
@ -133,7 +134,39 @@ void PrintViewManagerElectron::PrintToPdf(
|
|||
headless_jobs_.emplace_back(cookie);
|
||||
callback_ = std::move(callback);
|
||||
|
||||
GetPrintRenderFrame(rfh)->PrintWithParams(std::move(print_pages_params));
|
||||
// There is no need for a weak pointer here since the mojo proxy is held
|
||||
// in the base class. If we're gone, mojo will discard the callback.
|
||||
GetPrintRenderFrame(rfh)->PrintWithParams(
|
||||
std::move(print_pages_params),
|
||||
base::BindOnce(&PrintViewManagerElectron::OnDidPrintWithParams,
|
||||
base::Unretained(this)));
|
||||
}
|
||||
|
||||
void PrintViewManagerElectron::OnDidPrintWithParams(
|
||||
printing::mojom::PrintWithParamsResultPtr result) {
|
||||
if (result->is_failure_reason()) {
|
||||
switch (result->get_failure_reason()) {
|
||||
case printing::mojom::PrintFailureReason::kGeneralFailure:
|
||||
ReleaseJob(PRINTING_FAILED);
|
||||
return;
|
||||
case printing::mojom::PrintFailureReason::kInvalidPageRange:
|
||||
ReleaseJob(PAGE_COUNT_EXCEEDED);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
auto& content = *result->get_params()->content;
|
||||
if (!content.metafile_data_region.IsValid()) {
|
||||
ReleaseJob(INVALID_MEMORY_HANDLE);
|
||||
return;
|
||||
}
|
||||
base::ReadOnlySharedMemoryMapping map = content.metafile_data_region.Map();
|
||||
if (!map.IsValid()) {
|
||||
ReleaseJob(METAFILE_MAP_ERROR);
|
||||
return;
|
||||
}
|
||||
data_ = std::string(static_cast<const char*>(map.memory()), map.size());
|
||||
ReleaseJob(PRINT_SUCCESS);
|
||||
}
|
||||
|
||||
void PrintViewManagerElectron::GetDefaultPrintSettings(
|
||||
|
@ -171,20 +204,6 @@ void PrintViewManagerElectron::ShowInvalidPrinterSettingsError() {
|
|||
ReleaseJob(INVALID_PRINTER_SETTINGS);
|
||||
}
|
||||
|
||||
void PrintViewManagerElectron::PrintingFailed(
|
||||
int32_t cookie,
|
||||
printing::mojom::PrintFailureReason reason) {
|
||||
auto entry = std::find(headless_jobs_.begin(), headless_jobs_.end(), cookie);
|
||||
if (entry == headless_jobs_.end()) {
|
||||
PrintViewManagerBase::PrintingFailed(cookie, reason);
|
||||
return;
|
||||
}
|
||||
|
||||
ReleaseJob(reason == printing::mojom::PrintFailureReason::kInvalidPageRange
|
||||
? PAGE_COUNT_EXCEEDED
|
||||
: PRINTING_FAILED);
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
||||
void PrintViewManagerElectron::UpdatePrintSettings(
|
||||
int32_t cookie,
|
||||
|
@ -245,37 +264,6 @@ void PrintViewManagerElectron::DidGetPrintedPagesCount(int32_t cookie,
|
|||
}
|
||||
}
|
||||
|
||||
void PrintViewManagerElectron::DidPrintDocument(
|
||||
printing::mojom::DidPrintDocumentParamsPtr params,
|
||||
DidPrintDocumentCallback callback) {
|
||||
auto entry = std::find(headless_jobs_.begin(), headless_jobs_.end(),
|
||||
params->document_cookie);
|
||||
if (entry == headless_jobs_.end()) {
|
||||
PrintViewManagerBase::DidPrintDocument(std::move(params),
|
||||
std::move(callback));
|
||||
return;
|
||||
}
|
||||
|
||||
auto& content = *params->content;
|
||||
if (!content.metafile_data_region.IsValid()) {
|
||||
ReleaseJob(INVALID_MEMORY_HANDLE);
|
||||
std::move(callback).Run(false);
|
||||
return;
|
||||
}
|
||||
|
||||
base::ReadOnlySharedMemoryMapping map = content.metafile_data_region.Map();
|
||||
if (!map.IsValid()) {
|
||||
ReleaseJob(METAFILE_MAP_ERROR);
|
||||
std::move(callback).Run(false);
|
||||
return;
|
||||
}
|
||||
|
||||
data_ = std::string(static_cast<const char*>(map.memory()), map.size());
|
||||
headless_jobs_.erase(entry);
|
||||
std::move(callback).Run(true);
|
||||
ReleaseJob(PRINT_SUCCESS);
|
||||
}
|
||||
|
||||
void PrintViewManagerElectron::Reset() {
|
||||
printing_rfh_ = nullptr;
|
||||
callback_.Reset();
|
||||
|
|
|
@ -61,23 +61,22 @@ class PrintViewManagerElectron
|
|||
PrintToPDFCallback callback);
|
||||
|
||||
private:
|
||||
explicit PrintViewManagerElectron(content::WebContents* web_contents);
|
||||
friend class content::WebContentsUserData<PrintViewManagerElectron>;
|
||||
|
||||
explicit PrintViewManagerElectron(content::WebContents* web_contents);
|
||||
|
||||
void OnDidPrintWithParams(printing::mojom::PrintWithParamsResultPtr result);
|
||||
|
||||
// WebContentsObserver overrides (via PrintManager):
|
||||
void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
|
||||
|
||||
// printing::mojom::PrintManagerHost:
|
||||
void DidPrintDocument(printing::mojom::DidPrintDocumentParamsPtr params,
|
||||
DidPrintDocumentCallback callback) override;
|
||||
void DidGetPrintedPagesCount(int32_t cookie, uint32_t number_pages) override;
|
||||
void GetDefaultPrintSettings(
|
||||
GetDefaultPrintSettingsCallback callback) override;
|
||||
void ScriptedPrint(printing::mojom::ScriptedPrintParamsPtr params,
|
||||
ScriptedPrintCallback callback) override;
|
||||
void ShowInvalidPrinterSettingsError() override;
|
||||
void PrintingFailed(int32_t cookie,
|
||||
printing::mojom::PrintFailureReason reason) override;
|
||||
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
||||
void UpdatePrintSettings(int32_t cookie,
|
||||
base::Value::Dict job_settings,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue