This commit is contained in:
Kevin Sawicki 2017-05-18 10:26:22 -07:00
parent e0b39247a9
commit aa29bf8019
6 changed files with 17 additions and 19 deletions

View file

@ -140,16 +140,16 @@ struct Converter<PrintSettings> {
template<>
struct Converter<printing::PrinterBasicInfo> {
static v8::Local<v8::Value>
ToV8(v8::Isolate* isolate, const printing::PrinterBasicInfo& val) {
mate::Dictionary dict(isolate, v8::Object::New(isolate));
dict.Set("name", val.printer_name);
dict.Set("description", val.printer_description);
dict.Set("status", val.printer_status);
dict.Set("isDefault", val.is_default);
dict.Set("options", val.options);
return dict.GetHandle();
}
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const printing::PrinterBasicInfo& val) {
mate::Dictionary dict(isolate, v8::Object::New(isolate));
dict.Set("name", val.printer_name);
dict.Set("description", val.printer_description);
dict.Set("status", val.printer_status);
dict.Set("isDefault", val.is_default);
dict.Set("options", val.options);
return dict.GetHandle();
}
};
template<>
@ -1322,9 +1322,7 @@ void WebContents::Print(mate::Arguments* args) {
settings.device_name);
}
std::vector<printing::PrinterBasicInfo> WebContents::GetPrinterList(
mate::Arguments* args) {
std::vector<printing::PrinterBasicInfo> WebContents::GetPrinterList() {
std::vector<printing::PrinterBasicInfo> printers;
auto print_backend = printing::PrintBackend::CreateInstance(nullptr);
print_backend->EnumeratePrinters(&printers);

View file

@ -122,7 +122,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
void SetAudioMuted(bool muted);
bool IsAudioMuted();
void Print(mate::Arguments* args);
std::vector<printing::PrinterBasicInfo> GetPrinterList(mate::Arguments* args);
std::vector<printing::PrinterBasicInfo> GetPrinterList();
void SetEmbedder(const WebContents* embedder);
// Print current page as PDF.

View file

@ -41,7 +41,7 @@ class PrintViewManagerBase : public content::NotificationObserver,
// this function. Returns false if printing is impossible at the moment.
virtual bool PrintNow(content::RenderFrameHost* rfh,
bool silent, bool print_background,
const base::string16&);
const base::string16& device_name);
#endif // !DISABLE_BASIC_PRINTING
// PrintedPagesSource implementation.

View file

@ -116,9 +116,8 @@ bool PrintingMessageFilter::OnMessageReceived(const IPC::Message& message) {
#endif
IPC_MESSAGE_HANDLER_DELAY_REPLY(PrintHostMsg_GetDefaultPrintSettings,
OnGetDefaultPrintSettings)
IPC_MESSAGE_HANDLER_DELAY_REPLY(PrintHostMsg_InitSettingWithDeviceName,
OnInitSettingWithDeviceName)
OnInitSettingWithDeviceName)
IPC_MESSAGE_HANDLER_DELAY_REPLY(PrintHostMsg_ScriptedPrint, OnScriptedPrint)
IPC_MESSAGE_HANDLER_DELAY_REPLY(PrintHostMsg_UpdatePrintSettings,
OnUpdatePrintSettings)

View file

@ -64,7 +64,7 @@ class PrintingMessageFilter : public content::BrowserMessageFilter {
// Set deviceName
void OnInitSettingWithDeviceName(const base::string16& device_name,
IPC::Message* reply_msg);
IPC::Message* reply_msg);
void OnGetDefaultPrintSettingsReply(scoped_refptr<PrinterQuery> printer_query,
IPC::Message* reply_msg);

View file

@ -1026,7 +1026,8 @@ bool PrintWebViewHelper::InitPrintSettings(bool fit_to_paper_size,
}
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) {
DCHECK(frame);
bool fit_to_paper_size = !(PrintingNodeOrPdfFrame(frame, node));