Commit 85f34f07 authored by Julie Jeongeun Kim's avatar Julie Jeongeun Kim Committed by Commit Bot

[printing] Convert PrintHostMsg_DidGetDocumentCookie to Mojo

This CL converts PrintHostMsg_DidGetDocumentCookie message to
DidGetDocumentCookie() in mojom::PrintManagerHost.

Bug: 1008939
Change-Id: I8cb535babd6fbd70efa408675e235ba8375c5873
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2352297Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Reviewed-by: default avatarDave Tapuska <dtapuska@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Julie Kim <jkim@igalia.com>
Cr-Commit-Position: refs/heads/master@{#798989}
parent b39dbbb2
......@@ -85,8 +85,6 @@ bool PrintManager::OnMessageReceived(
FrameDispatchHelper helper = {this, render_frame_host};
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(PrintManager, message)
IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetDocumentCookie,
OnDidGetDocumentCookie)
IPC_MESSAGE_FORWARD_DELAY_REPLY(
PrintHostMsg_GetDefaultPrintSettings, &helper,
FrameDispatchHelper::OnGetDefaultPrintSettings)
......@@ -113,7 +111,7 @@ void PrintManager::DidGetPrintedPagesCount(int32_t cookie,
number_pages_ = number_pages;
}
void PrintManager::OnDidGetDocumentCookie(int cookie) {
void PrintManager::DidGetDocumentCookie(int32_t cookie) {
cookie_ = cookie;
}
......
......@@ -42,6 +42,7 @@ class PrintManager : public content::WebContentsObserver,
// printing::mojom::PrintManager:
void DidGetPrintedPagesCount(int32_t cookie, int32_t number_pages) override;
void DidGetDocumentCookie(int32_t cookie) override;
protected:
explicit PrintManager(content::WebContents* contents);
......@@ -111,8 +112,6 @@ class PrintManager : public content::WebContentsObserver,
#endif
private:
void OnDidGetDocumentCookie(int cookie);
// Stores a PrintRenderFrame associated remote with the RenderFrameHost used
// to bind it. The PrintRenderFrame is used to transmit mojo interface method
// calls to the associated receiver.
......
......@@ -246,4 +246,7 @@ interface PrintManagerHost {
// Tells the browser that the renderer is done calculating the number of
// rendered pages according to the specified settings.
DidGetPrintedPagesCount(int32 cookie, int32 number_pages);
// Sends the document cookie of the current printer query to the browser.
DidGetDocumentCookie(int32 cookie);
};
......@@ -290,10 +290,6 @@ IPC_STRUCT_END()
// Messages sent from the renderer to the browser.
// Sends the document cookie of the current printer query to the browser.
IPC_MESSAGE_ROUTED1(PrintHostMsg_DidGetDocumentCookie,
int /* rendered document cookie */)
// Tells the browser that the print dialog has been shown.
IPC_MESSAGE_ROUTED0(PrintHostMsg_DidShowPrintDialog)
......
......@@ -2780,8 +2780,7 @@ void PrintRenderFrameHelper::PrintPreviewContext::CalculatePluginAttributes() {
void PrintRenderFrameHelper::SetPrintPagesParams(
const PrintMsg_PrintPages_Params& settings) {
print_pages_params_ = std::make_unique<PrintMsg_PrintPages_Params>(settings);
Send(new PrintHostMsg_DidGetDocumentCookie(routing_id(),
settings.params.document_cookie));
GetPrintManagerHost()->DidGetDocumentCookie(settings.params.document_cookie);
}
PrintRenderFrameHelper::ScopedIPC::ScopedIPC(
......
......@@ -228,6 +228,7 @@ class TestPrintManagerHost
EXPECT_EQ(number_pages, number_pages_);
printer_->SetPrintedPagesCount(cookie, number_pages);
}
void DidGetDocumentCookie(int32_t cookie) override {}
void SetExpectedPagesCount(int32_t number_pages) {
number_pages_ = number_pages;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment