mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
* chore: bump chromium in DEPS to 87.0.4265.1 * chore: bump chromium in DEPS to 87.0.4266.2 * chore: bump chromium in DEPS to 87.0.4267.1 * update patches * chore: bump chromium in DEPS to 87.0.4270.0 * Update patches * Move content::WebPreferences struct to Blink https://chromium-review.googlesource.com/c/chromium/src/+/2397670 (cherry picked from commit5c98c5ebf4) * viz: Rename RenderPass to CompositorRenderPass (and related types). https://chromium-review.googlesource.com/c/chromium/src/+/2380730 (cherry picked from commitae999b29c1) * 2320268: Migrate DragHostMsg_StartDragging to Mojo Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2320268 (cherry picked from commit4e835d505d) * Make FileURLLoaderFactory always owned by its |receivers_|. https://chromium-review.googlesource.com/c/chromium/src/+/2337411 (cherry picked from commit284abad17d) * fix: add a patch to remove deprecated factory (cherry picked from commit98c9616829) Co-Authored-By: Robo <hop2deep@gmail.com> * fixup patch (cherry picked from commit98c9616829) Co-Authored-By: Robo <hop2deep@gmail.com> * Add MIME sniffer overloads that take base::StringPieces https://chromium-review.googlesource.com/c/chromium/src/+/2382896 (cherry picked from commit211fd4f8f0) * chore: implement GetSurveyAPIKey Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2362182 (cherry picked from commit6c539bc6fc) * 2415752: Reland "Reland "OOR-CORS: Remove BlinkCORS supporting code outside Blink"" Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2415752 (cherry picked from commitb67757d77d) * Make FileURLLoaderFactory always owned by its |receivers_|. https://chromium-review.googlesource.com/c/chromium/src/+/2337411 (cherry picked from commit507eb0965f) * fixup! Make FileURLLoaderFactory always owned by its |receivers_|. (cherry picked from commite19400b4e2) * 2418471: PDF Viewer update: Add missing aria-labels to various buttons. https://chromium-review.googlesource.com/c/chromium/src/+/2418471 * chore: bump chromium in DEPS to 87.0.4271.0 * Refactor WebContentSettingsClient to dedupe AllowXYZ methods https://chromium-review.googlesource.com/c/chromium/src/+/2353552 (cherry picked from commitf1a5414372) * 2402123: Use end date when deleting http auth cache Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2402123 (cherry picked from commitd00971d0cb) * [printing] Move PrintHostMsg_PreviewIds to print.mojom https://chromium-review.googlesource.com/c/chromium/src/+/2379455 (cherry picked from commite212297da9) * update patches * 2401303: Move content/browser/frame_host/* over to content/browser/renderer_host/ https://chromium-review.googlesource.com/c/chromium/src/+/2401303 (cherry picked from commitbcffa8aeab) * Introduce NonNetworkURLLoaderFactoryBase class. https://chromium-review.googlesource.com/c/chromium/src/+/2357559 (cherry picked from commit33e2e12114) * fix: add a patch to remove deprecated factory (cherry picked from commit98c9616829) * chore: non_network_url_loader_factory_base was moved Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2357431 (cherry picked from commita1a8878402) * chore: replace CreateWebUIURLLoader with CreateWebUIURLLoaderFactory Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2358309 (cherry picked from commit40bfaa5ea4) * 2346803: Study whether blocking of requests via webRequest is fingerprintable https://chromium-review.googlesource.com/c/chromium/src/+/2346803 * lint cleanup * chore: bump chromium in DEPS to 87.0.4272.0 * update patches * 2387901: Accessing C++ enums in Java for WebBluetooth https://chromium-review.googlesource.com/c/chromium/src/+/2387901 * chore: bump chromium in DEPS to 87.0.4273.0 * Update patches (cherry picked from commit b389d4adca71e268c390c41370e87033b69c649c) * chore: bump chromium in DEPS to 87.0.4274.0 * chore: bump chromium in DEPS to 87.0.4275.0 * chore: bump chromium in DEPS to 87.0.4276.0 * update patches * 2418443: Explicit use of deprecated global sources assignment filter https://chromium-review.googlesource.com/c/chromium/src/+/2418443 * fixup 2418443: Explicit use of deprecated global sources assignment filter * Use 87.0.4274.2 for now * 2401847: Cache Storage Permissions on ContentSettingsClientImpl https://chromium-review.googlesource.com/c/chromium/src/+/2401847 * 2418568: Remove ConvertPointToPixel() methods. https://chromium-review.googlesource.com/c/chromium/src/+/2418568 * 2419388: Rename Button methods to be suitable for builders and properties. https://chromium-review.googlesource.com/c/chromium/src/+/2419388 * [XProto] Remove usage of all Xlib headers https: //chromium-review.googlesource.com/c/chromium/src/+/2392140 Co-Authored-By: Robo <hop2deep@gmail.com> * service_manager::kCrashDumpSignal -> kCrashDumpSignal Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2417073 (cherry picked from commit 7d9d2a172f50e12830a2b8fbfbb2fe344756c377) * gfx::ConvertPointToPixel -> gfx::ConvertPointToPixels Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2418568 (cherry picked from commit a0bf07570409f84a3b7fa9d12bddd8c1805f43c5) * Fixup [XProto] Remove usage of all Xlib headers * Set appid on Pip windows. https: //chromium-review.googlesource.com/c/chromium/src/+/2388274 Co-Authored-By: Robo <hop2deep@gmail.com> * chore: update node patches for common.gypi Co-Authored-By: Samuel Attard <MarshallOfSound@users.noreply.github.com> * Try using lower number of processes for linux * fixup call to diagnose_goma_log.py * Use larger machines on linux to work around goma issue * Don't fail on goma stats * don't exit immediately * turn off pipefail * always return true Co-authored-by: John Kleinschmidt <jkleinsc@github.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com> Co-authored-by: Andy Locascio <andy@slack-corp.com> Co-authored-by: Samuel Attard <MarshallOfSound@users.noreply.github.com>
107 lines
4.1 KiB
C++
107 lines
4.1 KiB
C++
// Copyright (c) 2018 GitHub, Inc.
|
|
// Use of this source code is governed by the MIT license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef SHELL_BROWSER_PRINTING_PRINT_PREVIEW_MESSAGE_HANDLER_H_
|
|
#define SHELL_BROWSER_PRINTING_PRINT_PREVIEW_MESSAGE_HANDLER_H_
|
|
|
|
#include <map>
|
|
|
|
#include "base/memory/ref_counted_memory.h"
|
|
#include "base/memory/weak_ptr.h"
|
|
#include "components/printing/common/print.mojom.h"
|
|
#include "components/services/print_compositor/public/mojom/print_compositor.mojom.h"
|
|
#include "content/public/browser/web_contents_observer.h"
|
|
#include "content/public/browser/web_contents_user_data.h"
|
|
#include "mojo/public/cpp/bindings/associated_receiver.h"
|
|
#include "mojo/public/cpp/bindings/associated_remote.h"
|
|
#include "shell/common/gin_helper/promise.h"
|
|
#include "v8/include/v8.h"
|
|
|
|
struct PrintHostMsg_DidPreviewDocument_Params;
|
|
struct PrintHostMsg_DidPreviewPage_Params;
|
|
|
|
namespace content {
|
|
class RenderFrameHost;
|
|
}
|
|
|
|
namespace electron {
|
|
|
|
// Manages the print preview handling for a WebContents.
|
|
class PrintPreviewMessageHandler
|
|
: public content::WebContentsObserver,
|
|
public printing::mojom::PrintPreviewUI,
|
|
public content::WebContentsUserData<PrintPreviewMessageHandler> {
|
|
public:
|
|
~PrintPreviewMessageHandler() override;
|
|
|
|
void PrintToPDF(base::DictionaryValue options,
|
|
gin_helper::Promise<v8::Local<v8::Value>> promise);
|
|
|
|
protected:
|
|
// content::WebContentsObserver implementation.
|
|
bool OnMessageReceived(const IPC::Message& message,
|
|
content::RenderFrameHost* render_frame_host) override;
|
|
|
|
private:
|
|
friend class content::WebContentsUserData<PrintPreviewMessageHandler>;
|
|
|
|
explicit PrintPreviewMessageHandler(content::WebContents* web_contents);
|
|
|
|
void OnMetafileReadyForPrinting(
|
|
content::RenderFrameHost* render_frame_host,
|
|
const printing::mojom::DidPreviewDocumentParams& params,
|
|
const printing::mojom::PreviewIds& ids);
|
|
void OnCompositeDocumentToPdfDone(
|
|
const printing::mojom::PreviewIds& ids,
|
|
printing::mojom::PrintCompositor::Status status,
|
|
base::ReadOnlySharedMemoryRegion region);
|
|
void OnPrepareForDocumentToPdfDone(
|
|
const printing::mojom::PreviewIds& ids,
|
|
printing::mojom::PrintCompositor::Status status);
|
|
void OnDidPrepareForDocumentToPdf(content::RenderFrameHost* render_frame_host,
|
|
int document_cookie,
|
|
const printing::mojom::PreviewIds& ids);
|
|
void OnCompositePdfPageDone(int page_number,
|
|
int document_cookie,
|
|
const printing::mojom::PreviewIds& ids,
|
|
printing::mojom::PrintCompositor::Status status,
|
|
base::ReadOnlySharedMemoryRegion region);
|
|
void OnDidPreviewPage(content::RenderFrameHost* render_frame_host,
|
|
const printing::mojom::DidPreviewPageParams& params,
|
|
const printing::mojom::PreviewIds& ids);
|
|
|
|
// printing::mojo::PrintPreviewUI:
|
|
void SetOptionsFromDocument(
|
|
const printing::mojom::OptionsFromDocumentParamsPtr params,
|
|
int32_t request_id) override {}
|
|
void PrintPreviewFailed(int32_t document_cookie, int32_t request_id) override;
|
|
void PrintPreviewCancelled(int32_t document_cookie,
|
|
int32_t request_id) override;
|
|
void PrinterSettingsInvalid(int32_t document_cookie,
|
|
int32_t request_id) override {}
|
|
|
|
gin_helper::Promise<v8::Local<v8::Value>> GetPromise(int request_id);
|
|
|
|
void ResolvePromise(int request_id,
|
|
scoped_refptr<base::RefCountedMemory> data_bytes);
|
|
void RejectPromise(int request_id);
|
|
|
|
using PromiseMap = std::map<int, gin_helper::Promise<v8::Local<v8::Value>>>;
|
|
PromiseMap promise_map_;
|
|
|
|
mojo::AssociatedRemote<printing::mojom::PrintRenderFrame> print_render_frame_;
|
|
|
|
mojo::AssociatedReceiver<printing::mojom::PrintPreviewUI> receiver_{this};
|
|
|
|
base::WeakPtrFactory<PrintPreviewMessageHandler> weak_ptr_factory_;
|
|
|
|
WEB_CONTENTS_USER_DATA_KEY_DECL();
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(PrintPreviewMessageHandler);
|
|
};
|
|
|
|
} // namespace electron
|
|
|
|
#endif // SHELL_BROWSER_PRINTING_PRINT_PREVIEW_MESSAGE_HANDLER_H_
|