Print enhancement: add webContents.printerList And a print option to select printer

This commit is contained in:
renaesop 2017-02-06 17:18:04 +08:00
parent 093b844859
commit 023a3fd547
15 changed files with 290 additions and 27 deletions

View file

@ -23,7 +23,8 @@ PrintMsg_Print_Params::PrintMsg_Print_Params()
print_scaling_option(blink::WebPrintScalingOptionSourceSize),
title(),
url(),
should_print_backgrounds(false) {
should_print_backgrounds(false),
device_name() {
}
PrintMsg_Print_Params::~PrintMsg_Print_Params() {}
@ -45,6 +46,7 @@ void PrintMsg_Print_Params::Reset() {
title.clear();
url.clear();
should_print_backgrounds = false;
device_name.clear();
}
PrintMsg_PrintPages_Params::PrintMsg_PrintPages_Params()

View file

@ -52,6 +52,7 @@ struct PrintMsg_Print_Params {
base::string16 title;
base::string16 url;
bool should_print_backgrounds;
base::string16 device_name;
};
struct PrintMsg_PrintPages_Params {
@ -213,9 +214,10 @@ IPC_STRUCT_END()
// Tells the render view to switch the CSS to print media type, renders every
// requested pages and switch back the CSS to display media type.
IPC_MESSAGE_ROUTED2(PrintMsg_PrintPages,
IPC_MESSAGE_ROUTED3(PrintMsg_PrintPages,
bool /* silent print */,
bool /* print page's background */)
bool /* print page's background */,
base::string16 /* device name*/)
// Tells the render view that printing is done so it can clean up.
IPC_MESSAGE_ROUTED1(PrintMsg_PrintingDone,
@ -260,6 +262,11 @@ IPC_MESSAGE_ROUTED1(PrintHostMsg_DidPrintPage,
IPC_SYNC_MESSAGE_ROUTED0_1(PrintHostMsg_GetDefaultPrintSettings,
PrintMsg_Print_Params /* default_settings */)
// you can set the printer
IPC_SYNC_MESSAGE_ROUTED1_1(PrintHostMsg_InitSettingWithDeviceName,
base::string16, /* device name */
PrintMsg_Print_Params /* default_settings */)
// The renderer wants to update the current print settings with new
// |job_settings|.
IPC_SYNC_MESSAGE_ROUTED2_2(PrintHostMsg_UpdatePrintSettings,