🎨
This commit is contained in:
parent
e0b39247a9
commit
aa29bf8019
6 changed files with 17 additions and 19 deletions
|
@ -140,16 +140,16 @@ struct Converter<PrintSettings> {
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct Converter<printing::PrinterBasicInfo> {
|
struct Converter<printing::PrinterBasicInfo> {
|
||||||
static v8::Local<v8::Value>
|
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
||||||
ToV8(v8::Isolate* isolate, const printing::PrinterBasicInfo& val) {
|
const printing::PrinterBasicInfo& val) {
|
||||||
mate::Dictionary dict(isolate, v8::Object::New(isolate));
|
mate::Dictionary dict(isolate, v8::Object::New(isolate));
|
||||||
dict.Set("name", val.printer_name);
|
dict.Set("name", val.printer_name);
|
||||||
dict.Set("description", val.printer_description);
|
dict.Set("description", val.printer_description);
|
||||||
dict.Set("status", val.printer_status);
|
dict.Set("status", val.printer_status);
|
||||||
dict.Set("isDefault", val.is_default);
|
dict.Set("isDefault", val.is_default);
|
||||||
dict.Set("options", val.options);
|
dict.Set("options", val.options);
|
||||||
return dict.GetHandle();
|
return dict.GetHandle();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
|
@ -1322,9 +1322,7 @@ void WebContents::Print(mate::Arguments* args) {
|
||||||
settings.device_name);
|
settings.device_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<printing::PrinterBasicInfo> WebContents::GetPrinterList() {
|
||||||
std::vector<printing::PrinterBasicInfo> WebContents::GetPrinterList(
|
|
||||||
mate::Arguments* args) {
|
|
||||||
std::vector<printing::PrinterBasicInfo> printers;
|
std::vector<printing::PrinterBasicInfo> printers;
|
||||||
auto print_backend = printing::PrintBackend::CreateInstance(nullptr);
|
auto print_backend = printing::PrintBackend::CreateInstance(nullptr);
|
||||||
print_backend->EnumeratePrinters(&printers);
|
print_backend->EnumeratePrinters(&printers);
|
||||||
|
|
|
@ -122,7 +122,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
||||||
void SetAudioMuted(bool muted);
|
void SetAudioMuted(bool muted);
|
||||||
bool IsAudioMuted();
|
bool IsAudioMuted();
|
||||||
void Print(mate::Arguments* args);
|
void Print(mate::Arguments* args);
|
||||||
std::vector<printing::PrinterBasicInfo> GetPrinterList(mate::Arguments* args);
|
std::vector<printing::PrinterBasicInfo> GetPrinterList();
|
||||||
void SetEmbedder(const WebContents* embedder);
|
void SetEmbedder(const WebContents* embedder);
|
||||||
|
|
||||||
// Print current page as PDF.
|
// Print current page as PDF.
|
||||||
|
|
|
@ -41,7 +41,7 @@ class PrintViewManagerBase : public content::NotificationObserver,
|
||||||
// this function. Returns false if printing is impossible at the moment.
|
// this function. Returns false if printing is impossible at the moment.
|
||||||
virtual bool PrintNow(content::RenderFrameHost* rfh,
|
virtual bool PrintNow(content::RenderFrameHost* rfh,
|
||||||
bool silent, bool print_background,
|
bool silent, bool print_background,
|
||||||
const base::string16&);
|
const base::string16& device_name);
|
||||||
#endif // !DISABLE_BASIC_PRINTING
|
#endif // !DISABLE_BASIC_PRINTING
|
||||||
|
|
||||||
// PrintedPagesSource implementation.
|
// PrintedPagesSource implementation.
|
||||||
|
|
|
@ -116,9 +116,8 @@ bool PrintingMessageFilter::OnMessageReceived(const IPC::Message& message) {
|
||||||
#endif
|
#endif
|
||||||
IPC_MESSAGE_HANDLER_DELAY_REPLY(PrintHostMsg_GetDefaultPrintSettings,
|
IPC_MESSAGE_HANDLER_DELAY_REPLY(PrintHostMsg_GetDefaultPrintSettings,
|
||||||
OnGetDefaultPrintSettings)
|
OnGetDefaultPrintSettings)
|
||||||
|
|
||||||
IPC_MESSAGE_HANDLER_DELAY_REPLY(PrintHostMsg_InitSettingWithDeviceName,
|
IPC_MESSAGE_HANDLER_DELAY_REPLY(PrintHostMsg_InitSettingWithDeviceName,
|
||||||
OnInitSettingWithDeviceName)
|
OnInitSettingWithDeviceName)
|
||||||
IPC_MESSAGE_HANDLER_DELAY_REPLY(PrintHostMsg_ScriptedPrint, OnScriptedPrint)
|
IPC_MESSAGE_HANDLER_DELAY_REPLY(PrintHostMsg_ScriptedPrint, OnScriptedPrint)
|
||||||
IPC_MESSAGE_HANDLER_DELAY_REPLY(PrintHostMsg_UpdatePrintSettings,
|
IPC_MESSAGE_HANDLER_DELAY_REPLY(PrintHostMsg_UpdatePrintSettings,
|
||||||
OnUpdatePrintSettings)
|
OnUpdatePrintSettings)
|
||||||
|
|
|
@ -64,7 +64,7 @@ class PrintingMessageFilter : public content::BrowserMessageFilter {
|
||||||
|
|
||||||
// Set deviceName
|
// Set deviceName
|
||||||
void OnInitSettingWithDeviceName(const base::string16& device_name,
|
void OnInitSettingWithDeviceName(const base::string16& device_name,
|
||||||
IPC::Message* reply_msg);
|
IPC::Message* reply_msg);
|
||||||
|
|
||||||
void OnGetDefaultPrintSettingsReply(scoped_refptr<PrinterQuery> printer_query,
|
void OnGetDefaultPrintSettingsReply(scoped_refptr<PrinterQuery> printer_query,
|
||||||
IPC::Message* reply_msg);
|
IPC::Message* reply_msg);
|
||||||
|
|
|
@ -1026,7 +1026,8 @@ bool PrintWebViewHelper::InitPrintSettings(bool fit_to_paper_size,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PrintWebViewHelper::CalculateNumberOfPages(blink::WebLocalFrame* frame,
|
bool PrintWebViewHelper::CalculateNumberOfPages(blink::WebLocalFrame* frame,
|
||||||
const blink::WebNode& node, int* number_of_pages,
|
const blink::WebNode& node,
|
||||||
|
int* number_of_pages,
|
||||||
const base::string16& device_name) {
|
const base::string16& device_name) {
|
||||||
DCHECK(frame);
|
DCHECK(frame);
|
||||||
bool fit_to_paper_size = !(PrintingNodeOrPdfFrame(frame, node));
|
bool fit_to_paper_size = !(PrintingNodeOrPdfFrame(frame, node));
|
||||||
|
|
Loading…
Reference in a new issue